diff options
Diffstat (limited to 'contrib/gcc')
-rw-r--r-- | contrib/gcc/FREEBSD-Xlist | 93 | ||||
-rw-r--r-- | contrib/gcc/FREEBSD-deletelist | 87 | ||||
-rw-r--r-- | contrib/gcc/FREEBSD-libiberty | 37 | ||||
-rw-r--r-- | contrib/gcc/FREEBSD-upgrade | 13 | ||||
-rw-r--r-- | contrib/gcc/c-decl.c | 2 | ||||
-rw-r--r-- | contrib/gcc/c-format.c | 57 | ||||
-rw-r--r-- | contrib/gcc/c-format.h | 3 | ||||
-rw-r--r-- | contrib/gcc/c-opts.c | 2 | ||||
-rw-r--r-- | contrib/gcc/c.opt | 1 | ||||
-rw-r--r-- | contrib/gcc/config/arm/freebsd.h | 77 | ||||
-rw-r--r-- | contrib/gcc/config/freebsd-spec.h | 91 | ||||
-rw-r--r-- | contrib/gcc/config/freebsd.h | 19 | ||||
-rw-r--r-- | contrib/gcc/config/i386/freebsd.h | 269 | ||||
-rw-r--r-- | contrib/gcc/config/i386/freebsd64.h | 13 | ||||
-rw-r--r-- | contrib/gcc/config/i386/i386.c | 3 | ||||
-rw-r--r-- | contrib/gcc/config/i386/i386.h | 10 | ||||
-rw-r--r-- | contrib/gcc/config/i386/x86-64.h | 2 | ||||
-rw-r--r-- | contrib/gcc/config/rs6000/freebsd.h | 5 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/freebsd.h | 22 | ||||
-rw-r--r-- | contrib/gcc/cp/ptree.c | 1 | ||||
-rw-r--r-- | contrib/gcc/function.c | 17 | ||||
-rw-r--r-- | contrib/gcc/gcc.c | 96 | ||||
-rw-r--r-- | contrib/gcc/opts.c | 9 | ||||
-rw-r--r-- | contrib/gcc/toplev.c | 2 | ||||
-rw-r--r-- | contrib/gcc/version.c | 3 |
25 files changed, 791 insertions, 143 deletions
diff --git a/contrib/gcc/FREEBSD-Xlist b/contrib/gcc/FREEBSD-Xlist new file mode 100644 index 0000000..96080bc --- /dev/null +++ b/contrib/gcc/FREEBSD-Xlist @@ -0,0 +1,93 @@ +# $FreeBSD$ +*.brik +*FAQ +*contrib +*etc +*faq.* +*/include +*/install* +*getopt* +*libchill +*libf2c +*libiberty +*libio +*libobjc +*libstdc++ +*lt* +*missing +*mkinstalldirs +*move-if-change +*symlink-tree +*texinfo +*ylwrap +*gcc/.cvsignore +*gcc/ABOUT*NLS +*gcc/*ChangeLog.* +*gcc/README.ACORN +*gcc/README.ALTOS +*gcc/README.APOLLO +*gcc/README.C4X +*gcc/README.FRESCO +*gcc/README.NS32K +*gcc/README.RS6000 +*gcc/README.X11 +*gcc/README.gnat +*gcc/*.bat +*gcc/*.com +*gcc/*.info* +*gcc/bi-parser.[ch] +*gcc/c-gperf.h +*gcc/c-parse.[chy] +*gcc/cexp.c +*gcc/cpp.aux +*gcc/cpp.cps +*gcc/cpp.fns +*gcc/gcc.aux +*gcc/gcc.cps +*gcc/gcc.hlp +*gcc/texinfo.tex +*gcc/.gdbinit +*gcc/install1.texi +*gcc/intl +*gcc/ch +*gcc/cp/hash.h +*gcc/cp/parse.[ch] +*gcc/config/1750a +*gcc/config/a29k +*gcc/config/arc +*gcc/config/arm +*gcc/config/c4x +*gcc/config/clipper +*gcc/config/convex +*gcc/config/dsp16xx +*gcc/config/elxsi +*gcc/config/fx80 +*gcc/config/gmicro +*gcc/config/h8300 +*gcc/config/i370 +*gcc/config/i860 +*gcc/config/i960 +*gcc/config/m32r +*gcc/config/m68k +*gcc/config/m88k +*gcc/config/mn10200 +*gcc/config/mn10300 +*gcc/config/msdos +*gcc/config/ns32k +*gcc/config/pa +*gcc/config/pdp11 +*gcc/config/pyr +*gcc/config/romp +*gcc/config/rs6000 +*gcc/config/sh +*gcc/config/spur +*gcc/config/tahoe +*gcc/config/v850 +*gcc/config/vax +*gcc/config/we32k +*gcc/config/winnt +*gcc/fixinc +*gcc/java +*gcc/objc/objc-parse.[cy] +*gcc/po +*gcc/testsuite diff --git a/contrib/gcc/FREEBSD-deletelist b/contrib/gcc/FREEBSD-deletelist new file mode 100644 index 0000000..f5bc817 --- /dev/null +++ b/contrib/gcc/FREEBSD-deletelist @@ -0,0 +1,87 @@ +$FreeBSD$ +CVS +.cvsignore +ABOUT*NLS +ChangeLog.lib +FSFChangeLog.* +README.ACORN +README.ALTOS +README.APOLLO +README.AVR +README.C4X +README.FRESCO +README.NS32K +README.RS6000 +README.X11 +README.gnat +*.bat +*.com +*.info* +bi-parser.[ch] +c-gperf.h +c-parse.[chy] +cexp.c +cpp.aux +cpp.cps +cpp.fns +gcc.aux +gcc.cps +gcc.hlp +getopt.[ch] +texinfo.tex +.gdbinit +install1.texi +intl +ch +cp/cfns.[chy] +cp/hash.h +cp/parse.[ch] +config/1750a +config/a29k +config/arc +config/arm +config/avr +config/c4x +config/clipper +config/convex +config/d30v +config/dsp16xx +config/elxsi +config/fr30 +config/fx80 +config/gmicro +config/h8300 +config/i370 +config/i860 +config/i960 +config/m32r +config/m68k +config/m88k +config/mcore +config/mips +config/mn10200 +config/mn10300 +config/msdos +config/ns32k +config/pa +config/pdp11 +config/pj +config/pyr +config/romp +config/rs6000 +config/sh +config/spur +config/tahoe +config/v850 +config/vax +config/we32k +config/winnt +fixinc +gccbug* +java +mkinstalldirs +objc/objc-parse.[cy] +gthr-win32* +po +testsuite +tradcif.c diff --git a/contrib/gcc/FREEBSD-libiberty b/contrib/gcc/FREEBSD-libiberty new file mode 100644 index 0000000..1b8c249 --- /dev/null +++ b/contrib/gcc/FREEBSD-libiberty @@ -0,0 +1,37 @@ +#! /bin/sh + +# $FreeBSD$ + +for F in \ + choose-temp.c \ + cp-demangle.c \ + cplus-dem.c \ + dyn-string.c \ + getopt.c \ + getopt1.c \ + getpwd.c \ + hashtab.c \ + lbasename.c \ + md5.c \ + obstack.c \ + partition.c \ + pexecute.c \ + splay-tree.c +do + cp -ip ../libiberty/$F . +done + +for F in \ + ansidecl.h \ + demangle.h \ + dyn-string.h \ + getopt.h \ + hashtab.h \ + libiberty.h \ + obstack.h \ + partition.h \ + splay-tree.h \ + symcat.h +do + cp -ip ../include/$F . +done diff --git a/contrib/gcc/FREEBSD-upgrade b/contrib/gcc/FREEBSD-upgrade new file mode 100644 index 0000000..922f8eb --- /dev/null +++ b/contrib/gcc/FREEBSD-upgrade @@ -0,0 +1,13 @@ +$FreeBSD$ + +tar -xvjf gcc-3.0.2.tar.bz2 -X FREEBSD-Xlist + +cd gcc-3.0.2/gcc +sh FREEBSD-libiberty + +cvs import src/contrib/gcc FSF gcc_3_0_2 + +If you decide to bring in more of the files, import them -- don't +use ``cvs add''. And please remember to adjust the contents of +"FREEBSD-Xlist" so that it reflects what is really imported from +the vendor. diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c index 00b372e..5c46615 100644 --- a/contrib/gcc/c-decl.c +++ b/contrib/gcc/c-decl.c @@ -19,6 +19,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + /* 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. */ diff --git a/contrib/gcc/c-format.c b/contrib/gcc/c-format.c index 403724e..cc3f9be 100644 --- a/contrib/gcc/c-format.c +++ b/contrib/gcc/c-format.c @@ -19,6 +19,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #include "config.h" #include "system.h" #include "coretypes.h" @@ -183,7 +185,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p) if (TREE_CODE (format_type_id) != IDENTIFIER_NODE) { gcc_assert (!validated_p); - error ("unrecognized format specifier"); + error ("%Junrecognized format specifier", lang_hooks.decls.getdecls ()); return false; } else @@ -513,6 +515,26 @@ static const format_char_info print_char_table[] = { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL } }; +static const format_char_info fbsd_ext_char_info = +{ NULL, 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "cR", NULL }; + +static const format_char_info fbsd_print_char_table[] = +{ + /* BSD conversion specifiers. */ + /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c). + The format %b is supported to decode error registers. + Its usage is: printf("reg=%b\n", regval, "<base><arg>*"); + which produces: reg=3<BITTWO,BITONE> + The format %D provides a hexdump given a pointer and separator string: + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX + ("%*D", len, ptr, " ") -> XX XX XX XX ... + */ + { "D", 1, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", &fbsd_ext_char_info }, + { "b", 0, STD_EXT, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", &fbsd_ext_char_info }, + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i", NULL }, + { NULL, 0, 0, NOLENGTHS, NULL, NULL } +}; + static const format_char_info asm_fprintf_char_table[] = { /* C89 conversion specifiers. */ @@ -759,6 +781,12 @@ static const format_kind_info format_types_orig[] = strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', NULL, NULL + }, + { "printf0", printf_length_specs, print_char_table, " +#0-'I", NULL, + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_NULL_FORMAT_OK, + 'w', 0, 'p', 0, 'L', + &integer_type_node, &integer_type_node } }; @@ -1283,6 +1311,15 @@ check_format_arg (void *ctx, tree format_tree, if (integer_zerop (format_tree)) { + /* FIXME: this warning should go away once Marc Espie's + __attribute__((nonnull)) patch is in. Instead, checking for + nonnull attributes should probably change this function to act + specially if info == NULL and add a res->number_null entry for + that case, or maybe add a function pointer to be called at + the end instead of hardcoding check_format_info_main. */ + if (!(format_types[info->format_type].flags & FMT_FLAG_NULL_FORMAT_OK)) + warning (OPT_Wformat, "null format string"); + /* Skip to first argument to check, so we can see if this format has any arguments (it shouldn't). */ while (arg_num + 1 < info->first_arg_num) @@ -1735,6 +1772,14 @@ check_format_info_main (format_check_results *res, { while (fli->name != 0 && fli->name[0] != *format_chars) fli++; + /* + * Make sure FreeBSD's D format char takes preference + * over new DD length specifier if FreeBSD format + * extensions are requested. + */ + if (fli->index == FMT_LEN_D && flag_format_extensions + && fki->conversion_specs == print_char_table) + while (fli->name != 0) fli++; if (fli->name != 0) { format_chars++; @@ -1818,6 +1863,14 @@ check_format_info_main (format_check_results *res, while (fci->format_chars != 0 && strchr (fci->format_chars, format_char) == 0) ++fci; + if (fci->format_chars == 0 && flag_format_extensions + && fki->conversion_specs == print_char_table) + { + fci = fbsd_print_char_table; + while (fci->format_chars != 0 + && strchr (fci->format_chars, format_char) == 0) + ++fci; + } if (fci->format_chars == 0) { if (ISGRAPH (format_char)) @@ -1935,7 +1988,7 @@ check_format_info_main (format_check_results *res, y2k_level = 2; if (y2k_level == 3) warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of " - "year in some locales", format_char); + "year in some locales on non-BSD systems", format_char); else if (y2k_level == 2) warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of " "year", format_char); diff --git a/contrib/gcc/c-format.h b/contrib/gcc/c-format.h index 5fa544d..dc11645 100644 --- a/contrib/gcc/c-format.h +++ b/contrib/gcc/c-format.h @@ -74,11 +74,12 @@ enum FMT_FLAG_EMPTY_PREC_OK = 64, /* Gaps are allowed in the arguments with $ operand numbers if all arguments are pointers (scanf). */ - FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128 + FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128, /* Not included here: details of whether width or precision may occur (controlled by width_char and precision_char); details of whether '*' can be used for these (width_type and precision_type); details of whether length modifiers can occur (length_char_specs). */ + FMT_FLAG_NULL_FORMAT_OK = 256 }; diff --git a/contrib/gcc/c-opts.c b/contrib/gcc/c-opts.c index ed04791..d27959f 100644 --- a/contrib/gcc/c-opts.c +++ b/contrib/gcc/c-opts.c @@ -20,6 +20,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #include "config.h" #include "system.h" #include "coretypes.h" diff --git a/contrib/gcc/c.opt b/contrib/gcc/c.opt index 01f47fc..8769657 100644 --- a/contrib/gcc/c.opt +++ b/contrib/gcc/c.opt @@ -20,6 +20,7 @@ ; See the GCC internals manual for a description of this file's format. +; $FreeBSD$ ; Please try to keep this file in ASCII collating order. Language diff --git a/contrib/gcc/config/arm/freebsd.h b/contrib/gcc/config/arm/freebsd.h index 6bae83d..7106e6f 100644 --- a/contrib/gcc/config/arm/freebsd.h +++ b/contrib/gcc/config/arm/freebsd.h @@ -19,13 +19,25 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ + { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \ + { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } -#undef SUBTARGET_CPP_SPEC -#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC +#undef SUBTARGET_EXTRA_ASM_SPEC +#define SUBTARGET_EXTRA_ASM_SPEC \ + "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}" + +/* Default to full FPA if -mhard-float is specified. */ +#undef SUBTARGET_ASM_FLOAT_SPEC +#define SUBTARGET_ASM_FLOAT_SPEC \ + "%{mhard-float:-mfpu=fpa} \ + %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}} \ + %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}" #undef LINK_SPEC #define LINK_SPEC " \ @@ -38,12 +50,28 @@ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - + %{symbolic:-Bsymbolic} \ + -X %{mbig-endian:-EB} %{mlittle-endian:-EL}" /************************[ Target stuff ]***********************************/ -/* Define the actual types of some ANSI-mandated types. +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)"); + +#ifndef TARGET_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT 0 +#endif + +/* Default it to use ATPCS with soft-VFP. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_APCS_FRAME \ + | TARGET_ENDIAN_DEFAULT) + +#undef ARM_DEFAULT_ABI +#define ARM_DEFAULT_ABI ARM_ABI_ATPCS + +/* Define the actual types of some ANSI-mandated types. Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, c-common.c, and config/<arch>/<arch>.h. */ @@ -58,11 +86,40 @@ /* We use the GCC defaults here. */ #undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - #undef SUBTARGET_CPU_DEFAULT #define SUBTARGET_CPU_DEFAULT TARGET_CPU_strongarm -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)"); +/* FreeBSD does its profiling differently to the Acorn compiler. We + don't need a word following the mcount call; and to skip it + requires either an assembly stub or use of fomit-frame-pointer when + compiling the profiling functions. Since we break Acorn CC + compatibility below a little more won't hurt. */ + +#undef ARM_FUNCTION_PROFILER +#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \ +{ \ + asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \ + asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \ + (TARGET_ARM && NEED_PLT_RELOC) \ + ? "(PLT)" : ""); \ +} + +/* Clear the instruction cache from `BEG' to `END'. This makes a + call to the ARM_SYNC_ICACHE architecture specific syscall. */ +#define CLEAR_INSN_CACHE(BEG, END) \ +do \ + { \ + extern int sysarch(int number, void *args); \ + struct \ + { \ + unsigned int addr; \ + int len; \ + } s; \ + s.addr = (unsigned int)(BEG); \ + s.len = (END) - (BEG); \ + (void) sysarch (0, &s); \ + } \ +while (0) + +#undef FPUTYPE_DEFAULT +#define FPUTYPE_DEFAULT FPUTYPE_VFP diff --git a/contrib/gcc/config/freebsd-spec.h b/contrib/gcc/config/freebsd-spec.h index b3f18e2..e7995e8 100644 --- a/contrib/gcc/config/freebsd-spec.h +++ b/contrib/gcc/config/freebsd-spec.h @@ -18,6 +18,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + /* Common FreeBSD configuration. All FreeBSD architectures should include this file, which will specify their commonalities. @@ -57,6 +59,7 @@ Boston, MA 02110-1301, USA. */ builtin_assert ("system=unix"); \ builtin_assert ("system=bsd"); \ builtin_assert ("system=FreeBSD"); \ + FBSD_NATIVE_TARGET_OS_CPP_BUILTINS(); \ FBSD_TARGET_CPU_CPP_BUILTINS(); \ } \ while (0) @@ -64,34 +67,54 @@ Boston, MA 02110-1301, USA. */ /* Define the default FreeBSD-specific per-CPU hook code. */ #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0) -/* Provide a CPP_SPEC appropriate for FreeBSD. We just deal with the GCC - option `-posix', and PIC issues. */ +#ifdef FREEBSD_NATIVE +#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_with_int_value ("__FreeBSD_cc_version", FBSD_CC_VER); \ + } while (0) +#else +#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS() \ + do {} while (0) +#endif + +/* Provide a CPP_SPEC appropriate for FreeBSD. We just deal with the GCC + option `-posix', and PIC issues. Try to detect support for the + `long long' type. Unfortunately the GCC spec parser will not allow us + to properly detect the "iso9899:1990" and "iso9899:199409" forms of + -std=c89. Because of the ':' in the -std argument. :-( I have left + them in the spec as a place holder in hopes someone knows a way to make + the detection of them work. */ #define FBSD_CPP_SPEC " \ %(cpp_cpu) \ %(cpp_arch) \ + %{!ansi:%{!std=c89:%{!std=iso9899.1990:%{!std=iso9899.199409:-D_LONGLONG}}}} \ %{posix:-D_POSIX_SOURCE}" -/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add - the magical crtbegin.o file (see crtstuff.c) which provides part - of the support for getting C++ file-scope static object constructed - before entering `main'. */ - -#define FBSD_STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on - the magical crtend.o file (see crtstuff.c) which provides part of - the support for getting C++ file-scope static object constructed - before entering `main', followed by a normal "finalizer" file, - `crtn.o'. */ - -#define FBSD_ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" +/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add the magical + crtbegin.o file (see crtstuff.c) which provides part of the support for + getting C++ file-scope static object constructed before entering `main'. */ + +#define FBSD_STARTFILE_SPEC "\ + %{!shared: \ + %{pg:gcrt1.o%s} \ + %{!pg: \ + %{p:gcrt1.o%s} \ + %{!p: \ + %{profile:gcrt1.o%s} \ + %{!profile:crt1.o%s}}}} \ + crti.o%s \ + %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}" + +/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. Here we tack on + our own magical crtend.o file (see crtstuff.c) which provides part of + the support for getting C++ file-scope static object constructed before + entering `main', followed by the normal "finalizer" file, `crtn.o'. */ + +#define FBSD_ENDFILE_SPEC "\ + %{!shared:crtend.o%s} \ + %{shared:crtendS.o%s} \ + crtn.o%s " /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as required by the user-land thread model. Before __FreeBSD_version @@ -120,7 +143,8 @@ is built with the --enable-threads configure-time option.} \ %{pg: -lc_p} \ }" #else -#if FBSD_MAJOR < 5 +#include <sys/param.h> +#if __FreeBSD_version < 500016 #define FBSD_LIB_SPEC " \ %{!shared: \ %{!pg: \ @@ -130,17 +154,34 @@ is built with the --enable-threads configure-time option.} \ %{!pthread:-lc_p} \ %{pthread:-lc_r_p}} \ }" -#else +#elif __FreeBSD_version < 700022 #define FBSD_LIB_SPEC " \ %{!shared: \ %{!pg: %{pthread:-lpthread} -lc} \ %{pg: %{pthread:-lpthread_p} -lc_p} \ }" +#else +#define FBSD_LIB_SPEC " \ + %{!shared: \ + %{!pg: %{pthread:-lpthread} -lc} \ + %{pg: %{pthread:-lpthread_p} -lc_p}} \ + %{shared: \ + %{pthread:-lpthread} -lc} \ + " #endif #endif -#if FBSD_MAJOR < 6 +#if FBSD_MAJOR < 5 #define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1" #else #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1" #endif + +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif + +/* Use --as-needed -lgcc_s for eh support. */ +#ifdef HAVE_LD_AS_NEEDED +#define USE_LD_AS_NEEDED 1 +#endif diff --git a/contrib/gcc/config/freebsd.h b/contrib/gcc/config/freebsd.h index 21dc81e..9a5eef5 100644 --- a/contrib/gcc/config/freebsd.h +++ b/contrib/gcc/config/freebsd.h @@ -1,5 +1,5 @@ /* Base configuration file for all FreeBSD targets. - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GCC. @@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */ Further work by David O'Brien <obrien@FreeBSD.org> and Loren J. Rittle <ljrittle@acm.org>. */ +/* $FreeBSD$ */ /* In case we need to know. */ #define USING_CONFIG_FREEBSD 1 @@ -61,7 +62,7 @@ Boston, MA 02110-1301, USA. */ /* All FreeBSD Architectures support the ELF object file format. */ #undef OBJECT_FORMAT_ELF -#define OBJECT_FORMAT_ELF +#define OBJECT_FORMAT_ELF 1 /* Don't assume anything about the header files. */ #undef NO_IMPLICIT_EXTERN_C @@ -72,16 +73,24 @@ Boston, MA 02110-1301, USA. */ #undef WCHAR_TYPE #define WCHAR_TYPE "int" +#ifdef FREEBSD_NATIVE +#define LIBSTDCXX_PROFILE "-lstdc++_p" +#endif #define MATH_LIBRARY_PROFILE "-lm_p" /* Code generation parameters. */ +/* Writing `int' for a bitfield forces int alignment for the structure. */ +/* XXX: ok for Alpha?? */ +#undef PCC_BITFIELD_TYPE_MATTERS +#define PCC_BITFIELD_TYPE_MATTERS 1 + /* Use periods rather than dollar signs in special g++ assembler names. This ensures the configuration knows our system correctly so we can link with libraries compiled with the native cc. */ #undef NO_DOLLAR_IN_LABEL -/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW. - This enables the test coverage code to use file locking when exiting a - program, which avoids race conditions if the program has forked. */ +/* Define this so we can compile MS code for use with WINE. */ +#define HANDLE_PRAGMA_PACK_PUSH_POP + #define TARGET_POSIX_IO diff --git a/contrib/gcc/config/i386/freebsd.h b/contrib/gcc/config/i386/freebsd.h index deb9212..b23455c 100644 --- a/contrib/gcc/config/i386/freebsd.h +++ b/contrib/gcc/config/i386/freebsd.h @@ -22,110 +22,74 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ -#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); +#undef CC1_SPEC +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" -/* Override the default comment-starter of "/". */ -#undef ASM_COMMENT_START -#define ASM_COMMENT_START "#" +/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support + for the special GCC options -static and -shared, which allow us to + link things in one of these three modes by applying the appropriate + combinations of options at link-time. We like to support here for + as many of the other GNU linker options as possible. But I don't + have the time to search for those flags. I am sure how to add + support for -soname shared_object_name. H.J. -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" + When the -shared link option is used a final link is not being + done. */ -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" +#undef LINK_SPEC +#define LINK_SPEC "\ + %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ + %{v:-V} \ + %{assert*} %{R*} %{rpath*} %{defsym*} \ + %{shared:-Bshareable %{h*} %{soname*}} \ + %{!shared: \ + %{!static: \ + %{rdynamic: -export-dynamic} \ + %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ + %{static:-Bstatic}} \ + %{symbolic:-Bsymbolic}" -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ - (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) +/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h + but trashed by config/<cpu>/<file.h>. */ -#undef NO_PROFILE_COUNTERS -#define NO_PROFILE_COUNTERS 1 +#undef STARTFILE_SPEC +#define STARTFILE_SPEC FBSD_STARTFILE_SPEC -/* Tell final.c that we don't need a label passed to mcount. */ +/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ -#undef MCOUNT_NAME -#define MCOUNT_NAME ".mcount" +#undef ENDFILE_SPEC +#define ENDFILE_SPEC FBSD_ENDFILE_SPEC + + +/************************[ Target stuff ]***********************************/ -/* Make gcc agree with <machine/ansi.h>. */ +/* Define the actual types of some ANSI-mandated types. + Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, + c-common.c, and config/<arch>/<arch>.h. */ #undef SIZE_TYPE #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") - + #undef PTRDIFF_TYPE #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") - + #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) -#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ +#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ #define SUBTARGET_EXTRA_SPECS \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } - -/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add - the magical crtbegin.o file (see crtstuff.c) which provides part - of the support for getting C++ file-scope static object constructed - before entering `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ - %{!p:%{profile:gcrt1.o%s} \ - %{!profile:crt1.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on - the magical crtend.o file (see crtstuff.c) which provides part of - the support for getting C++ file-scope static object constructed - before entering `main', followed by a normal "finalizer" file, - `crtn.o'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC \ - "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support - for the special GCC options -static and -shared, which allow us to - link things in one of these three modes by applying the appropriate - combinations of options at link-time. We like to support here for - as many of the other GNU linker options as possible. But I don't - have the time to search for those flags. I am sure how to add - support for -soname shared_object_name. H.J. - I took out %{v:%{!V:-V}}. It is too much :-(. They can use - -Wl,-V. +#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); - When the -shared link option is used a final link is not being - done. */ +#define TARGET_ELF 1 -#undef LINK_SPEC -#define LINK_SPEC "\ - %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ - %{v:-V} \ - %{assert*} %{R*} %{rpath*} %{defsym*} \ - %{shared:-Bshareable %{h*} %{soname*}} \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ - %{static:-Bstatic}} \ - %{symbolic:-Bsymbolic}" - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1<<LOG - bytes if it is within MAX_SKIP bytes. - - This is used to align code labels according to Intel recommendations. */ - -#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN -#undef ASM_OUTPUT_MAX_SKIP_ALIGN -#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ - if ((LOG) != 0) { \ - if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ - else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ - } -#endif +/* This goes away when the math emulator is fixed. */ +#undef TARGET_SUBTARGET_DEFAULT +#define TARGET_SUBTARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) /* Don't default to pcc-struct-return, we want to retain compatibility with older gcc versions AND pcc-struct-return is nonreentrant. @@ -139,3 +103,144 @@ Boston, MA 02110-1301, USA. */ compiler get the contents of <float.h> and std::numeric_limits correct. */ #undef TARGET_96_ROUND_53_LONG_DOUBLE #define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) + +/* Tell final.c that we don't need a label passed to mcount. */ +#define NO_PROFILE_COUNTERS 1 + +/* Output assembler code to FILE to begin profiling of the current function. + LABELNO is an optional label. */ + +#undef MCOUNT_NAME +#define MCOUNT_NAME ".mcount" + +/* Output assembler code to FILE to end profiling of the current function. */ + +#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */ + + +/************************[ Assembler stuff ]********************************/ + +/* Override the default comment-starter of "/" from unix.h. */ +#undef ASM_COMMENT_START +#define ASM_COMMENT_START "#" + +/* Override the default comment-starter of "/APP" from unix.h. */ +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +/* XXX:DEO do we still need this override to defaults.h ?? */ +/* This is how to output a reference to a user-level label named NAME. */ +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(FILE, NAME) \ + do { \ + const char *xname = (NAME); \ + /* Hack to avoid writing lots of rtl in \ + FUNCTION_PROFILER_EPILOGUE (). */ \ + if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0) \ + { \ + if (flag_pic) \ + fprintf ((FILE), "*%s@GOT(%%ebx)", xname); \ + else \ + fprintf ((FILE), "%s", xname); \ + } \ + else \ + { \ + if (xname[0] == '%') \ + xname += 2; \ + if (xname[0] == '*') \ + xname += 1; \ + else \ + fputs (user_label_prefix, FILE); \ + fputs (xname, FILE); \ + } \ +} while (0) + +/* This is how to hack on the symbol code of certain relcalcitrant + symbols to modify their output in output_pic_addr_const (). */ + +#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */ + +/* A C statement to output to the stdio stream FILE an assembler + command to advance the location counter to a multiple of 1<<LOG + bytes if it is within MAX_SKIP bytes. + + This is used to align code labels according to Intel recommendations. */ + +/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE, + but it is easier to fix in an MD way. */ + +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#undef ASM_OUTPUT_MAX_SKIP_ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ + do { \ + if ((LOG) != 0) { \ + if ((MAX_SKIP) == 0) \ + fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else \ + fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } \ + } while (0) +#endif + +/* If defined, a C expression whose value is a string containing the + assembler operation to identify the following data as + uninitialized global data. If not defined, and neither + `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, + uninitialized global data will be output in the data section if + `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be + used. */ +#undef BSS_SECTION_ASM_OP +#define BSS_SECTION_ASM_OP "\t.section\t.bss" + +/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a + separate, explicit argument. If you define this macro, it is used + in place of `ASM_OUTPUT_BSS', and gives you more flexibility in + handling the required alignment of the variable. The alignment is + specified as the number of bits. + + Try to use function `asm_output_aligned_bss' defined in file + `varasm.c' when defining this macro. */ +#undef ASM_OUTPUT_ALIGNED_BSS +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) + +/************************[ Debugger stuff ]*********************************/ + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \ + : (write_symbols == DWARF2_DEBUG) \ + ? svr4_dbx_register_map[(n)] \ + : dbx_register_map[(n)]) + +/* The same functions are used to creating the DWARF2 debug info and C++ + unwind info (except.c). Regardless of the debug format requested, the + register numbers used in exception unwinding sections still have to be + DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER + macro to mean too much. */ +#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \ + : svr4_dbx_register_map[(n)]) + +/* stabs-in-elf has offsets relative to function beginning */ +#undef DBX_OUTPUT_LBRAC +#define DBX_OUTPUT_LBRAC(FILE, NAME) \ + do { \ + fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ + assemble_name (asm_out_file, NAME); \ + fputc ('-', asm_out_file); \ + assemble_name (asm_out_file, \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ + fprintf (asm_out_file, "\n"); \ + } while (0) + +#undef DBX_OUTPUT_RBRAC +#define DBX_OUTPUT_RBRAC(FILE, NAME) \ + do { \ + fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ + assemble_name (asm_out_file, NAME); \ + fputc ('-', asm_out_file); \ + assemble_name (asm_out_file, \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ + fprintf (asm_out_file, "\n"); \ + } while (0) diff --git a/contrib/gcc/config/i386/freebsd64.h b/contrib/gcc/config/i386/freebsd64.h index 257bdd9..0c41602 100644 --- a/contrib/gcc/config/i386/freebsd64.h +++ b/contrib/gcc/config/i386/freebsd64.h @@ -19,10 +19,23 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (FreeBSD/x86-64 ELF)"); +#undef FBSD_TARGET_CPU_CPP_BUILTINS +#define FBSD_TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + if (TARGET_64BIT) \ + { \ + builtin_define ("__LP64__"); \ + } \ + } \ + while (0) + #define SUBTARGET_EXTRA_SPECS \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } diff --git a/contrib/gcc/config/i386/i386.c b/contrib/gcc/config/i386/i386.c index 729dd40..feab422 100644 --- a/contrib/gcc/config/i386/i386.c +++ b/contrib/gcc/config/i386/i386.c @@ -19,6 +19,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #include "config.h" #include "system.h" #include "coretypes.h" @@ -13957,6 +13959,7 @@ ix86_constant_alignment (tree exp, int align) return 128; } else if (!optimize_size && TREE_CODE (exp) == STRING_CST + && !TARGET_NO_ALIGN_LONG_STRINGS && TREE_STRING_LENGTH (exp) >= 31 && align < BITS_PER_WORD) return BITS_PER_WORD; diff --git a/contrib/gcc/config/i386/i386.h b/contrib/gcc/config/i386/i386.h index 1adb1a5..5f1b58f 100644 --- a/contrib/gcc/config/i386/i386.h +++ b/contrib/gcc/config/i386/i386.h @@ -387,8 +387,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); else if (TARGET_ATHLON) \ { \ builtin_define ("__tune_athlon__"); \ - /* Only plain "athlon" lacks SSE. */ \ - if (last_tune_char != 'n') \ + /* Plain "athlon" & "athlon-tbird" lacks SSE. */ \ + if (last_tune_char != 'n' && last_tune_char != 'd') \ builtin_define ("__tune_athlon_sse__"); \ } \ else if (TARGET_K8) \ @@ -451,8 +451,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); { \ builtin_define ("__athlon"); \ builtin_define ("__athlon__"); \ - /* Only plain "athlon" lacks SSE. */ \ - if (last_arch_char != 'n') \ + /* Plain "athlon" & "athlon-tbird" lacks SSE. */ \ + if (last_tune_char != 'n' && last_tune_char != 'd') \ builtin_define ("__athlon_sse__"); \ } \ else if (ix86_arch == PROCESSOR_K8) \ @@ -536,7 +536,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define SHORT_TYPE_SIZE 16 #define INT_TYPE_SIZE 32 #define FLOAT_TYPE_SIZE 32 +#ifndef LONG_TYPE_SIZE #define LONG_TYPE_SIZE BITS_PER_WORD +#endif #define DOUBLE_TYPE_SIZE 64 #define LONG_LONG_TYPE_SIZE 64 diff --git a/contrib/gcc/config/i386/x86-64.h b/contrib/gcc/config/i386/x86-64.h index cb92a21..f288208 100644 --- a/contrib/gcc/config/i386/x86-64.h +++ b/contrib/gcc/config/i386/x86-64.h @@ -19,6 +19,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #undef ASM_COMMENT_START #define ASM_COMMENT_START "#" diff --git a/contrib/gcc/config/rs6000/freebsd.h b/contrib/gcc/config/rs6000/freebsd.h index edd267d..1fb4b25 100644 --- a/contrib/gcc/config/rs6000/freebsd.h +++ b/contrib/gcc/config/rs6000/freebsd.h @@ -24,6 +24,11 @@ #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_freebsd)" +#undef CPP_OS_FREEBSD_SPEC +#define CPP_OS_FREEBSD_SPEC "\ + -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \ + -Acpu=powerpc -Amachine=powerpc " + #undef STARTFILE_DEFAULT_SPEC #define STARTFILE_DEFAULT_SPEC "%(startfile_freebsd)" diff --git a/contrib/gcc/config/sparc/freebsd.h b/contrib/gcc/config/sparc/freebsd.h index 9e432a3..bb93ea1 100644 --- a/contrib/gcc/config/sparc/freebsd.h +++ b/contrib/gcc/config/sparc/freebsd.h @@ -19,16 +19,28 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } /* FreeBSD needs the platform name (sparc64) defined. - Emacs needs to know if the arch is 64 or 32-bits. */ - -#undef CPP_CPU64_DEFAULT_SPEC -#define CPP_CPU64_DEFAULT_SPEC \ - "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" + Emacs needs to know if the arch is 64 or 32-bits. + This also selects which targets are available via -mcpu. */ + +#undef FBSD_TARGET_CPU_CPP_BUILTINS +#define FBSD_TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__LP64__"); \ + builtin_define ("__sparc64__"); \ + builtin_define ("__sparc_v9__"); \ + builtin_define ("__sparcv9"); \ + builtin_define ("__sparc__"); \ + builtin_define ("__arch64__"); \ + } \ + while (0) #define LINK_SPEC "%(link_arch) \ %{!mno-relax:%{!r:-relax}} \ diff --git a/contrib/gcc/cp/ptree.c b/contrib/gcc/cp/ptree.c index 246e88b..1de4d2c 100644 --- a/contrib/gcc/cp/ptree.c +++ b/contrib/gcc/cp/ptree.c @@ -20,6 +20,7 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ #include "config.h" #include "system.h" diff --git a/contrib/gcc/function.c b/contrib/gcc/function.c index ca88e0b..7549ec4 100644 --- a/contrib/gcc/function.c +++ b/contrib/gcc/function.c @@ -20,6 +20,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + /* This file handles the generation of rtl code from tree structure at the level of the function as a whole. It creates the rtl expressions for parameters and auto variables @@ -4373,6 +4375,21 @@ expand_function_end (void) /* Output the label for the actual return from the function. */ emit_label (return_label); +#ifdef TARGET_PROFILER_EPILOGUE + if (current_function_profile && TARGET_PROFILER_EPILOGUE) + { + static rtx mexitcount_libfunc; + static int initialized; + + if (!initialized) + { + mexitcount_libfunc = init_one_libfunc (".mexitcount"); + initialized = 0; + } + emit_library_call (mexitcount_libfunc, LCT_NORMAL, VOIDmode, 0); + } +#endif + if (USING_SJLJ_EXCEPTIONS) { /* Let except.c know where it should emit the call to unregister diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c index 0b5ee4b..ddf2f49 100644 --- a/contrib/gcc/gcc.c +++ b/contrib/gcc/gcc.c @@ -23,6 +23,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA This paragraph is here to try to keep Sun CC from dying. The number of chars here seems crucial!!!! */ +/* $FreeBSD$ */ + /* 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 @@ -697,6 +699,7 @@ proper position among the other output files. */ scripts which exist in user specified directories, or in standard directories. */ #ifndef LINK_COMMAND_SPEC +#ifndef FREEBSD_NATIVE #define LINK_COMMAND_SPEC "\ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ @@ -706,6 +709,17 @@ proper position among the other output files. */ %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" +#else +#define LINK_COMMAND_SPEC "\ +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ + %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ + %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ + %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ + %{fopenmp: -lgomp} %(mflib)\ + %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\ + %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ + %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" +#endif #endif #ifndef LINK_LIBGCC_SPEC @@ -1488,7 +1502,9 @@ static const char *const standard_startfile_prefix_2 static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX; static const char *tooldir_prefix; +#ifndef FREEBSD_NATIVE static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX; +#endif /* not FREEBSD_NATIVE */ static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX; @@ -1619,7 +1635,8 @@ init_gcc_specs (struct obstack *obstack, const char *shared_name, { char *buf; - buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}" + buf = concat ("%{pg:", static_name, " ", eh_name, "} %{!pg:", + "%{static|static-libgcc|pg:", static_name, " ", eh_name, "}" "%{!static:%{!static-libgcc:" #if USE_LD_AS_NEEDED "%{!shared-libgcc:", @@ -1642,7 +1659,7 @@ init_gcc_specs (struct obstack *obstack, const char *shared_name, "%{shared:", shared_name, "}" #endif #endif - "}}", NULL); + "}}}", NULL); obstack_grow (obstack, buf, strlen (buf)); free (buf); @@ -1735,8 +1752,13 @@ init_spec (void) " -lunwind" #endif , +#ifdef FREEBSD_NATIVE + LIBGCC_STATIC_LIB_SPEC, + LIBGCC_EH_STATIC_LIB_SPEC +#else "-lgcc", "-lgcc_eh" +#endif #ifdef USE_LIBUNWIND_EXCEPTIONS # ifdef HAVE_LD_STATIC_DYNAMIC " %{!static:-Bstatic} -lunwind %{!static:-Bdynamic}" @@ -3361,6 +3383,7 @@ process_command (int argc, const char **argv) see if we can create it from the pathname specified in argv[0]. */ gcc_libexec_prefix = standard_libexec_prefix; +#ifndef FREEBSD_NATIVE #ifndef VMS /* FIXME: make_relative_prefix doesn't yet work for VMS. */ if (!gcc_exec_prefix) @@ -3387,6 +3410,7 @@ process_command (int argc, const char **argv) } #else #endif +#endif /* not FREEBSD_NATIVE */ if (gcc_exec_prefix) { @@ -3512,6 +3536,44 @@ process_command (int argc, const char **argv) } } + /* Options specified as if they appeared on the command line. */ + temp = getenv ("GCC_OPTIONS"); + if ((temp) && (strlen (temp) > 0)) + { + int len; + int optc = 1; + int new_argc; + const char **new_argv; + char *envopts; + + while (isspace (*temp)) + temp++; + len = strlen (temp); + envopts = (char *) xmalloc (len + 1); + strcpy (envopts, temp); + + for (i = 0; i < (len - 1); i++) + if ((isspace (envopts[i])) && ! (isspace (envopts[i+1]))) + optc++; + + new_argv = (const char **) alloca ((optc + argc) * sizeof(char *)); + + for (i = 0, new_argc = 1; new_argc <= optc; new_argc++) + { + while (isspace (envopts[i])) + i++; + new_argv[new_argc] = envopts + i; + while (!isspace (envopts[i]) && (envopts[i] != '\0')) + i++; + envopts[i++] = '\0'; + } + for (i = 1; i < argc; i++) + new_argv[new_argc++] = argv[i]; + + argv = new_argv; + argc = new_argc; + } + /* Convert new-style -- options to old-style. */ translate_options (&argc, (const char *const **) &argv); @@ -3937,6 +3999,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" } /* Set up the search paths before we go looking for config files. */ +#ifdef FREEBSD_NATIVE + add_prefix (&exec_prefixes, PREFIX"/bin/", "BINUTILS", + PREFIX_PRIORITY_LAST, 0, 0); +#endif /* FREEBSD_NATIVE */ /* These come before the md prefixes so that we will find gcc's subcommands (such as cpp) rather than those of the host system. */ @@ -3947,6 +4013,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" PREFIX_PRIORITY_LAST, 1, 0); add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 2, 0); +#ifndef FREEBSD_NATIVE add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 2, 0); add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", @@ -3954,7 +4021,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 2, 0); #endif +#endif +#ifndef FREEBSD_NATIVE add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 1, 0); add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", @@ -4017,6 +4086,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" } } #endif +#endif /* FREEBSD_NATIVE */ /* More prefixes are enabled in main, after we read the specs file and determine whether this is cross-compilation or not. */ @@ -6003,6 +6073,7 @@ is_directory (const char *path1, bool linker) *cp++ = '.'; *cp = '\0'; +#ifndef FREEBSD_NATIVE /* Exclude directories that the linker is known to search. */ if (linker && IS_DIR_SEPARATOR (path[0]) @@ -6013,6 +6084,7 @@ is_directory (const char *path1, bool linker) && IS_DIR_SEPARATOR (path[4]) && strncmp (path + 5, "lib", 3) == 0))) return 0; +#endif /* FREEBSD_NATIVE */ return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode)); } @@ -6201,9 +6273,14 @@ main (int argc, char **argv) /* Read specs from a file if there is one. */ +#ifdef FREEBSD_NATIVE + machine_suffix = ""; + just_machine_suffix = ""; +#else /* FREEBSD_NATIVE */ machine_suffix = concat (spec_machine, dir_separator_str, spec_version, dir_separator_str, NULL); just_machine_suffix = concat (spec_machine, dir_separator_str, NULL); +#endif /* FREEBSD_NATIVE */ specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true); /* Read the specs file unless it is a default one. */ @@ -6214,10 +6291,11 @@ main (int argc, char **argv) /* We need to check standard_exec_prefix/just_machine_suffix/specs for any override of as, ld and libraries. */ - specs_file = alloca (strlen (standard_exec_prefix) - + strlen (just_machine_suffix) + sizeof ("specs")); + specs_file = (char *) alloca (strlen (FBSD_DATA_PREFIX) + + strlen (just_machine_suffix) + + sizeof ("specs")); - strcpy (specs_file, standard_exec_prefix); + strcpy (specs_file, FBSD_DATA_PREFIX); strcat (specs_file, just_machine_suffix); strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) @@ -6326,6 +6404,7 @@ main (int argc, char **argv) NULL, PREFIX_PRIORITY_LAST, 0, 1); } +#ifndef FREEBSD_NATIVE if (*standard_startfile_prefix_1) add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1, "BINUTILS", @@ -6334,6 +6413,7 @@ main (int argc, char **argv) add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1); +#endif } /* Process any user specified specs in the order given on the command @@ -6369,7 +6449,11 @@ main (int argc, char **argv) if (print_search_dirs) { +#ifndef FREEBSD_NATIVE printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix); +#else + printf (_("install: %s\n"), standard_exec_prefix); +#endif printf (_("programs: %s\n"), build_search_list (&exec_prefixes, "", false, false)); printf (_("libraries: %s\n"), @@ -6482,7 +6566,7 @@ main (int argc, char **argv) } 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. */ diff --git a/contrib/gcc/opts.c b/contrib/gcc/opts.c index 3c2abad..3de5627 100644 --- a/contrib/gcc/opts.c +++ b/contrib/gcc/opts.c @@ -20,6 +20,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + #include "config.h" #include "system.h" #include "intl.h" @@ -499,7 +501,10 @@ decode_options (unsigned int argc, const char **argv) flag_reorder_functions = 1; flag_tree_store_ccp = 1; flag_tree_store_copy_prop = 1; - flag_tree_vrp = 1; + /* XXX: some issues with ports have been traced to -ftree-vrp. + So remove it from -O2 and above. Note that jdk1{5,6} are affected + and they build with w/-O3 - so we cannot just move it to -O3. */ + // flag_tree_vrp = 1; if (!optimize_size) { @@ -515,7 +520,7 @@ decode_options (unsigned int argc, const char **argv) flag_gcse_after_reload = 1; } - if (optimize < 2 || optimize_size) + if (optimize_size) { align_loops = 1; align_jumps = 1; diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c index 53fcdfe..49458c8 100644 --- a/contrib/gcc/toplev.c +++ b/contrib/gcc/toplev.c @@ -20,6 +20,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* $FreeBSD$ */ + /* This is the top level of cc1/c++. It parses command args, opens files, invokes the various passes in the proper order, and counts the time used by each. diff --git a/contrib/gcc/version.c b/contrib/gcc/version.c index c839cbd..0da50b1 100644 --- a/contrib/gcc/version.c +++ b/contrib/gcc/version.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ #include "version.h" /* This is the trailing component of the string reported as the @@ -8,7 +9,7 @@ in parentheses. You may also wish to include a number indicating the revision of your modified compiler. */ -#define VERSUFFIX "" +#define VERSUFFIX " [FreeBSD]" /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, |