This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Fix Solaris/SPARC bootstrap without gas


Eric Botcazou writes:
 > > It seems that Linux targets auto-enable the gas variable. Since gas is
 > > already detected and handled for Solaris/SPARC, and Linux/SPARC apparently
 > > always has it, would be it sufficient to just add a
 > >
 > > /* We use GNU as so define this to make comdat work.  */
 > > #define HAVE_GNU_AS 1
 > >
 > > to gcc/config/sparc/linux{64,}.h, just above their
 > >
 > > /* We use GNU ld ...  */
 > >
 > > sections?
 > 
 > No, that isn't the proper way to do it, HAVE_GNU_AS must simply be forgotten.
 > Instead a config/sparc/gas.h file must be added and conditionally included.

Is this closer to what you had in mind?  I called the new file elf-gas.h since
there might be non-ELF systems using gas (not that I know of any).

gcc/

2010-02-03  Mikael Pettersson  <mikpe@it.uu.se>

	* config/sparc/elf-gas.h: New file.  Define
	SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION.
	* config/sparc/sysv4.h (TARGET_ASM_NAMED_SECTION): Check
	SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION not HAVE_GNU_AS.
	* config/sparc/sparc.c (sparc_elf_asm_named_section):
	Likwise.
	* config.gcc (sparc*-*-linux*): Include sparc/elf-gas.h
	before sparc/sysv4.h.
	* config.gcc (sparc*-*-solaris2*): Likewise, if using gas.

--- gcc-4.4-20100202/gcc/config.gcc.~1~	2010-01-29 16:49:15.000000000 +0100
+++ gcc-4.4-20100202/gcc/config.gcc	2010-02-03 14:05:34.000000000 +0100
@@ -2191,7 +2191,7 @@ sparc-*-elf*)
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
 	;;
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/elf-gas.h sparc/sysv4.h linux.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
 	tmake_file="${tmake_file} sparc/t-linux"
 	if test x$enable_targets = xall; then
@@ -2208,7 +2208,11 @@ sparc-*-rtems*)
 	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
 	;;
 sparc64-*-solaris2* | sparcv9-*-solaris2*)
-	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h"
+	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h"
+	if test x$gas = xyes; then
+		tm_file="${tm_file} sparc/elf-gas.h"
+	fi
+	tm_file="${tm_file} sparc/sysv4.h sol2.h"
 	case ${target} in
 	*-*-solaris2.1[0-9]*)
 		tm_file="${tm_file} sol2-10.h"
@@ -2239,7 +2243,11 @@ sparc64-*-solaris2* | sparcv9-*-solaris2
 	esac
 	;;
 sparc-*-solaris2*)
-	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sol2.h"
+	tm_file="${tm_file} dbxelf.h elfos.h svr4.h"
+	if test x$gas = xyes; then
+		tm_file="${tm_file} sparc/elf-gas.h"
+	fi
+	tm_file="${tm_file} sparc/sysv4.h sol2.h"
 	case ${target} in
 	*-*-solaris2.1[0-9]*)
 		tm_file="${tm_file} sol2-10.h"
@@ -2303,7 +2311,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
 	esac
 	;;
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
-	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h sparc/linux64.h"
+	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h svr4.h sparc/elf-gas.h sparc/sysv4.h linux.h sparc/linux64.h"
 	extra_options="${extra_options} sparc/long-double-switch.opt"
 	tmake_file="${tmake_file} sparc/t-linux sparc/t-linux64 sparc/t-crtfm"
 	;;
--- gcc-4.4-20100202/gcc/config/sparc/elf-gas.h.~1~	2010-02-03 13:54:09.000000000 +0100
+++ gcc-4.4-20100202/gcc/config/sparc/elf-gas.h	2010-02-03 13:58:56.000000000 +0100
@@ -0,0 +1,3 @@
+/* Definitions for SPARC using ELF and GNU as.  */
+
+#define SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION
--- gcc-4.4-20100202/gcc/config/sparc/sparc.c.~1~	2010-02-03 13:47:27.000000000 +0100
+++ gcc-4.4-20100202/gcc/config/sparc/sparc.c	2010-02-03 13:57:44.000000000 +0100
@@ -371,7 +371,7 @@ static int save_or_restore_regs (int, in
 static void emit_save_or_restore_regs (int);
 static void sparc_asm_function_prologue (FILE *, HOST_WIDE_INT);
 static void sparc_asm_function_epilogue (FILE *, HOST_WIDE_INT);
-#if defined (OBJECT_FORMAT_ELF) && !HAVE_GNU_AS
+#if defined (OBJECT_FORMAT_ELF) && !defined (SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION)
 static void sparc_elf_asm_named_section (const char *, unsigned int, tree);
 #endif
 
@@ -7847,7 +7847,7 @@ sparc_profile_hook (int labelno)
     }
 }
 
-#if defined (OBJECT_FORMAT_ELF) && !HAVE_GNU_AS
+#if defined (OBJECT_FORMAT_ELF) && !defined (SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION)
 static void
 sparc_elf_asm_named_section (const char *name, unsigned int flags,
 			     tree decl)
@@ -7867,7 +7867,7 @@ sparc_elf_asm_named_section (const char 
 
   fputc ('\n', asm_out_file);
 }
-#endif /* OBJECT_FORMAT_ELF */
+#endif /* OBJECT_FORMAT_ELF && !SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION */
 
 /* We do not allow indirect calls to be optimized into sibling calls.
 
--- gcc-4.4-20100202/gcc/config/sparc/sysv4.h.~1~	2010-02-03 13:47:27.000000000 +0100
+++ gcc-4.4-20100202/gcc/config/sparc/sysv4.h	2010-02-03 13:57:22.000000000 +0100
@@ -127,7 +127,7 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == 
 #undef DTORS_SECTION_ASM_OP
 #define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
 
-#if !HAVE_GNU_AS
+#if !defined (SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION)
 /* Switch into a generic section.  */
 #undef TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION  sparc_elf_asm_named_section


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]