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: default_section_type_flags and SECTION_SMALL


>>> Richard Henderson <rth@redhat.com> 04.01.05 18:57:55 >>>
>On Mon, Jan 03, 2005 at 10:48:23AM +0100, Jan Beulich wrote:
>> Is there a particular reason why default_section_type_flags (in
>> varasm.c) makes no attempt to set SECTION_SMALL, while
>> default_elf_asm_named_section (also in varasm.c) consumes this?
>
>Nope.

Bootstrapped and tested on ia64-unknown-linux-gnu.

Jan

gcc/
2005-01-06  Jan Beulich  <jbeulich@novell.com>

	* config/ia64/ia64.c (ia64_in_small_data_p): Also handle the
section
	names resulting from -ffunction-sections/-fdata-sections and
linkonce
	ones.
	* 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.

---
/home/jbeulich/src/gcc/mainline/2005-01-06.13.34/gcc/config/ia64/ia64.c	2005-01-06
13:32:30.000000000 +0100
+++ 2005-01-06.13.34/gcc/config/ia64/ia64.c	2005-01-07
15:01:23.616649936 +0100
@@ -7682,8 +7684,13 @@ ia64_in_small_data_p (tree exp)
   if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
     {
       const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME
(exp));
+
       if (strcmp (section, ".sdata") == 0
-	  || strcmp (section, ".sbss") == 0)
+	  || strncmp (section, ".sdata.", 7) == 0
+	  || strncmp (section, ".gnu.linkonce.s.", 16) == 0
+	  || strcmp (section, ".sbss") == 0
+	  || strncmp (section, ".sbss.", 6) == 0
+	  || strncmp (section, ".gnu.linkonce.sb.", 17) == 0)
 	return true;
     }
   else
---
/home/jbeulich/src/gcc/mainline/2005-01-06.13.34/gcc/varasm.c	2005-01-04
09:22:29.000000000 +0100
+++ 2005-01-06.13.34/gcc/varasm.c	2005-01-06 17:54:55.266994856
+0100
@@ -4606,20 +4606,31 @@ default_section_type_flags_1 (tree decl,
 
   if (strcmp (name, ".bss") == 0
       || strncmp (name, ".bss.", 5) == 0
-      || strncmp (name, ".gnu.linkonce.b.", 16) == 0
-      || strcmp (name, ".sbss") == 0
-      || strncmp (name, ".sbss.", 6) == 0
-      || strncmp (name, ".gnu.linkonce.sb.", 17) == 0
-      || strcmp (name, ".tbss") == 0
-      || strncmp (name, ".gnu.linkonce.tb.", 17) == 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, ".sbss.", 6) == 0
+      || strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
+    flags |= SECTION_SMALL | SECTION_BSS;
+
   if (strcmp (name, ".tdata") == 0
-      || strcmp (name, ".tbss") == 0
-      || strncmp (name, ".gnu.linkonce.td.", 17) == 0
-      || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
+      || strncmp (name, ".tdata.", 7) == 0
+      || strncmp (name, ".gnu.linkonce.td.", 17) == 0)
     flags |= SECTION_TLS;
 
+  if (strcmp (name, ".tbss") == 0
+      || strncmp (name, ".tbss.", 6) == 0
+      || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
+    flags |= SECTION_TLS | SECTION_BSS;
+
   /* These three sections have special ELF types.  They are neither
      SHT_PROGBITS nor SHT_NOBITS, so when changing sections we don't
      want to print a section type (@progbits or @nobits).  If someone

Attachment: gcc-mainline-ia64-small.patch
Description: Binary data


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