Patchwork [Ian,Lance,Taylor] PATCH RFC: Simplify ASM_SPEC in config/i386

mail settings
Submitter Ian Taylor
Date Dec. 1, 2010, 12:36 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/73690/
State New
Headers show


Ian Taylor - Dec. 1, 2010, 12:36 a.m.
There were no comments on this patch.  I have committed it to mainline.

The various instances of ASM_SPEC in config/i386 have evidently been
copied from one another, and were originally copied from the ASM_SPEC
now in config/sol2.h.  That ASM_SPEC has these specs:

%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*}

None of these make sense when using the GNU assembler.  The GNU
assembler handles -V like -v anyhow.  The -Qy and -Qn options are
no-ops.  The -n option means to not emit nop instructions for alignment
within code sections; this differs from the Solaris assembler -n option,
which means to suppress warnings.  The -T and -Y options are errors for
the GNU assembler.

Also, the spec


appears in many copies ASM_SPEC in config/i386, but is useless because
this is handled by the gcc driver anyhow.

This patch attempts to clean this up in config/i386.  The immediate
motivator for this cleanup is that currently

gcc -o x x.c -T x.ld

fails, because the -T option is passed to the assembler.  It should only
be passed to the linker.  This is a bug, which I think makes this patch
acceptable during stage 3.

I've bootstrapped this on x86_64-unknown-linux-gnu and I've run the i386
specific tests.  I don't require approval for this change but I would
appreciate if the x86 maintainers could take a look to make sure that I
didn't make any mistakes.  Thanks.


2010-11-22  Ian Lance Taylor  <>

	* config/i386/linux.h (ASM_SPEC): Pass -v as -v, not -V.  Remove
	all of %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}.
	* config/i386/linux64.h (ASM_SPEC): Likewise.
	* config/i386/mingw-w64.h (ASM_SPEC): Likewise.
	* config/i386/sol2-10.h (ASM_SPEC) [USE_GAS]: Likewise.
	* config/i386/vxworks.h (ASM_SPEC): Likewise.
	* config/i386/x86-64.h (ASM_SPEC): Likewise.
	* config/i386/sol2.h (ASM_SPEC): Remove %{Wa,*:%*}.
	* config/i386/sol2-10.h (ASM_SPEC) [!USE_GAS]: Likewise.


Index: config/i386/linux.h
--- config/i386/linux.h	(revision 167038)
+++ config/i386/linux.h	(working copy)
@@ -104,8 +104,7 @@  along with GCC; see the file COPYING3.  
 #undef  ASM_SPEC
 #define ASM_SPEC \
-  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} --32 \
-  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
+  "%{v} --32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
Index: config/i386/mingw-w64.h
--- config/i386/mingw-w64.h	(revision 167038)
+++ config/i386/mingw-w64.h	(working copy)
@@ -36,8 +36,7 @@  along with GCC; see the file COPYING3.  
 /* Enable multilib.  */
 #undef ASM_SPEC
-#define ASM_SPEC "%{v:-v} %{n} %{T} %{Ym,*} %{Yd,*} \
- %{Wa,*:%*} %{m32:--32} %{m64:--64}"
+#define ASM_SPEC "%{v} %{m32:--32} %{m64:--64}"
 #undef SPEC_32
 #undef SPEC_64
Index: config/i386/sol2.h
--- config/i386/sol2.h	(revision 167038)
+++ config/i386/sol2.h	(working copy)
@@ -54,10 +54,7 @@  along with GCC; see the file COPYING3.  
 /* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler
    gives many warnings: R_386_32 relocation is used for symbol ".text".  */
 #undef ASM_SPEC
-#define ASM_SPEC "\
-%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
-%(asm_cpu) \
+#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} -s %(asm_cpu)"
 #define ASM_CPU_SPEC ""
Index: config/i386/x86-64.h
--- config/i386/x86-64.h	(revision 167038)
+++ config/i386/x86-64.h	(working copy)
@@ -52,8 +52,7 @@  see the files COPYING3 and COPYING.RUNTI
 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
 #undef ASM_SPEC
-#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
- %{Wa,*:%*} %{m32:--32} %{m64:--64}"
+#define ASM_SPEC "%{v} %{m32:--32} %{m64:--64}"
Index: config/i386/sol2-10.h
--- config/i386/sol2-10.h	(revision 167038)
+++ config/i386/sol2-10.h	(working copy)
@@ -26,11 +26,10 @@  along with GCC; see the file COPYING3.  
    assembler requires -xarch=generic or -xarch=generic64 instead.  */
 #undef ASM_SPEC
 #ifdef USE_GAS
-#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
-		 "%{Wa,*:%*} %{m32:--32} %{m64:--64} -s %(asm_cpu)"
+#define ASM_SPEC "%{v} %{m32:--32} %{m64:--64} -s %(asm_cpu)"
 #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
-		 "%{Wa,*:%*} %{m32:-xarch=generic} %{m64:-xarch=generic64} " \
+		 "%{m32:-xarch=generic} %{m64:-xarch=generic64} " \
 		 "-s %(asm_cpu)"
Index: config/i386/linux64.h
--- config/i386/linux64.h	(revision 167038)
+++ config/i386/linux64.h	(working copy)
@@ -71,8 +71,7 @@  see the files COPYING3 and COPYING.RUNTI
 #undef ASM_SPEC
-#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
- %{Wa,*:%*} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64} \
+#define ASM_SPEC "%{v} %{" SPEC_32 ":--32} %{" SPEC_64 ":--64} \
  %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
 #undef	LINK_SPEC
Index: config/i386/vxworks.h
--- config/i386/vxworks.h	(revision 167038)
+++ config/i386/vxworks.h	(working copy)
@@ -22,7 +22,7 @@  along with GCC; see the file COPYING3.  
 #define TARGET_VERSION fprintf (stderr, " (80586, VxWorks syntax)");
 #undef  ASM_SPEC
-#define ASM_SPEC "%{v:-v} %{Qy:} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
+#define ASM_SPEC "%{v}"
   do							\