diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-06 20:51:28 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-06 20:51:28 +0000 |
commit | 0c7879926ab27274a2f6437841907c30be1ba769 (patch) | |
tree | 126d2a145b4faeac130fc25530eea4daca1beda3 /gcc/gcc.c | |
parent | a94a5a60a3ff161982199f57fd85224d7f75c188 (diff) | |
download | gcc-0c7879926ab27274a2f6437841907c30be1ba769.tar.gz |
* gcc.c: Add linker spec.
(link_command_spec): Use %(linker) instead of ld.
(main): If collect2 is requested as the linker, see if it exists;
if not, use ld instead.
* Makefile.in (USE_COLLECT2): It's named collect2 now, not ld.
(ld:) Deleted.
(install-collect2): Install as collect2, not ld.
* configure.in(will_use_collect2): It's named collect2 now.
* collect2: Remove checks to see if we were invoked recursively.
(collect_execute): Use _spawnvp under cygwin32.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19022 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c index 37d5ebc6cad..ff4cf956b9c 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -477,6 +477,10 @@ proper position among the other output files. */ #endif #endif +#ifndef LINKER_NAME +#define LINKER_NAME "collect2" +#endif + static char *cpp_spec = CPP_SPEC; static char *cpp_predefines = CPP_PREDEFINES; static char *cc1_spec = CC1_SPEC; @@ -490,6 +494,7 @@ static char *libgcc_spec = LIBGCC_SPEC; static char *endfile_spec = ENDFILE_SPEC; static char *startfile_spec = STARTFILE_SPEC; static char *switches_need_spaces = SWITCHES_NEED_SPACES; +static char *linker_name_spec = LINKER_NAME; /* Some compilers have limits on line lengths, and the multilib_select and/or multilib_matches strings can be very long, so we build them at @@ -708,7 +713,7 @@ static int n_default_compilers /* Don't generate -L options. */ static char *link_command_spec = "\ %{!fsyntax-only: \ - %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ + %{!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*} %o\ @@ -720,7 +725,7 @@ static char *link_command_spec = "\ /* Use -L. */ static char *link_command_spec = "\ %{!fsyntax-only: \ - %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ + %{!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*} %D %o\ @@ -1093,6 +1098,7 @@ static struct spec_list static_specs[] = { INIT_STATIC_SPEC ("multilib_defaults", &multilib_defaults), INIT_STATIC_SPEC ("multilib_extra", &multilib_extra), INIT_STATIC_SPEC ("multilib_matches", &multilib_matches), + INIT_STATIC_SPEC ("linker", &linker_name_spec), }; #ifdef EXTRA_SPECS /* additional specs needed */ @@ -2130,6 +2136,7 @@ execute () commands[0].prog = argbuf[0]; /* first command. */ commands[0].argv = &argbuf[0]; string = find_a_file (&exec_prefixes, commands[0].prog, X_OK); + if (string) commands[0].argv[0] = string; @@ -4797,6 +4804,13 @@ main (argc, argv) { int tmp = execution_count; + /* We'll use ld if we can't find collect2. */ + if (! strcmp (linker_name_spec, "collect2")) + { + char *s = find_a_file (&exec_prefixes, "collect2", X_OK); + if (s == NULL) + linker_name_spec = "ld"; + } /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables for collect. */ putenv_from_prefixes (&exec_prefixes, "COMPILER_PATH="); |