aboutsummaryrefslogtreecommitdiffstats
path: root/lang/egcs
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-12-05 06:07:01 +0800
committerobrien <obrien@FreeBSD.org>2000-12-05 06:07:01 +0800
commit15ea0e76c022b8034b62c81413104822fc8b0eca (patch)
tree1f9930d2f4893b6b0c1d00ebb9f6e60bc6c5ba62 /lang/egcs
parent3ff93c9c30c4c9a407a9b7b9158f08492a1e53f4 (diff)
downloadfreebsd-ports-gnome-15ea0e76c022b8034b62c81413104822fc8b0eca.tar.gz
freebsd-ports-gnome-15ea0e76c022b8034b62c81413104822fc8b0eca.tar.zst
freebsd-ports-gnome-15ea0e76c022b8034b62c81413104822fc8b0eca.zip
Add all of the FreeBSD hacks I had in the base EGCS-1.1.2 compiler way
back when... that is all but a.out support.
Diffstat (limited to 'lang/egcs')
-rw-r--r--lang/egcs/files/patch-af15
-rw-r--r--lang/egcs/files/patch-ai9
-rw-r--r--lang/egcs/files/patch-ak4
-rw-r--r--lang/egcs/files/patch-al4
-rw-r--r--lang/egcs/files/patch-cccp.c30
-rw-r--r--lang/egcs/files/patch-choose-temp.c45
-rw-r--r--lang/egcs/files/patch-cp%decl.c45
-rw-r--r--lang/egcs/files/patch-cp%ptree.c33
-rw-r--r--lang/egcs/files/patch-dbxout.c27
-rw-r--r--lang/egcs/files/patch-gcc.1207
-rw-r--r--lang/egcs/files/patch-gcc.c234
-rw-r--r--lang/egcs/files/patch-pexecute.c11
-rw-r--r--lang/egcs/files/patch-xm-freebsd.h19
13 files changed, 659 insertions, 24 deletions
diff --git a/lang/egcs/files/patch-af b/lang/egcs/files/patch-af
index c1f1ba0e855f..debdbc72846a 100644
--- a/lang/egcs/files/patch-af
+++ b/lang/egcs/files/patch-af
@@ -1,13 +1,6 @@
--- gcc/config/i386/freebsd.h.orig Mon Mar 1 14:47:32 1999
-+++ gcc/config/i386/freebsd.h Sun Mar 21 16:58:39 1999
-@@ -21,19 +21,13 @@
- the Free Software Foundation, 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-+
-+/* Get generic FreeBSD definitions. */
-+#include <freebsd.h>
-+
++++ gcc/config/i386/freebsd.h Mon Dec 4 14:03:42 2000
+@@ -24,16 +24,6 @@
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
@@ -24,7 +17,7 @@
/* This is how to output an element of a case-vector that is relative.
This is only used for PIC code. See comments by the `casesi' insn in
i386.md for an explanation of the expression this outputs. */
-@@ -113,22 +107,19 @@
+@@ -113,22 +103,19 @@
: ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
: (-1))
@@ -51,7 +44,7 @@
} \
}
-@@ -145,26 +136,16 @@
+@@ -145,26 +132,16 @@
#define WCHAR_TYPE_SIZE BITS_PER_WORD
#undef CPP_PREDEFINES
diff --git a/lang/egcs/files/patch-ai b/lang/egcs/files/patch-ai
index 4395574d635a..f26858c55ca0 100644
--- a/lang/egcs/files/patch-ai
+++ b/lang/egcs/files/patch-ai
@@ -1,14 +1,5 @@
--- gcc/final.c.orig Sat Sep 5 22:52:01 1998
+++ gcc/final.c Wed Oct 7 17:06:58 1998
-@@ -383,6 +383,8 @@
- /* zero word */
- assemble_integer (const0_rtx, long_bytes, 1);
-
-+ fprintf(asm_out_file,".stabs \"bbset\", 25, 0, 0, LPBX0\n");
-+
- /* address of filename */
- ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 1);
- assemble_integer (gen_rtx_SYMBOL_REF (Pmode, name), pointer_bytes, 1);
@@ -1635,6 +1637,9 @@
leaf_renumber_regs (first);
#endif
diff --git a/lang/egcs/files/patch-ak b/lang/egcs/files/patch-ak
index 2e54beea1a61..56794d7caeb5 100644
--- a/lang/egcs/files/patch-ak
+++ b/lang/egcs/files/patch-ak
@@ -5,7 +5,7 @@
fi
;;
+ alpha*-*-freebsd*)
-+ tm_file="${tm_file} freebsd.h alpha/freebsd.h alpha/freebsd-elf.h"
++ tm_file="${tm_file} freebsd.h alpha/alpha.h alpha/elf.h alpha/freebsd.h alpha/freebsd-elf.h"
+ xm_file="${xm_file} xm-freebsd.h"
+ target_cpu_default="MASK_GAS"
+ tmake_file="t-freebsd alpha/t-crtbe"
@@ -35,7 +35,7 @@
;;
i[34567]86-*-freebsd*)
- tm_file=i386/freebsd.h
-+ tm_file="i386/i386.h i386/att.h linux.h i386/freebsd.h i386/perform.h"
++ tm_file="i386/i386.h i386/att.h linux.h freebsd.h i386/freebsd.h i386/perform.h"
# On FreeBSD, the headers are already ok, except for math.h.
fixincludes=fixinc.wrap
- tmake_file=i386/t-freebsd
diff --git a/lang/egcs/files/patch-al b/lang/egcs/files/patch-al
index c8a195127ed0..13cd94d70fc0 100644
--- a/lang/egcs/files/patch-al
+++ b/lang/egcs/files/patch-al
@@ -5,7 +5,7 @@
fi
;;
+ alpha*-*-freebsd*)
-+ tm_file="${tm_file} freebsd.h alpha/freebsd.h alpha/freebsd-elf.h"
++ tm_file="${tm_file} freebsd.h alpha/alpha.h alpha/elf.h alpha/freebsd.h alpha/freebsd-elf.h"
+ xm_file="${xm_file} xm-freebsd.h"
+ target_cpu_default="MASK_GAS"
+ tmake_file="t-freebsd alpha/t-crtbe"
@@ -35,7 +35,7 @@
;;
i[[34567]]86-*-freebsd*)
- tm_file=i386/freebsd.h
-+ tm_file="i386/i386.h i386/att.h linux.h i386/freebsd.h i386/perform.h"
++ tm_file="i386/i386.h i386/att.h linux.h freebsd.h i386/freebsd.h i386/perform.h"
# On FreeBSD, the headers are already ok, except for math.h.
fixincludes=fixinc.wrap
- tmake_file=i386/t-freebsd
diff --git a/lang/egcs/files/patch-cccp.c b/lang/egcs/files/patch-cccp.c
new file mode 100644
index 000000000000..b524049ce1d7
--- /dev/null
+++ b/lang/egcs/files/patch-cccp.c
@@ -0,0 +1,30 @@
+--- gcc/cccp.c.orig 1999/08/26 09:26:39 1.1.1.2
++++ gcc/cccp.c 1999/08/27 11:02:42 1.3
+@@ -5096,6 +5096,7 @@
+ register struct file_name_map *map;
+ register char *from;
+
++#ifndef FREEBSD_NATIVE
+ if (searchptr)
+ {
+ if (! searchptr->got_name_map)
+@@ -5110,6 +5111,7 @@
+ if (! strcmp (map->map_from, from))
+ return map->map_to;
+ }
++#endif
+
+ from = base_name (filename);
+
+@@ -5124,9 +5126,11 @@
+ bcopy (filename, dir, from - filename);
+ dir[from - filename] = '\0';
+
++#ifndef FREEBSD_NATIVE
+ for (map = read_name_map (dir); map; map = map->map_next)
+ if (! strcmp (map->map_from, from))
+ return map->map_to;
++#endif
+ }
+
+ return filename;
diff --git a/lang/egcs/files/patch-choose-temp.c b/lang/egcs/files/patch-choose-temp.c
new file mode 100644
index 000000000000..f0da4087181e
--- /dev/null
+++ b/lang/egcs/files/patch-choose-temp.c
@@ -0,0 +1,45 @@
+--- gcc/choose-temp.c.orig 1999/08/26 09:26:40 1.1.1.1
++++ gcc/choose-temp.c 1999/10/02 21:50:07 1.2
+@@ -22,6 +22,8 @@
+ /* This file lives in at least two places: libiberty and gcc.
+ Don't change one without the other. */
+
++/* $from_FreeBSD: src/contrib/gcc/choose-temp.c,v 1.2 1999/10/02 21:50:07 obrien Exp $ */
++
+ #if defined (IN_GCC) || defined (HAVE_CONFIG_H)
+ #include "config.h"
+ #endif
+@@ -120,13 +122,14 @@
+ base = try (getenv ("TMP"), base);
+ base = try (getenv ("TEMP"), base);
+
++ base = try (tmp, base);
++
+ #ifdef P_tmpdir
+ base = try (P_tmpdir, base);
+ #endif
+
+- /* Try /usr/tmp, then /tmp. */
++ /* Try /usr/tmp even though it usually doesn't exist on FreeBSD. */
+ base = try (usrtmp, base);
+- base = try (tmp, base);
+
+ /* If all else fails, use the current directory! */
+ if (base == 0)
+@@ -166,13 +169,14 @@
+ base = try (getenv ("TMP"), base);
+ base = try (getenv ("TEMP"), base);
+
++ base = try (tmp, base);
++
+ #ifdef P_tmpdir
+ base = try (P_tmpdir, base);
+ #endif
+
+- /* Try /usr/tmp, then /tmp. */
++ /* Try /usr/tmp even though it usually doesn't exist on FreeBSD. */
+ base = try (usrtmp, base);
+- base = try (tmp, base);
+
+ /* If all else fails, use the current directory! */
+ if (base == 0)
diff --git a/lang/egcs/files/patch-cp%decl.c b/lang/egcs/files/patch-cp%decl.c
new file mode 100644
index 000000000000..fabc992987d7
--- /dev/null
+++ b/lang/egcs/files/patch-cp%decl.c
@@ -0,0 +1,45 @@
+--- gcc/cp/decl.c.orig 1999/08/26 09:28:46 1.1.1.2
++++ gcc/cp/decl.c 1999/09/19 10:57:59 1.3
+@@ -19,7 +19,9 @@
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
++/* $from_FreeBSD: src/contrib/gcc/cp/decl.c,v 1.3 1999/09/19 10:57:59 obrien Exp $ */
+
++
+ /* Process declarations and symbol lookup for C front end.
+ Also constructs types; the standard scalar types at initialization,
+ and structure, union, array and enum types when they are declared. */
+@@ -1493,7 +1495,7 @@
+ tree t;
+ int i = 0, len;
+ fprintf (stderr, " blocks=");
+- fprintf (stderr, HOST_PTR_PRINTF, lvl->blocks);
++ fprintf (stderr, HOST_PTR_PRINTF, (void *) lvl->blocks);
+ fprintf (stderr, " n_incomplete=%d parm_flag=%d keep=%d",
+ list_length (lvl->incomplete), lvl->parm_flag, lvl->keep);
+ if (lvl->tag_transparent)
+@@ -1606,7 +1608,7 @@
+ for (level = stack; level != global_binding_level; level = level->level_chain)
+ {
+ fprintf (stderr, "binding level ");
+- fprintf (stderr, HOST_PTR_PRINTF, level);
++ fprintf (stderr, HOST_PTR_PRINTF, (void *) level);
+ fprintf (stderr, "\n");
+ print_binding_level (level);
+ }
+@@ -1617,11 +1619,11 @@
+ {
+ struct binding_level *b;
+ fprintf (stderr, "current_binding_level=");
+- fprintf (stderr, HOST_PTR_PRINTF, current_binding_level);
++ fprintf (stderr, HOST_PTR_PRINTF, (void *) current_binding_level);
+ fprintf (stderr, "\nclass_binding_level=");
+- fprintf (stderr, HOST_PTR_PRINTF, class_binding_level);
++ fprintf (stderr, HOST_PTR_PRINTF, (void *) class_binding_level);
+ fprintf (stderr, "\nglobal_binding_level=");
+- fprintf (stderr, HOST_PTR_PRINTF, global_binding_level);
++ fprintf (stderr, HOST_PTR_PRINTF, (void *) global_binding_level);
+ fprintf (stderr, "\n");
+ if (class_binding_level)
+ {
diff --git a/lang/egcs/files/patch-cp%ptree.c b/lang/egcs/files/patch-cp%ptree.c
new file mode 100644
index 000000000000..acbc3191b42f
--- /dev/null
+++ b/lang/egcs/files/patch-cp%ptree.c
@@ -0,0 +1,33 @@
+--- gcc/cp/ptree.c.orig 1999/08/26 09:29:01 1.1.1.2
++++ gcc/cp/ptree.c 1999/09/19 11:00:01 1.3
+@@ -19,7 +19,9 @@
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
++/* $from_FreeBSD: src/contrib/gcc/cp/ptree.c,v 1.3 1999/09/19 11:00:01 obrien Exp $ */
+
++
+ #include "config.h"
+ #include "system.h"
+ #include "tree.h"
+@@ -46,17 +48,17 @@
+ if (DECL_MAIN_VARIANT (node))
+ {
+ fprintf (file, " decl-main-variant ");
+- fprintf (file, HOST_PTR_PRINTF, DECL_MAIN_VARIANT (node));
++ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_MAIN_VARIANT (node));
+ }
+ if (DECL_PENDING_INLINE_INFO (node))
+ {
+ fprintf (file, " pending-inline-info ");
+- fprintf (file, HOST_PTR_PRINTF, DECL_PENDING_INLINE_INFO (node));
++ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_PENDING_INLINE_INFO (node));
+ }
+ if (DECL_TEMPLATE_INFO (node))
+ {
+ fprintf (file, " template-info ");
+- fprintf (file, HOST_PTR_PRINTF, DECL_TEMPLATE_INFO (node));
++ fprintf (file, HOST_PTR_PRINTF, (void *) DECL_TEMPLATE_INFO (node));
+ }
+ }
+
diff --git a/lang/egcs/files/patch-dbxout.c b/lang/egcs/files/patch-dbxout.c
new file mode 100644
index 000000000000..7250792a9041
--- /dev/null
+++ b/lang/egcs/files/patch-dbxout.c
@@ -0,0 +1,27 @@
+--- gcc/dbxout.c.orig 1999/08/26 09:26:57 1.1.1.2
++++ gcc/dbxout.c 1999/08/28 07:19:03 1.3
+@@ -2685,7 +2685,12 @@
+ {
+ #ifdef DBX_FUNCTION_FIRST
+ dbxout_really_begin_function (decl);
++#else
++#ifdef DBX_CHECK_FUNCTION_FIRST
++ if (DBX_CHECK_FUNCTION_FIRST)
++ dbxout_really_begin_function (decl);
+ #endif
++#endif
+ }
+
+ /* Output dbx data for a function definition.
+@@ -2700,6 +2705,11 @@
+ {
+ #ifndef DBX_FUNCTION_FIRST
+ dbxout_really_begin_function (decl);
++#else
++#ifdef DBX_CHECK_FUNCTION_FIRST
++ if (!(DBX_CHECK_FUNCTION_FIRST))
++ dbxout_really_begin_function (decl);
++#endif
+ #endif
+ dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
+ #ifdef DBX_OUTPUT_FUNCTION_END
diff --git a/lang/egcs/files/patch-gcc.1 b/lang/egcs/files/patch-gcc.1
new file mode 100644
index 000000000000..ebe5610bf0c9
--- /dev/null
+++ b/lang/egcs/files/patch-gcc.1
@@ -0,0 +1,207 @@
+--- gcc/gcc.1.orig 1999/08/26 09:27:23 1.1.1.2
++++ gcc/gcc.1 1999/09/19 09:00:24 1.14
+@@ -1,3 +1,4 @@
++.\" $from_FreeBSD: src/contrib/gcc/gcc.1,v 1.14 1999/09/19 09:00:24 obrien Exp $
+ .\" Copyright (c) 1991, 1992, 1993, 1994 Free Software Foundation -*-Text-*-
+ .\" See section COPYING for conditions for redistribution
+ .\"
+@@ -264,6 +265,8 @@
+ \-O
+ \-O2
+ \-O3
++\-O0
++\-Os
+ .TP
+ .B Preprocessor Options
+ .RI \-A assertion
+@@ -444,10 +447,25 @@
+ .Sp
+ .I i386 Options
+ .br
++\-m386
+ \-m486
++\-mpentium
++\-mpentiumpro
+ \-mno\-486
++\-mcpu=\fIcpu type\fP
++\-march=\fIcpu type\fP
+ \-msoft\-float
++\-mrtd
++\-mregparm
++\-msvr3\-shlib
++\-mno\-ieee\-fp
+ \-mno\-fp\-ret\-in\-387
++\-mfancy\-math\-387
++\-mno\-wide\-multiply
++\-mdebug\-addr
++\-mno\-move
++\-mprofiler\-epilogue
++\-reg\-alloc=LIST
+ .Sp
+ .I HPPA Options
+ .br
+@@ -520,6 +538,16 @@
+ \-fverbose\-asm
+ .ad b
+ .hy 1
++.SH FreeBSD SPECIFIC OPTIONS
++.TP
++.BI "\-pthread"
++Link a user-threaded process against libc_r instead of libc. Objects linked
++into user-threaded processes should be compiled with -D_THREAD_SAFE.
++.TP
++.BI "\-kthread"
++Link a kernel-threaded process against libpthread in addition to libc.
++Objects linked into kernel-threaded processes should be compiled with
++-D_THREAD_SAFE.
+ .SH OVERALL OPTIONS
+ .TP
+ .BI "\-x " "language"
+@@ -1202,13 +1230,17 @@
+ .B \-M\c
+ \&\|' but the output mentions only the user header files
+ included with `\|\c
+-.B #include "\c
++.B
++#include "\c
+ .I file\c
++.B
+ \&"\c
+ \&\|'. System header files
+ included with `\|\c
+-.B #include <\c
++.B
++#include <\c
+ .I file\c
++.B
+ \&>\c
+ \&\|' are omitted.
+ .TP
+@@ -1485,8 +1517,10 @@
+ \&"\c
+ \&\|';
+ they are not searched for `\|\c
+-.B #include <\c
++.B
++#include <\c
+ .I file\c
++.B
+ \&>\c
+ \&\|'.
+ .Sp
+@@ -2000,7 +2034,7 @@
+ .B \-Wnested-externs
+ Warn if an \c
+ .B extern\c
+-\& declaration is encountered within an function.
++\& declaration is encountered within a function.
+ .TP
+ .B \-Wenum\-clash
+ Warn about conversion between different enumeration types (C++ only).
+@@ -2432,6 +2466,12 @@
+ does, along with also turning on
+ .B \-finline\-functions.
+ .TP
++.B \-Os
++Optimize for size. This enables all
++.B \-O2
++optimizations that do not typically increase code size. It also performs
++further optimizations designed to reduce code size.
++.TP
+ .B \-O0
+ Do not optimize.
+ .Sp
+@@ -2981,17 +3021,17 @@
+ .B \-mcypress
+ .TP
+ .B \-msupersparc
+-These two options select the processor for which the code is optimised.
++These two options select the processor for which the code is optimized.
+ .Sp
+ With
+ .B \-mcypress
+-(the default), the compiler optimises code for the Cypress CY7C602 chip, as
++(the default), the compiler optimizes code for the Cypress CY7C602 chip, as
+ used in the SparcStation/SparcServer 3xx series. This is also appropriate for
+ the older SparcStation 1, 2, IPX etc.
+ .Sp
+ With
+ .B \-msupersparc
+-the compiler optimises code for the SuperSparc cpu, as used in the SparcStation
++the compiler optimizes code for the SuperSparc cpu, as used in the SparcStation
+ 10, 1000 and 2000 series. This flag also enables use of the full SPARC v8
+ instruction set.
+ .PP
+@@ -3570,12 +3610,51 @@
+ These `\|\c
+ .B \-m\c
+ \&\|' options are defined for the Intel 80386 family of computers:
++.TP
+ .B \-m486
+ .TP
+ .B \-mno\-486
+ Control whether or not code is optimized for a 486 instead of an
+ 386. Code generated for a 486 will run on a 386 and vice versa.
+ .TP
++.B \-mpentium
++Synonym for
++.B \-mcpu=pentium
++.TP
++.B \-mpentiumpro
++Synonym for
++.B \-mcpu=pentiumpro
++.TP
++.B \-mcpu=\fIcpu type\fP
++Assume the defaults for the machine type CPU TYPE when scheduling instructions.
++The choices for CPU TYPE are:
++.B i386,
++.B i486,
++.B i586
++(pentium),
++.B pentium,
++.B i686
++(pentiumpro), and
++.B pentiumpro.
++While picking a specific CPU TYPE will schedule things appropriately for that
++particular chip, the compiler will not generate any code that does not run on
++the i386 without the
++.B \-march=\fIcpu type\fP
++option being used.
++.TP
++.B \-march=\fIcpu type\fP
++Generate instructions for the machine type CPU TYPE. The choices for CPU TYPE
++are:
++.B i386,
++.B i486,
++.B pentium,
++and
++.B pentiumpro.
++Specifying
++.B \-march=\fIcpu type\fP
++implies
++.B \-mcpu=\fIcpu type\fP.
++.TP
+ .B \-msoft\-float
+ Generate output containing library calls for floating point.
+ .I Warning:
+@@ -3606,6 +3685,11 @@
+ .B \-mno-fp-ret-in-387\c
+ \&\|' causes such values to be returned
+ in ordinary CPU registers instead.
++.TP
++.B \-mprofiler-epilogue
++.TP
++.B \-mno-profiler-epilogue
++Generate extra code to write profile information for function exits.
+ .PP
+ These `\|\c
+ .B \-m\c
+@@ -4141,7 +4225,7 @@
+ .B /tmp\c
+ \&).
+ .SH "SEE ALSO"
+-cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1).
++as(1), cpp(1), gdb(1), ld(1)
+ .br
+ .RB "`\|" gcc "\|', `\|" cpp \|',
+ .RB "`\|" as "\|', `\|" ld \|',
diff --git a/lang/egcs/files/patch-gcc.c b/lang/egcs/files/patch-gcc.c
new file mode 100644
index 000000000000..f361addd9cc7
--- /dev/null
+++ b/lang/egcs/files/patch-gcc.c
@@ -0,0 +1,234 @@
+--- gcc/gcc.c.orig 1999/08/26 09:27:23 1.1.1.3
++++ gcc/gcc.c 1999/09/13 15:50:16 1.10
+@@ -21,6 +21,8 @@
+ This paragraph is here to try to keep Sun CC from dying.
+ The number of chars here seems crucial!!!! */
+
++/* $from_FreeBSD: src/contrib/gcc/gcc.c,v 1.10 1999/09/13 15:50:16 bde Exp $ */
++
+ /* This program is the user interface to the C compiler and possibly to
+ other compilers. It is used because compilation is a complicated procedure
+ which involves running several programs and passing temporary files between
+@@ -2401,6 +2403,9 @@
+ /* Gives value to pass as "warn" to add_prefix for standard prefixes. */
+ static int *warn_std_ptr = 0;
+
++#if defined(FREEBSD_NATIVE) && defined(__i386__)
++static int objformat_aout = 0; /* ELF by default */
++#endif
+
+ #if defined(HAVE_OBJECT_SUFFIX) || defined(HAVE_EXECUTABLE_SUFFIX)
+
+@@ -2712,6 +2717,39 @@
+ }
+ }
+
++#if defined(FREEBSD_NATIVE) && defined(__i386__)
++ {
++ /* first hint is /etc/objformat */
++ FILE *fp = fopen("/etc/objformat", "r");
++ if (fp) {
++ char buf[1024];
++ buf[1023] = '\0';
++ while (fgets(buf, sizeof(buf) - 1, fp) != NULL) {
++ i = strlen(buf);
++ if (buf[i - 1] == '\n')
++ buf[i - 1] = '\0';
++ if (strcmp(buf, "OBJFORMAT=aout") == 0)
++ objformat_aout = 1;
++ else if (strcmp(buf, "OBJFORMAT=elf") == 0)
++ objformat_aout = 0;
++ else
++ fprintf(stderr, "Unrecognized line in /etc/objformat: %s\n", buf);
++ }
++ fclose(fp);
++ }
++ /* but the user $OBJFORMAT overrides system default */
++ temp = getenv("OBJFORMAT");
++ if (temp) {
++ if (strcmp(temp, "aout") == 0)
++ objformat_aout = 1;
++ else if (strcmp(temp, "elf") == 0)
++ objformat_aout = 0;
++ else
++ fprintf(stderr, "Unrecognized value of $OBJFORMAT: %s\n", temp);
++ }
++ }
++#endif
++
+ /* Convert new-style -- options to old-style. */
+ translate_options (&argc, &argv);
+
+@@ -2726,6 +2764,19 @@
+
+ for (i = 1; i < argc; i++)
+ {
++#if defined(FREEBSD_NATIVE) && defined(__i386__)
++ /* .. and command line args override all */
++ if (strcmp (argv[i], "-aout") == 0)
++ {
++ objformat_aout = 1;
++ continue;
++ }
++ else if (strcmp (argv[i], "-elf") == 0)
++ {
++ objformat_aout = 0;
++ continue;
++ }
++#endif
+ if (! strcmp (argv[i], "-dumpspecs"))
+ {
+ struct spec_list *sl;
+@@ -3049,6 +3100,23 @@
+ (such as cpp) rather than those of the host system. */
+ /* Use 2 as fourth arg meaning try just the machine as a suffix,
+ as well as trying the machine and the version. */
++#ifdef FREEBSD_NATIVE
++#if defined(__i386__)
++ if (objformat_aout) {
++ n_switches++; /* add implied -maout */
++ add_prefix (&exec_prefixes, "/usr/libexec/aout/", "BINUTILS",
++ 0, 0, NULL_PTR);
++ } else
++ add_prefix (&exec_prefixes, "/usr/libexec/elf/", "BINUTILS",
++ 0, 0, NULL_PTR);
++#endif
++ add_prefix (&exec_prefixes, "/usr/libexec", "GCC",
++ 0, 0, warn_std_ptr);
++ add_prefix (&exec_prefixes, "/usr/bin", "GCC",
++ 0, 0, warn_std_ptr);
++ add_prefix (&startfile_prefixes, "/usr/libdata/gcc/", "BINUTILS",
++ 0, 0, warn_std_ptr);
++#else /* not FREEBSD_NATIVE */
+ #ifndef OS2
+ add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
+ 0, 2, warn_std_ptr);
+@@ -3060,6 +3128,7 @@
+ 0, 1, warn_std_ptr);
+ add_prefix (&startfile_prefixes, standard_exec_prefix_1, "BINUTILS",
+ 0, 1, warn_std_ptr);
++#endif /* FREEBSD_NATIVE */
+
+ tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
+ dir_separator_str, NULL_PTR);
+@@ -3094,12 +3163,14 @@
+ dir_separator_str, tooldir_prefix, NULL_PTR);
+ }
+
++#ifndef FREEBSD_NATIVE
+ add_prefix (&exec_prefixes,
+ concat (tooldir_prefix, "bin", dir_separator_str, NULL_PTR),
+ "BINUTILS", 0, 0, NULL_PTR);
+ add_prefix (&startfile_prefixes,
+ concat (tooldir_prefix, "lib", dir_separator_str, NULL_PTR),
+ "BINUTILS", 0, 0, NULL_PTR);
++#endif /* FREEBSD_NATIVE */
+
+ /* More prefixes are enabled in main, after we read the specs file
+ and determine whether this is cross-compilation or not. */
+@@ -3118,6 +3189,19 @@
+ to the copy in the vector of switches.
+ Store all the infiles in their vector. */
+
++#if defined(FREEBSD_NATIVE) && defined(__i386__)
++ if (objformat_aout == 1) {
++ switches[n_switches].part1 = "maout";
++ switches[n_switches].args = 0;
++ switches[n_switches].live_cond = 0;
++ switches[n_switches].valid = 0;
++ n_switches++;
++ putenv("OBJFORMAT=aout");
++ } else {
++ putenv("OBJFORMAT=elf");
++ }
++#endif
++
+ for (i = 1; i < argc; i++)
+ {
+ /* Just skip the switches that were handled by the preceding loop. */
+@@ -3137,6 +3221,12 @@
+ ;
+ else if (! strcmp (argv[i], "-print-multi-directory"))
+ ;
++#if defined(FREEBSD_NATIVE) && defined(__i386__)
++ else if (! strcmp (argv[i], "-aout"))
++ ;
++ else if (! strcmp (argv[i], "-elf"))
++ ;
++#endif
+ else if (strcmp (argv[i], "-fhelp") == 0)
+ {
+ if (verbose_flag)
+@@ -4592,6 +4682,7 @@
+ *cp++ = '.';
+ *cp = '\0';
+
++#ifndef FREEBSD_NATIVE
+ /* Exclude directories that the linker is known to search. */
+ if (linker
+ && ((cp - path == 6
+@@ -4602,6 +4693,7 @@
+ dir_separator_str, "lib",
+ dir_separator_str, ".", NULL_PTR)) == 0)))
+ return 0;
++#endif /* FREEBSD_NATIVE */
+
+ return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
+ }
+@@ -4775,9 +4867,13 @@
+
+ /* Read specs from a file if there is one. */
+
++#ifndef FREEBSD_NATIVE
+ machine_suffix = concat (spec_machine, dir_separator_str,
+ spec_version, dir_separator_str, NULL_PTR);
+ just_machine_suffix = concat (spec_machine, dir_separator_str, NULL_PTR);
++#else /* FREEBSD_NATIVE */
++ just_machine_suffix = "";
++#endif /* FREEBSD_NATIVE */
+
+ specs_file = find_a_file (&startfile_prefixes, "specs", R_OK);
+ /* Read the specs file unless it is a default one. */
+@@ -4857,6 +4953,7 @@
+ NULL_PTR, 0, 0, NULL_PTR);
+ }
+
++#ifndef FREEBSD_NATIVE
+ add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
+ "BINUTILS", 0, 0, NULL_PTR);
+ add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
+@@ -4864,6 +4961,7 @@
+ #if 0 /* Can cause surprises, and one can use -B./ instead. */
+ add_prefix (&startfile_prefixes, "./", NULL_PTR, 0, 1, NULL_PTR);
+ #endif
++#endif /* FREEBSD_NATIVE */
+ }
+ else
+ {
+@@ -4947,7 +5045,7 @@
+
+ if (! verbose_flag)
+ {
+- printf ("\nReport bugs to egcs-bugs@egcs.cygnus.com.\n");
++ printf ("\nReport bugs to egcs-bugs@cygnus.com.\n");
+ printf ("Please see the file BUGS (included with the sources) first.\n");
+
+ exit (0);
+@@ -4981,7 +5079,7 @@
+ }
+
+ if (n_infiles == added_libraries)
+- fatal ("No input files");
++ fatal ("No input files specified");
+
+ /* Make a place to record the compiler output file names
+ that correspond to the input files. */
+@@ -5137,7 +5235,7 @@
+
+ if (print_help_list)
+ {
+- printf ("\nReport bugs to egcs-bugs@egcs.cygnus.com.\n");
++ printf ("\nReport bugs to egcs-bugs@cygnus.com.\n");
+ printf ("Please see the file BUGS (included with the sources) first.\n");
+ }
+
diff --git a/lang/egcs/files/patch-pexecute.c b/lang/egcs/files/patch-pexecute.c
new file mode 100644
index 000000000000..eb4080b7e3c2
--- /dev/null
+++ b/lang/egcs/files/patch-pexecute.c
@@ -0,0 +1,11 @@
+--- gcc/pexecute.c.orig 1999/08/26 09:28:02 1.1.1.1
++++ gcc/pexecute.c 1999/08/29 23:46:20 1.2
+@@ -739,7 +739,7 @@
+ #else
+ fprintf (stderr, ": %s\n", xstrerror (errno));
+ #endif
+- exit (-1);
++ _exit (1);
+ /* NOTREACHED */
+ return 0;
+
diff --git a/lang/egcs/files/patch-xm-freebsd.h b/lang/egcs/files/patch-xm-freebsd.h
new file mode 100644
index 000000000000..a04d032b0094
--- /dev/null
+++ b/lang/egcs/files/patch-xm-freebsd.h
@@ -0,0 +1,19 @@
+--- gcc/config/xm-freebsd.h.orig 1999/08/26 09:29:27 1.1.1.2
++++ gcc/config/xm-freebsd.h 1999/08/30 10:12:33 1.4
+@@ -22,3 +22,16 @@
+ running FreeBSD. This file should not be specified as $xm_file itself;
+ instead $xm_file should be CPU/xm-freebsd.h, which should include both
+ CPU/xm-CPU.h and this file xm-freebsd.h. */
++
++#ifndef HAVE_ATEXIT
++#define HAVE_ATEXIT
++#endif
++
++/* Tell gcc and collect2 that FreeBSD targets support putenv(3). */
++#define HAVE_PUTENV
++
++/* We have _sys_siglist, but the declaration in <signal.h> conflicts with
++ the declarations in collect2.c and mips-tfile.c, so disable the declarations
++ in those files. */
++
++#define SYS_SIGLIST_DECLARED