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:
 > > 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).
 > 
 > Yes, thanks.  sparc/gas.h is sufficient I think, it should have a proper 
 > header, see for example sparc/sol2-gas.h.

Ok, vxworks and *BSD seem to be ELF too so that's fine.

 > SPARC_DONT_OVERRIDE_ASM_NAMED_SECTION is ugly, instead include the file after 
 > sparc/sysv4.h and restore the setting coming from elfos.h.

Restoring the setting from elfos.h is easy and should fix gcc's middle-end.

But unless I also define _some_ preprocessor symbol I can't prevent sparc.c
from defining a sometimes-unused sparc_elf_asm_named_section() procedure.
I really would have liked to use the symbol HAVE_GNU_AS, but as it's defined
incorrectly I'll have to either keep this procedure or invent some other symbol.

For now I'm keeping the procedure.

 > Do not change the Solaris targets for now.

Ok, I'll drop those bits.

v2 of the patch follows:

gcc/

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

	* config/sparc/gas.h: New file.  Restore
	TARGET_ASM_NAMED_SECTION to its ELF default.
	* config/sparc/sysv4.h (TARGET_ASM_NAMED_SECTION): Do not
	check !HAVE_GNU_AS.
	* config/sparc/sparc.c (sparc_elf_asm_named_section):
	Likewise.
	* config.gcc (sparc*-*-linux*): Include sparc/gas.h
	after sparc/sysv4.h.

--- 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-04 16:02:22.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/sysv4.h sparc/gas.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
@@ -2303,7 +2303,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/sysv4.h sparc/gas.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/gas.h.~1~	2010-02-04 15:53:49.000000000 +0100
+++ gcc-4.4-20100202/gcc/config/sparc/gas.h	2010-02-04 15:58:14.000000000 +0100
@@ -0,0 +1,6 @@
+/* Definitions of target machine for GCC, for SPARC
+   using the GNU assembler.  */
+
+/* Switch into a generic section.  */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION  default_elf_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-04 15:58:50.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)
 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)
 static void
 sparc_elf_asm_named_section (const char *name, unsigned int flags,
 			     tree decl)
--- 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-04 15:58:05.000000000 +0100
@@ -127,11 +127,9 @@ 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
 /* Switch into a generic section.  */
 #undef TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION  sparc_elf_asm_named_section
-#endif
 
 #undef ASM_OUTPUT_ALIGNED_BSS
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \


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