Commit bbd7687d by David S. Miller Committed by David S. Miller

gcc.c (LINK_GCC_C_SEQUENCE_SPEC): New spec to override the gcc/c library…

gcc.c (LINK_GCC_C_SEQUENCE_SPEC): New spec to override the gcc/c library sequence passed to the linker.

2002-04-03  David S. Miller  <davem@redhat.com>

	* gcc.c (LINK_GCC_C_SEQUENCE_SPEC): New spec to override the gcc/c
	library sequence passed to the linker.
	(LINK_COMMAND_SPEC): Use it.
	* doc/tm.texi: Document it, and mention from LINK_COMMAND_SPEC as
	a macro a target can use to avoid overriding LINK_COMMAND_SPEC.
	* config/sparc/sparc.h (LINK_GCC_C_SEQUENCE_SPEC): Define.

From-SVN: r51834
parent eb81f6ff
2002-04-03 David S. Miller <davem@redhat.com>
* gcc.c (LINK_GCC_C_SEQUENCE_SPEC): New spec to override the gcc/c
library sequence passed to the linker.
(LINK_COMMAND_SPEC): Use it.
* doc/tm.texi: Document it, and mention from LINK_COMMAND_SPEC as
a macro a target can use to avoid overriding LINK_COMMAND_SPEC.
* config/sparc/sparc.h (LINK_GCC_C_SEQUENCE_SPEC): Define.
2002-04-03 Jason Merrill <jason@redhat.com> 2002-04-03 Jason Merrill <jason@redhat.com>
* except.c (struct eh_status): Remove protect_list. * except.c (struct eh_status): Remove protect_list.
......
...@@ -358,6 +358,11 @@ Unrecognized value in TARGET_CPU_DEFAULT. ...@@ -358,6 +358,11 @@ Unrecognized value in TARGET_CPU_DEFAULT.
SUBTARGET_EXTRA_SPECS SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS
/* Because libgcc can generate references back to libc (via .umul etc.) we have
to list libc again after the second libgcc. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G %L"
#ifdef SPARC_BI_ARCH #ifdef SPARC_BI_ARCH
#define NO_BUILTIN_PTRDIFF_TYPE #define NO_BUILTIN_PTRDIFF_TYPE
......
...@@ -377,6 +377,11 @@ the argument @option{-lgcc} to tell the linker to do the search. ...@@ -377,6 +377,11 @@ the argument @option{-lgcc} to tell the linker to do the search.
This macro is similar to @code{LINK_LIBGCC_SPECIAL}, except that it does This macro is similar to @code{LINK_LIBGCC_SPECIAL}, except that it does
not affect @option{-L} options. not affect @option{-L} options.
@findex LINK_GCC_C_SEQUENCE_SPEC
@item LINK_GCC_C_SEQUENCE_SPEC
The sequence in which libgcc and libc are specified to the linker.
By default this is @code{%G %L %G}.
@findex LINK_COMMAND_SPEC @findex LINK_COMMAND_SPEC
@item LINK_COMMAND_SPEC @item LINK_COMMAND_SPEC
A C string constant giving the complete command line need to execute the A C string constant giving the complete command line need to execute the
...@@ -384,7 +389,8 @@ linker. When you do this, you will need to update your port each time a ...@@ -384,7 +389,8 @@ linker. When you do this, you will need to update your port each time a
change is made to the link command line within @file{gcc.c}. Therefore, change is made to the link command line within @file{gcc.c}. Therefore,
define this macro only if you need to completely redefine the command define this macro only if you need to completely redefine the command
line for invoking the linker and there is no other way to accomplish line for invoking the linker and there is no other way to accomplish
the effect you need. the effect you need. Overriding this macro may be avoidable by overriding
@code{LINK_GCC_C_SEQUENCE_SPEC} instead.
@findex LINK_ELIMINATE_DUPLICATE_LDIRECTORIES @findex LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
@item LINK_ELIMINATE_DUPLICATE_LDIRECTORIES @item LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
......
...@@ -448,6 +448,7 @@ or with constant text in a single argument. ...@@ -448,6 +448,7 @@ or with constant text in a single argument.
%C process CPP_SPEC as a spec. %C process CPP_SPEC as a spec.
%1 process CC1_SPEC as a spec. %1 process CC1_SPEC as a spec.
%2 process CC1PLUS_SPEC as a spec. %2 process CC1PLUS_SPEC as a spec.
%3 process LINK_GCC_C_SEQUENCE_SPEC as a spec.
%| output "-" if the input for the current command is coming from a pipe. %| output "-" if the input for the current command is coming from a pipe.
%* substitute the variable part of a matched option. (See below.) %* substitute the variable part of a matched option. (See below.)
Note that each comma in the substituted string is replaced by Note that each comma in the substituted string is replaced by
...@@ -609,6 +610,13 @@ proper position among the other output files. */ ...@@ -609,6 +610,13 @@ proper position among the other output files. */
/* Here is the spec for running the linker, after compiling all 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. */ /* -u* was put back because both BSD and SysV seem to support it. */
/* %{static:} simply prevents an error message if the target machine /* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */ doesn't handle -static. */
...@@ -620,7 +628,7 @@ proper position among the other output files. */ ...@@ -620,7 +628,7 @@ proper position among the other output files. */
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t}\ %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t}\
%{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{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:%3}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}" %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif #endif
...@@ -639,6 +647,7 @@ static const char *cpp_spec = CPP_SPEC; ...@@ -639,6 +647,7 @@ static const char *cpp_spec = CPP_SPEC;
static const char *cpp_predefines = CPP_PREDEFINES; static const char *cpp_predefines = CPP_PREDEFINES;
static const char *cc1_spec = CC1_SPEC; static const char *cc1_spec = CC1_SPEC;
static const char *cc1plus_spec = CC1PLUS_SPEC; static const char *cc1plus_spec = CC1PLUS_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_spec = ASM_SPEC;
static const char *asm_final_spec = ASM_FINAL_SPEC; static const char *asm_final_spec = ASM_FINAL_SPEC;
static const char *link_spec = LINK_SPEC; static const char *link_spec = LINK_SPEC;
...@@ -1364,6 +1373,7 @@ static struct spec_list static_specs[] = ...@@ -1364,6 +1373,7 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("cc1", &cc1_spec), INIT_STATIC_SPEC ("cc1", &cc1_spec),
INIT_STATIC_SPEC ("cc1_options", &cc1_options), INIT_STATIC_SPEC ("cc1_options", &cc1_options),
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec), 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 ("endfile", &endfile_spec),
INIT_STATIC_SPEC ("link", &link_spec), INIT_STATIC_SPEC ("link", &link_spec),
INIT_STATIC_SPEC ("lib", &lib_spec), INIT_STATIC_SPEC ("lib", &lib_spec),
...@@ -4749,6 +4759,12 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -4749,6 +4759,12 @@ do_spec_1 (spec, inswitch, soft_matched_part)
return value; return value;
break; break;
case '3':
value = do_spec_1 (link_gcc_c_sequence_spec, 0, NULL);
if (value != 0)
return value;
break;
case 'a': case 'a':
value = do_spec_1 (asm_spec, 0, NULL); value = do_spec_1 (asm_spec, 0, NULL);
if (value != 0) if (value != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment