This is the mail archive of the gcc@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: Varasm.c change.


On Mon, Jan 10, 2005 at 04:20:22PM -0800, Eric Christopher wrote:
> On Mon, 2005-01-10 at 16:59 +0100, Toon Moene wrote:
> > Is this one:
> > 
> > 	2005-01-10  Jan Beulich  <jbeulich@novell.com>
> > 	
> > 	...
> > 	* varasm.c (default_section_type_flags_1): Also set SECTION_SMALL
> > 	based on the section name. Rearrange the section name comparison logic
> > 	slightly so that each section name is compared against at most once.
> > 
> > responsible for this problem (on powerpc-unknown-linux-gnu):
> 
> It is and it broke mips as well. Now I could probably add the support
> into the assembler, but...

No, don't.  ia64 is unique in that it defines a SHF_* value for ELF
section header sh_flags field to specify small section data.  Since
other ELF targets can't do anything special with small data sections via
flags, I don't think the assembler should try to handle the 's' flag.

I've applied the following as an obvious fix for the ppc bootstrap
breakage.  If rth decides the original ought to be reverted, then
reverting this as well isn't much harder..

	* varasm.c (default_section_type_flags_1): Don't set SECTION_SMALL.
	* config/ia64/ia64.c (TARGET_SECTION_TYPE_FLAGS): Define.
	(TARGET_RWRELOC): Define.
	(ia64_rwreloc_section_type_flags): Delete.
	(ia64_section_type_flags): New function.
	* config/ia64/hpux.h (TARGET_SECTION_TYPE_FLAGS): Don't define.
	(TARGET_RWRELOC): Define.

Index: gcc/varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.473
diff -u -p -r1.473 varasm.c
--- gcc/varasm.c	10 Jan 2005 07:42:48 -0000	1.473
+++ gcc/varasm.c	11 Jan 2005 03:38:03 -0000
@@ -4606,20 +4606,11 @@ default_section_type_flags_1 (tree decl,
 
   if (strcmp (name, ".bss") == 0
       || strncmp (name, ".bss.", 5) == 0
-      || strncmp (name, ".gnu.linkonce.b.", 16) == 0)
-    flags |= SECTION_BSS;
-
-  if (strcmp (name, ".sdata") == 0
-      || strncmp (name, ".sdata.", 7) == 0
-      || strncmp (name, ".gnu.linkonce.s.", 16) == 0
-      || strncmp (name, ".sdata2.", 8) == 0
-      || strncmp (name, ".gnu.linkonce.s2.", 17) == 0)
-    flags |= SECTION_SMALL;
-
-  if (strcmp (name, ".sbss") == 0
+      || strncmp (name, ".gnu.linkonce.b.", 16) == 0
+      || strcmp (name, ".sbss") == 0
       || strncmp (name, ".sbss.", 6) == 0
       || strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
-    flags |= SECTION_SMALL | SECTION_BSS;
+    flags |= SECTION_BSS;
 
   if (strcmp (name, ".tdata") == 0
       || strncmp (name, ".tdata.", 7) == 0
Index: gcc/config/ia64/hpux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/hpux.h,v
retrieving revision 1.44
diff -u -p -r1.44 hpux.h
--- gcc/config/ia64/hpux.h	30 Jun 2004 03:50:55 -0000	1.44
+++ gcc/config/ia64/hpux.h	11 Jan 2005 03:38:03 -0000
@@ -193,8 +193,7 @@ do {								\
 #define TARGET_ASM_UNIQUE_SECTION  ia64_rwreloc_unique_section
 #undef  TARGET_ASM_SELECT_RTX_SECTION
 #define TARGET_ASM_SELECT_RTX_SECTION  ia64_rwreloc_select_rtx_section
-#undef  TARGET_SECTION_TYPE_FLAGS
-#define TARGET_SECTION_TYPE_FLAGS  ia64_rwreloc_section_type_flags
+#define TARGET_RWRELOC  true
 
 /* ia64 HPUX has the float and long double forms of math functions.  */
 #undef TARGET_C99_FUNCTIONS
Index: gcc/config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.341
diff -u -p -r1.341 ia64.c
--- gcc/config/ia64/ia64.c	10 Jan 2005 07:42:49 -0000	1.341
+++ gcc/config/ia64/ia64.c	11 Jan 2005 03:38:08 -0000
@@ -258,9 +258,7 @@ static void ia64_rwreloc_unique_section 
 static void ia64_rwreloc_select_rtx_section (enum machine_mode, rtx,
 					     unsigned HOST_WIDE_INT)
      ATTRIBUTE_UNUSED;
-static unsigned int ia64_rwreloc_section_type_flags (tree, const char *, int)
-     ATTRIBUTE_UNUSED;
-
+static unsigned int ia64_section_type_flags (tree, const char *, int);
 static void ia64_hpux_add_extern_decl (tree decl)
      ATTRIBUTE_UNUSED;
 static void ia64_hpux_file_end (void)
@@ -387,6 +385,9 @@ static const struct attribute_spec ia64_
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO ia64_encode_section_info
 
+#undef  TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS  ia64_section_type_flags
+
 /* ??? ABI doesn't allow us to define this.  */
 #if 0
 #undef TARGET_PROMOTE_FUNCTION_ARGS
@@ -8796,10 +8797,27 @@ ia64_rwreloc_select_rtx_section (enum ma
   flag_pic = save_pic;
 }
 
+#ifndef TARGET_RWRELOC
+#define TARGET_RWRELOC flag_pic
+#endif
+
 static unsigned int
-ia64_rwreloc_section_type_flags (tree decl, const char *name, int reloc)
+ia64_section_type_flags (tree decl, const char *name, int reloc)
 {
-  return default_section_type_flags_1 (decl, name, reloc, true);
+  unsigned int flags = 0;
+
+  if (strcmp (name, ".sdata") == 0
+      || strncmp (name, ".sdata.", 7) == 0
+      || strncmp (name, ".gnu.linkonce.s.", 16) == 0
+      || strncmp (name, ".sdata2.", 8) == 0
+      || strncmp (name, ".gnu.linkonce.s2.", 17) == 0
+      || strcmp (name, ".sbss") == 0
+      || strncmp (name, ".sbss.", 6) == 0
+      || strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
+    flags = SECTION_SMALL;
+
+  flags |= default_section_type_flags_1 (decl, name, reloc, TARGET_RWRELOC);
+  return flags;
 }
 
 /* Returns true if FNTYPE (a FUNCTION_TYPE or a METHOD_TYPE) returns a

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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