COMDAT Section Support in GCC

Jessica Han jessica@cup.hp.com
Wed Jun 5 19:06:00 GMT 2002


Current assembler will complain ",comdat". I've redone the patch to get rid
of it.  Sorry about the confustion.

Jessica

2002-06-05 Jessica Han <jessica@cup.hp.com>
	* varasm.c Generate group information for a section if it is marked by
        SECTION_LINKONCE when ASM_OUTPUT_COMDAT is defined.
	* ia64.h Define ASM_OUTPUT_COMDAT
	* tm.texi Define ASM_OUTPUT_COMDAT
--- varasm.c.1.293	Wed Jun  5 17:05:11 2002
+++ varasm.c	Wed Jun  5 17:21:54 2002
@@ -4774,6 +4774,10 @@ default_elf_asm_named_section (name, fla
     *f++ = 'S';
   if (flags & SECTION_TLS)
     *f++ = 'T';
+#ifdef ASM_OUTPUT_COMDAT
+  if (flags & SECTION_LINKONCE)
+    *f++ = 'G';
+#endif
   *f = '\0';

   if (flags & SECTION_BSS)
@@ -4784,6 +4788,10 @@ default_elf_asm_named_section (name, fla
   if (flags & SECTION_ENTSIZE)
     fprintf (asm_out_file, "\t.section\t%s,\"%s\",@%s,%d\n",
 	     name, flagchars, type, flags & SECTION_ENTSIZE);
+#ifdef ASM_OUTPUT_COMDAT
+  else if (flags & SECTION_LINKONCE)
+    ASM_OUTPUT_COMDAT (asm_out_file, name, flagchars, type);
+#endif
   else
     fprintf (asm_out_file, "\t.section\t%s,\"%s\",@%s\n",
 	     name, flagchars, type);
--- ia64.h.1.118	Wed Jun  5 17:18:20 2002
+++ ia64.h	Wed Jun  5 17:20:37 2002
@@ -1473,6 +1473,15 @@ do {									\
       fputs (")\n", FILE);						\
     }									\
 } while (0)
+
+/* Ouput group infomation for a section. */
+#define ASM_OUPUT_COMDAT(FILE, NAME, FLAG, TYPE)
+do {                                                                    \
+   fprintf (FILE, "\t.section\t%s,\"%s\",@%s,%s\n",                     \
+               NAME, FLAG, TYPE, strrchr(NAME,'.')+1 );                 \
+} while (0)
+
+
 

 /* Generating Code for Profiling.  */

--- tm.texi.1.136	Tue Jun  4 12:55:53 2002
+++ tm.texi	Wed Jun  5 18:01:17 2002
@@ -6104,6 +6104,12 @@ A C statement to output word @var{n} of
 @var{decl}.  This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS}
 is defined, and is otherwise unused.

+@findex ASM_OUTPUT_COMDAT
+@item ASM_OUTPUT_COMDAT (@var{stream}, @var{name}, @var{flag}, @var{type})
+A C statement to output an assembler command to define the start of a
section
+ which belongs to a group. If this macro is not defined, the section is
+ outputted as a regular section.
+
 @findex CONSTANT_POOL_BEFORE_FUNCTION
 @item CONSTANT_POOL_BEFORE_FUNCTION
 You may define this macro as a C expression.  You should define the




More information about the Gcc-patches mailing list