Patchwork [2/9] Specs cleanup: -A, -d and -m for linker

login
register
mail settings
Submitter Joseph S. Myers
Date Dec. 2, 2010, 4:33 p.m.
Message ID <Pine.LNX.4.64.1012021633380.26340@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/73990/
State New
Headers show

Comments

Joseph S. Myers - Dec. 2, 2010, 4:33 p.m.
LINK_COMMAND_SPEC (including modified copies for two targets) passes
-A, -d and -m to the linker and has further %{!A:...} specs.

This is not consistent with the semantics of -A (preprocessor assert),
-d (compiler dump) and -m (prefix to machine-specific compiler
options; if passed on its own, will get passed to cc1 then rejected by
cc1) in GCC.  Thus, this patch removes that specs handling; any such
options actually needing to be passed to the linker must be passed
using -Wl, or -Xlinker.

2010-12-02  Joseph Myers  <joseph@codesourcery.com>

	* gcc.c (LINK_COMMAND_SPEC): Don't handle -A, -d or -m.
	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
	* config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise.
Mike Stump - Dec. 2, 2010, 9:15 p.m.
On Dec 2, 2010, at 8:33 AM, Joseph S. Myers wrote:
> LINK_COMMAND_SPEC (including modified copies for two targets) passes
> -A, -d and -m to the linker and has further %{!A:...} specs.

> 2010-12-02  Joseph Myers  <joseph@codesourcery.com>
> 
> 	* gcc.c (LINK_COMMAND_SPEC): Don't handle -A, -d or -m.
> 	* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
> 	* config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise.

The darwin change is Ok, if the gcc.c change is approved (or considered obvious).
DJ Delorie - Dec. 3, 2010, 12:25 a.m.
> 	* config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise.

This is OK.
Richard Guenther - Dec. 3, 2010, 11:28 a.m.
On Thu, Dec 2, 2010 at 10:15 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Dec 2, 2010, at 8:33 AM, Joseph S. Myers wrote:
>> LINK_COMMAND_SPEC (including modified copies for two targets) passes
>> -A, -d and -m to the linker and has further %{!A:...} specs.
>
>> 2010-12-02  Joseph Myers  <joseph@codesourcery.com>
>>
>>       * gcc.c (LINK_COMMAND_SPEC): Don't handle -A, -d or -m.
>>       * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
>>       * config/i386/djgpp.h (LINK_COMMAND_SPEC): Likewise.
>
> The darwin change is Ok, if the gcc.c change is approved (or considered obvious).

The gcc.c change is ok.

Thanks,
Richard.

Patch

diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/darwin.h gcc-mainline/gcc/config/darwin.h
--- gcc-mainline-1/gcc/config/darwin.h	2010-11-30 03:36:38.000000000 -0800
+++ gcc-mainline/gcc/config/darwin.h	2010-12-01 16:46:05.000000000 -0800
@@ -172,17 +172,17 @@  extern GTY(()) int darwin_ms_struct;
     %(linker) \
     %{flto*:%<fcompare-debug*} \
     %{flto*} \
-    %l %X %{d} %{s} %{t} %{Z} %{u*} \
-    %{A} %{e*} %{m} %{r} \
+    %l %X %{s} %{t} %{Z} %{u*} \
+    %{e*} %{r} \
     %{o*}%{!o:-o a.out} \
-    %{!A:%{!nostdlib:%{!nostartfiles:%S}}} \
+    %{!nostdlib:%{!nostartfiles:%S}} \
     %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
     %{fopenmp|ftree-parallelize-loops=*: \
       %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \
     %{!nostdlib:%{!nodefaultlibs:\
       %(link_ssp) %(link_gcc_c_sequence)\
     }}\
-    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}"
+    %{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}"
 
 #define DSYMUTIL "\ndsymutil"
 
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/i386/djgpp.h gcc-mainline/gcc/config/i386/djgpp.h
--- gcc-mainline-1/gcc/config/i386/djgpp.h	2010-11-19 13:22:39.000000000 -0800
+++ gcc-mainline/gcc/config/i386/djgpp.h	2010-12-01 16:46:48.000000000 -0800
@@ -96,12 +96,12 @@  along with GCC; see the file COPYING3.  
 #undef LINK_COMMAND_SPEC
 #define LINK_COMMAND_SPEC \
 "%{!fsyntax-only: \
-%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
+%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{e*} %{N} %{n} \
 \t%{r} %{s} %{t} %{u*} %{z} %{Z}\
-\t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+\t%{!nostdlib:%{!nostartfiles:%S}}\
 \t%{static:} %{L*} %D %o\
 \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
-\t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
+\t%{!nostdlib:%{!nostartfiles:%E}}\
 \t-Tdjgpp.djl %{T*}}}}}}}\n\
 %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
 
diff -rupN --exclude=.svn gcc-mainline-1/gcc/gcc.c gcc-mainline/gcc/gcc.c
--- gcc-mainline-1/gcc/gcc.c	2010-11-30 03:36:38.000000000 -0800
+++ gcc-mainline/gcc/gcc.c	2010-12-01 16:45:23.000000000 -0800
@@ -641,14 +641,14 @@  proper position among the other output f
     } \
     %{flto*:%<fcompare-debug*} \
     %{flto*} %l " LINK_PIE_SPEC \
-   "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
-    %{s} %{t} %{u*} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+   "%X %{o*} %{e*} %{N} %{n} %{r}\
+    %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
     %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\
     %(mflib) " STACK_SPLIT_SPEC "\
     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
-    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+    %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
 #endif
 
 #ifndef LINK_LIBGCC_SPEC