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]

configurable separator for certain special-case sections


This previously submitted (and never replied to) patch makes the separator
used for mergeable .rodata sections as well as the prioritized constructors/
destructors sections customizable by a target (the NetWare target would
immediately make use of this).

Built and tested for i686-novell-netware on i686-pc-linux-gnu.

Jan

gcc/
2005-05-20  Jan Beulich  <jbeulich@novell.com>

	* defaults.h (TARGET_SUB_SECTION_SEPARATOR): New, default to ".".
	* varasm.c (mergeable_string_section): Use
	TARGET_SUB_SECTION_SEPARATOR.
	(mergeable_constant_section): Likewise.
	(default_named_section_asm_out_destructor): Likewise.
	(default_named_section_asm_out_constructor): Likewise.
	* doc/tm.texi. Document TARGET_SUB_SECTION_SEPARATOR.

--- /home/jbeulich/src/gcc/mainline/2005-05-18/gcc/defaults.h	2005-05-10 16:58:58.000000000 +0200
+++ 2005-05-18/gcc/defaults.h	2005-05-19 16:23:59.000000000 +0200
@@ -354,6 +354,10 @@ do { fputs (integer_asm_op (POINTER_SIZE
 #endif
 #endif
 
+#ifndef TARGET_SUB_SECTION_SEPARATOR
+#define TARGET_SUB_SECTION_SEPARATOR "."
+#endif
+
 /* Number of hardware registers that go into the DWARF-2 unwind info.
    If not defined, equals FIRST_PSEUDO_REGISTER  */
 
--- /home/jbeulich/src/gcc/mainline/2005-05-18/gcc/doc/tm.texi	2005-05-10 16:59:55.000000000 +0200
+++ 2005-05-18/gcc/doc/tm.texi	2005-05-19 16:23:59.000000000 +0200
@@ -7803,6 +7803,12 @@ is a function that outputs a standard GA
 directive followed by a synthetic label.
 @end deftypefn
 
+@deftypevr {Target Hook} {const char *} TARGET_SUB_SECTION_SEPARATOR
+If defined, a C string constant for the separator character(s) necessary
+between the base section name and the sub-section identifier.  If not
+defined, GCC will provide a default definition of ".".
+@end deftypevr
+
 @deftypevar {Target Hook} bool TARGET_TERMINATE_DW2_EH_FRAME_INFO
 Contains the value true if the target should add a zero word onto the
 end of a Dwarf-2 frame info section when used for exception handling.
--- /home/jbeulich/src/gcc/mainline/2005-05-18/gcc/varasm.c	2005-05-18 08:09:13.000000000 +0200
+++ 2005-05-18/gcc/varasm.c	2005-05-19 16:23:59.000000000 +0200
@@ -712,7 +712,7 @@ mergeable_string_section (tree decl ATTR
 	    }
 	  if (i == len - unit)
 	    {
-	      sprintf (name, ".rodata.str%d.%d", modesize / 8,
+	      sprintf (name, ".rodata"TARGET_SUB_SECTION_SEPARATOR"str%d.%d", modesize / 8,
 		       (int) (align / 8));
 	      flags |= (modesize / 8) | SECTION_MERGE | SECTION_STRINGS;
 	      if (!i && modesize < align)
@@ -762,7 +762,7 @@ mergeable_constant_section (enum machine
     {
       char name[24];
 
-      sprintf (name, ".rodata.cst%d", (int) (align / 8));
+      sprintf (name, ".rodata"TARGET_SUB_SECTION_SEPARATOR"cst%d", (int) (align / 8));
       flags |= (align / 8) | SECTION_MERGE;
       named_section_flags (name, flags);
       return;
@@ -1072,7 +1072,7 @@ default_named_section_asm_out_destructor
   /* ??? This only works reliably with the GNU linker.  */
   if (priority != DEFAULT_INIT_PRIORITY)
     {
-      sprintf (buf, ".dtors.%.5u",
+      sprintf (buf, ".dtors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
 	       /* Invert the numbering so the linker puts us in the proper
 		  order; constructors are run from right to left, and the
 		  linker sorts in increasing order.  */
@@ -1133,7 +1133,7 @@ default_named_section_asm_out_constructo
   /* ??? This only works reliably with the GNU linker.  */
   if (priority != DEFAULT_INIT_PRIORITY)
     {
-      sprintf (buf, ".ctors.%.5u",
+      sprintf (buf, ".ctors"TARGET_SUB_SECTION_SEPARATOR"%.5u",
 	       /* Invert the numbering so the linker puts us in the proper
 		  order; constructors are run from right to left, and the
 		  linker sorts in increasing order.  */


Attachment: gcc-mainline-sub-section-separator.patch
Description: Text document


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