diff options
author | obrien <obrien@FreeBSD.org> | 2002-05-09 22:02:01 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-05-09 22:02:01 +0000 |
commit | 286b84aa7ca611f416175079e94963c6f3a87079 (patch) | |
tree | 6016d4292e062305e752890476b9b26ca93fdfa9 /contrib | |
parent | a1f2ac3f1b2864b22e44072fdfde0954b3778688 (diff) | |
download | FreeBSD-src-286b84aa7ca611f416175079e94963c6f3a87079.zip FreeBSD-src-286b84aa7ca611f416175079e94963c6f3a87079.tar.gz |
Merge revs 1.{2,15} (FREEBSD_NATIVE); 1.{5,13} (ELF, and objformat support);
1.{16,23,25} (better cross building control); 1.21 ("GCC_OPTIONS")
into the GCC 3.1 prerelease.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/gcc.c | 109 |
1 files changed, 47 insertions, 62 deletions
diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c index e78cf2f..589f3a6 100644 --- a/contrib/gcc/gcc.c +++ b/contrib/gcc/gcc.c @@ -447,7 +447,6 @@ or with constant text in a single argument. if multilib_dir is not set or is ".", output "". %S process STARTFILE_SPEC as a spec. A capital S is actually used here. %E process ENDFILE_SPEC as a spec. A capital E is actually used here. - %c process SIGNED_CHAR_SPEC as a spec. %C process CPP_SPEC as a spec. %1 process CC1_SPEC as a spec. %2 process CC1PLUS_SPEC as a spec. @@ -513,7 +512,7 @@ CC also knows implicitly that arguments starting in `-l' are to be treated as compiler output files, and passed to the linker in their proper position among the other output files. */ -/* Define the macros used for specs %a, %l, %L, %S, %c, %C, %1. */ +/* Define the macros used for specs %a, %l, %L, %S, %C, %1. */ /* config.h can define ASM_SPEC to provide extra args to the assembler or extra switch-translations. */ @@ -584,17 +583,6 @@ proper position among the other output files. */ #define ENDFILE_SPEC "" #endif -/* This spec is used for telling cpp whether char is signed or not. */ -#ifndef SIGNED_CHAR_SPEC -/* Use #if rather than ?: - because MIPS C compiler rejects like ?: in initializers. */ -#if DEFAULT_SIGNED_CHAR -#define SIGNED_CHAR_SPEC "%{funsigned-char:-D__CHAR_UNSIGNED__}" -#else -#define SIGNED_CHAR_SPEC "%{!fsigned-char:-D__CHAR_UNSIGNED__}" -#endif -#endif - #ifndef LINKER_NAME #define LINKER_NAME "collect2" #endif @@ -623,6 +611,13 @@ proper position among the other output files. */ /* Here is the spec for running the linker, after compiling all files. */ +/* This is overridable by the target in case they need to specify the + -lgcc and -lc order specially, yet not require them to override all + of LINK_COMMAND_SPEC. */ +#ifndef LINK_GCC_C_SEQUENCE_SPEC +#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G" +#endif + /* -u* was put back because both BSD and SysV seem to support it. */ /* %{static:} simply prevents an error message if the target machine doesn't handle -static. */ @@ -634,7 +629,7 @@ proper position among the other output files. */ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t}\ %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ - %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}}\ + %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\ %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" #endif @@ -653,7 +648,7 @@ static const char *cpp_spec = CPP_SPEC; static const char *cpp_predefines = CPP_PREDEFINES; static const char *cc1_spec = CC1_SPEC; static const char *cc1plus_spec = CC1PLUS_SPEC; -static const char *signed_char_spec = SIGNED_CHAR_SPEC; +static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; static const char *asm_spec = ASM_SPEC; static const char *asm_final_spec = ASM_FINAL_SPEC; static const char *link_spec = LINK_SPEC; @@ -678,24 +673,26 @@ static const char *trad_capable_cpp = static const char *cpp_unique_options = "%{C:%{!E:%eGNU C does not support -C without using -E}}\ %{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I\ - %{MD:-M -MF %W{!o: %b.d}%W{o*:%.d%*}}\ - %{MMD:-MM -MF %W{!o: %b.d}%W{o*:%.d%*}}\ - %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{M|MD|MM|MMD:%{o*:-MQ %*}}\ + %{MD:-MD %W{!o: %b.d}%W{o*:%.d%*}}\ + %{MMD:-MMD %W{!o: %b.d}%W{o*:%.d%*}}\ + %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*}\ + %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\ %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\ - %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\ %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\ %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\ %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap}\ %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\ - %{E:%{!M*:%W{o*}}}"; + %{E|M|MM:%W{o*}}"; /* This contains cpp options which are common with cc1_options and are passed only when preprocessing only to avoid duplication. */ static const char *cpp_options = "%(cpp_unique_options) %{std*} %{d*} %{W*} %{w} %{pedantic*}\ %{fshow-column} %{fno-show-column}\ + %{fsigned-char&funsigned-char}\ %{fleading-underscore} %{fno-leading-underscore}\ %{fno-operator-names} %{ftabstop=*}"; @@ -828,7 +825,6 @@ static const struct compiler default_compilers[] = {".F", "#Fortran", 0}, {".FOR", "#Fortran", 0}, {".FPP", "#Fortran", 0}, {".r", "#Ratfor", 0}, {".p", "#Pascal", 0}, {".pas", "#Pascal", 0}, - {".ch", "#Chill", 0}, {".chi", "#Chill", 0}, {".java", "#Java", 0}, {".class", "#Java", 0}, {".zip", "#Java", 0}, {".jar", "#Java", 0}, /* Next come the entries for C. */ @@ -838,15 +834,15 @@ static const struct compiler default_compilers[] = external preprocessor if -save-temps or -traditional is given. */ "%{E|M|MM:%(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)}\ %{!E:%{!M:%{!MM:\ - %{save-temps:%(trad_capable_cpp) -lang-c %{ansi:-std=c89}\ - %(cpp_options) %b.i \n\ - cc1 -fpreprocessed %b.i %(cc1_options)}\ - %{!save-temps:\ + %{save-temps|no-integrated-cpp:%(trad_capable_cpp) -lang-c %{ansi:-std=c89}\ + %(cpp_options) %{save-temps:%b.i} %{!save-temps:%g.i} \n\ + cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} %(cc1_options)}\ + %{!save-temps:%{!no-integrated-cpp:\ %{traditional|ftraditional|traditional-cpp:\ tradcpp0 -lang-c %{ansi:-std=c89} %(cpp_options) %{!pipe:%g.i} |\n\ cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\ %{!traditional:%{!ftraditional:%{!traditional-cpp:\ - cc1 -lang-c %{ansi:-std=c89} %(cpp_unique_options) %(cc1_options)}}}}\ + cc1 -lang-c %{ansi:-std=c89} %(cpp_unique_options) %(cc1_options)}}}}}\ %{!fsyntax-only:%(invoke_as)}}}}", 0}, {"-", "%{!E:%e-E required when input is from standard input}\ @@ -921,7 +917,8 @@ static const struct option_map option_map[] = {"--assemble", "-S", 0}, {"--assert", "-A", "a"}, {"--classpath", "-fclasspath=", "aj"}, - {"--CLASSPATH", "-fCLASSPATH=", "aj"}, + {"--bootclasspath", "-fbootclasspath=", "aj"}, + {"--CLASSPATH", "-fclasspath=", "aj"}, {"--comments", "-C", 0}, {"--compile", "-c", 0}, {"--debug", "-g", "oj"}, @@ -947,6 +944,7 @@ static const struct option_map option_map[] = {"--library-directory", "-L", "a"}, {"--machine", "-m", "aj"}, {"--machine-", "-m", "*j"}, + {"--no-integrated-cpp", "-no-integrated-cpp", 0}, {"--no-line-commands", "-P", 0}, {"--no-precompiled-includes", "-noprecomp", 0}, {"--no-standard-includes", "-nostdinc", 0}, @@ -971,6 +969,7 @@ static const struct option_map option_map[] = {"--profile", "-p", 0}, {"--profile-blocks", "-a", 0}, {"--quiet", "-q", 0}, + {"--resource", "-fcompile-resource=", "aj"}, {"--save-temps", "-save-temps", 0}, {"--shared", "-shared", 0}, {"--silent", "-q", 0}, @@ -1378,13 +1377,13 @@ static struct spec_list static_specs[] = INIT_STATIC_SPEC ("cc1", &cc1_spec), INIT_STATIC_SPEC ("cc1_options", &cc1_options), INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec), + INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec), INIT_STATIC_SPEC ("endfile", &endfile_spec), INIT_STATIC_SPEC ("link", &link_spec), INIT_STATIC_SPEC ("lib", &lib_spec), INIT_STATIC_SPEC ("libgcc", &libgcc_spec), INIT_STATIC_SPEC ("startfile", &startfile_spec), INIT_STATIC_SPEC ("switches_need_spaces", &switches_need_spaces), - INIT_STATIC_SPEC ("signed_char", &signed_char_spec), INIT_STATIC_SPEC ("predefines", &cpp_predefines), INIT_STATIC_SPEC ("cross_compile", &cross_compile), INIT_STATIC_SPEC ("version", &compiler_version), @@ -1428,31 +1427,23 @@ init_gcc_specs (obstack, shared_name, static_name, eh_name) const char *static_name; const char *eh_name; { - char buffer[128]; - const char *p; + char *buf; - /* If we see -shared-libgcc, then use the shared version. */ - sprintf (buffer, "%%{shared-libgcc:%s %s}", shared_name, static_name); - obstack_grow (obstack, buffer, strlen (buffer)); - /* If we see -static-libgcc, then use the static version. */ - sprintf (buffer, "%%{static-libgcc:%s %s}", static_name, eh_name); - obstack_grow (obstack, buffer, strlen (buffer)); - /* Otherwise, if we see -shared, then use the shared version - if using EH registration routines or static version without - exception handling routines otherwise. */ - p = "%{!shared-libgcc:%{!static-libgcc:%{shared:"; - obstack_grow (obstack, p, strlen (p)); + buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, + "}%{!static:%{!static-libgcc:", + "%{!shared:%{!shared-libgcc:", static_name, " ", + eh_name, "}%{shared-libgcc:", shared_name, " ", + static_name, "}}%{shared:", #ifdef LINK_EH_SPEC - sprintf (buffer, "%s}}}", static_name); + "%{shared-libgcc:", shared_name, + "}%{!shared-libgcc:", static_name, "}", #else - sprintf (buffer, "%s}}}", shared_name); + shared_name, #endif - obstack_grow (obstack, buffer, strlen (buffer)); - /* Otherwise, use the static version. */ - sprintf (buffer, - "%%{!shared-libgcc:%%{!static-libgcc:%%{!shared:%s %s}}}", - static_name, eh_name); - obstack_grow (obstack, buffer, strlen (buffer)); + "}}}", NULL); + + obstack_grow (obstack, buf, strlen (buf)); + free (buf); } #endif /* ENABLE_SHARED_LIBGCC */ @@ -1787,7 +1778,7 @@ load_specs (filename) A suffix which starts with `*' is a definition for one of the machine-specific sub-specs. The "suffix" should be - *asm, *cc1, *cpp, *link, *startfile, *signed_char, etc. + *asm, *cc1, *cpp, *link, *startfile, etc. The corresponding spec is stored in asm_spec, etc., rather than in the `compilers' vector. @@ -3837,11 +3828,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" case OBJFMT_AOUT: n_switches++; /* add implied -maout */ add_prefix (&exec_prefixes, PREFIX"/libexec/aout/", "BINUTILS", - 0, 0, NULL_PTR); + 0, 0, warn_std_ptr); break; case OBJFMT_ELF: add_prefix (&exec_prefixes, PREFIX"/libexec/elf/", "BINUTILS", - 0, 0, NULL_PTR); + 0, 0, warn_std_ptr); break; case OBJFMT_UNKNOWN: fatal ("object format unknown"); @@ -4888,12 +4879,6 @@ do_spec_1 (spec, inswitch, soft_matched_part) return value; break; - case 'c': - value = do_spec_1 (signed_char_spec, 0, NULL); - if (value != 0) - return value; - break; - case 'C': { const char *const spec @@ -6069,7 +6054,7 @@ main (argc, argv) "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); #ifdef CROSS_STARTFILE_PREFIX add_prefix (&startfile_prefixes, CROSS_STARTFILE_PREFIX, "BINUTILS", - 0, 0, NULL_PTR); + PREFIX_PRIORITY_LAST, 0, NULL); #endif } @@ -6519,7 +6504,7 @@ validate_all_switches () { p = comp->spec; while ((c = *p++)) - if (c == '%' && *p == '{') + if (c == '%' && (*p == '{' || (*p == 'W' && *++p == '{'))) /* We have a switch spec. */ validate_switches (p + 1); } @@ -6529,14 +6514,14 @@ validate_all_switches () { p = *(spec->ptr_spec); while ((c = *p++)) - if (c == '%' && *p == '{') + if (c == '%' && (*p == '{' || (*p == 'W' && *++p == '{'))) /* We have a switch spec. */ validate_switches (p + 1); } p = link_command_spec; while ((c = *p++)) - if (c == '%' && *p == '{') + if (c == '%' && (*p == '{' || (*p == 'W' && *++p == '{'))) /* We have a switch spec. */ validate_switches (p + 1); } |