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]

ARM PATCH: Implement COMDAT groups


This patch implements support for use of COMDAT groups as required by
the C++ ABI.  HJ's previous patch did not implement the requirement
that all virtual tables be placed in a single COMDAT group.

Tested on arm-none-eabi, applied on the csl-arm-branch, and queued for
GCC 4.1.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-09-10  Mark Mitchell  <mark@codesourcery.com>

	* configure.ac: Check for COMDAT support.  Robustify check for
	SHF_MERGE support.
	* configure: Regenerated.
	* config.in: Likewise.
	* langhooks-def.h (lhd_comdat_group): New function.
	(LANG_HOOKS_COMDAT_GROUP): New macro.
	(LANG_HOOKS_DECLS): Use it.
	* langhooks.c (lhd_comdat_group): Define.
	* langhooks.h (lang_hooks_for_decls): Add comdat_group.
	* output.h (named_section_flags): Make it a macro.
	(named_section_real): New function.
	(default_no_named_section): Add decl parameter.
	(default_elf_asm_named_section): Likewise.
	(default_coff_asm_named_section): Likewise.
	(default_pe_asm_named_section): Likewise.
	* target.h (gcc_target): Adjust type of named_section.
	* varasm.c (named_section_flags): Rename to named_section_real.
	Add decl parameter.
	(default_no_named_section): Add decl parameter.
	(default_elf_asm_named_section): Use COMDAT, if available.  Deal
	with the case that ASM_COMMENT_START is "@".
	(default_coff_asm_named_section): Add decl parameter.
	(default_pe_asm_named_section): Likewise.
	* config/alpha/alpha.c (vms_asm_named_section): Add decl
	parameter.
	(unicosmk_asm_named_section): Likewise.
	* config/arm/arm.c (arm_elf_asm_named_section): Remove.
	* config/arm/elf.h (TARGET_ASM_NAMED_SECTION): Likewise.
	* config/c4x/c4x.c (c4x_asm_named_section): Add decl parameter.
	* config/cris/cris-protos.h (cris_target_asm_named_section):
	Likewise.
	* config/cris/cris.c (cris_target_asm_named_section):
	Likewise.
	* config/h8300/h8300.c (h8300_asm_named_section): Likewise.
	* config/i386/i386-protos.h (i386_pe_asm_named_section):
	Likewise.
	* config/i386/winnt.c (i386_pe_asm_named_section): Likewise.
	* config/m68k/m68k.c (m68k_coff_asm_named_section): Likewise.
	* config/mcore/mcore.c (mcore_asm_named_section): Likewise.
	* config/mips/mips.c (irix_asm_named_section): Likewise.
	* config/rs6000/rs6000.c (rs6000_xcoff_asm_named_section):
	Likewise.
	* config/sparc/sparc.c (sparce_elf_asm_named_section): Likewise.
	* cp/cp-lang.h (LANG_HOOKS_COMDAT_GROUP): Define.
	* cp/cp-tree.h (cxx_comdat_group): Declare.
	* cp/decl.c (cxx_comdat_group): New function.

Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.19.2.3
diff -c -5 -p -r2.19.2.3 configure.ac
*** configure.ac	16 Aug 2004 17:13:04 -0000	2.19.2.3
--- configure.ac	10 Sep 2004 18:49:54 -0000
*************** if test $gcc_cv_as_eh_frame = buggy; the
*** 2036,2049 ****
--- 2036,2068 ----
  fi
  
  gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
   [elf,2,12,0], [--fatal-warnings],
   [.section .rodata.str, "aMS", @progbits, 1])
+ if test $gcc_cv_as_shf_merge = no; then
+   gcc_GAS_CHECK_FEATURE(section merging support, gcc_cv_as_shf_merge,
+     [elf,2,12,0], [--fatal-warnings],
+     [.section .rodata.str, "aMS", %progbits, 1])
+ fi
  AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
    [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
  [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
  
+ gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
+  [elf,2,15,91], [--fatal-warnings],
+  [.section .text,"axG",@progbits,.foo,comdat])
+ if test $gcc_cv_as_comdat_group = yes; then
+   gcc_cv_as_comdat_group_percent=no
+ else
+  gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
+    [elf,2,15,91], [--fatal-warnings],
+    [.section .text,"axG",%progbits,.foo,comdat])
+ fi
+ AC_DEFINE_UNQUOTED(HAVE_GAS_COMDAT_GROUP,
+   [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if your assembler supports COMDAT group.])
+ 
  # Thread-local storage - the check is heavily parametrized.
  conftest_s=
  tls_first_major=
  tls_first_minor=
  tls_as_opt=
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.69.4.2
diff -c -5 -p -r1.69.4.2 langhooks-def.h
*** langhooks-def.h	3 Mar 2004 16:02:40 -0000	1.69.4.2
--- langhooks-def.h	10 Sep 2004 18:49:55 -0000
*************** extern bool lhd_can_use_bit_fields_p (vo
*** 63,72 ****
--- 63,73 ----
  extern bool lhd_warn_unused_global_decl (tree);
  extern void lhd_incomplete_type_error (tree, tree);
  extern tree lhd_type_promotes_to (tree);
  extern void lhd_register_builtin_type (tree, const char *);
  extern bool lhd_decl_ok_for_sibcall (tree);
+ extern const char *lhd_comdat_group (tree);
  extern tree lhd_expr_size (tree);
  extern bool lhd_decl_uninit (tree);
  extern tree lhd_get_callee_fndecl (tree);
  extern size_t lhd_tree_size (enum tree_code);
  
*************** extern int lhd_tree_dump_type_quals (tre
*** 245,254 ****
--- 246,256 ----
  #define LANG_HOOKS_BUILTIN_TYPE_DECLS lhd_return_null_tree_v
  #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
  #define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
  #define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
  #define LANG_HOOKS_DECL_OK_FOR_SIBCALL	lhd_decl_ok_for_sibcall
+ #define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
  
  #define LANG_HOOKS_DECLS { \
    LANG_HOOKS_PUSHLEVEL, \
    LANG_HOOKS_POPLEVEL, \
    LANG_HOOKS_GLOBAL_BINDINGS_P, \
*************** extern int lhd_tree_dump_type_quals (tre
*** 259,268 ****
--- 261,271 ----
    LANG_HOOKS_BUILTIN_TYPE_DECLS, \
    LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
    LANG_HOOKS_WRITE_GLOBALS, \
    LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
    LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
+   LANG_HOOKS_COMDAT_GROUP \
  }
  
  /* The whole thing.  The structure is defined in langhooks.h.  */
  #define LANG_HOOKS_INITIALIZER { \
    LANG_HOOKS_NAME, \
Index: langhooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.c,v
retrieving revision 1.54.4.2
diff -c -5 -p -r1.54.4.2 langhooks.c
*** langhooks.c	3 Mar 2004 16:02:40 -0000	1.54.4.2
--- langhooks.c	10 Sep 2004 18:49:55 -0000
*************** bool
*** 484,493 ****
--- 484,501 ----
  lhd_decl_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED)
  {
    return true;
  }
  
+ /* Return the COMDAT group into which DECL should be placed.  */
+ 
+ const char *
+ lhd_comdat_group (tree decl)
+ {
+   return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ }
+ 
  /* lang_hooks.decls.final_write_globals: perform final processing on
     global variables.  */
  void
  write_global_declarations (void)
  {
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.76.4.2
diff -c -5 -p -r1.76.4.2 langhooks.h
*** langhooks.h	3 Mar 2004 16:02:41 -0000	1.76.4.2
--- langhooks.h	10 Sep 2004 18:49:55 -0000
*************** struct lang_hooks_for_decls
*** 203,212 ****
--- 203,221 ----
    /* Do necessary preparations before assemble_variable can proceed.  */
    void (*prepare_assemble_variable) (tree);
  
    /* True if this decl may be called via a sibcall.  */
    bool (*ok_for_sibcall) (tree);
+ 
+   /* Return the COMDAT group into which this DECL should be placed.
+      It is known that the DECL belongs in *some* COMDAT group when
+      this hook is called.  The return value will be used immediately,
+      but not explicitly deallocated, so implementations should not use
+      xmalloc to allocate the string returned.  (Typically, the return
+      value will be the string already stored in an
+      IDENTIFIER_NODE.)  */
+   const char * (*comdat_group) (tree);
  };
  
  /* Language-specific hooks.  See langhooks-def.h for defaults.  */
  
  struct lang_hooks
Index: output.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/output.h,v
retrieving revision 1.133.4.1
diff -c -5 -p -r1.133.4.1 output.h
*** output.h	3 Mar 2004 16:02:42 -0000	1.133.4.1
--- output.h	10 Sep 2004 18:49:55 -0000
*************** extern void no_asm_to_stream (FILE *);
*** 475,493 ****
  #define SECTION_NOTYPE	 0x80000	/* don't output @progbits */
  #define SECTION_MACH_DEP 0x100000	/* subsequent bits reserved for target */
  
  extern unsigned int get_named_section_flags (const char *);
  extern bool set_named_section_flags (const char *, unsigned int);
! extern void named_section_flags (const char *, unsigned int);
  extern bool named_section_first_declaration (const char *);
  extern unsigned int default_section_type_flags (tree, const char *, int);
  extern unsigned int default_section_type_flags_1 (tree, const char *, int, int);
  
! extern void default_no_named_section (const char *, unsigned int);
! extern void default_elf_asm_named_section (const char *, unsigned int);
! extern void default_coff_asm_named_section (const char *, unsigned int);
! extern void default_pe_asm_named_section (const char *, unsigned int);
  
  extern void default_stabs_asm_out_destructor (rtx, int);
  extern void default_named_section_asm_out_destructor (rtx, int);
  extern void default_dtor_section_asm_out_destructor (rtx, int);
  extern void default_stabs_asm_out_constructor (rtx, int);
--- 475,495 ----
  #define SECTION_NOTYPE	 0x80000	/* don't output @progbits */
  #define SECTION_MACH_DEP 0x100000	/* subsequent bits reserved for target */
  
  extern unsigned int get_named_section_flags (const char *);
  extern bool set_named_section_flags (const char *, unsigned int);
! #define named_section_flags(NAME, FLAGS) \
!   named_section_real((NAME), (FLAGS), /*decl=*/NULL_TREE)
! extern void named_section_real (const char *, unsigned int, tree);
  extern bool named_section_first_declaration (const char *);
  extern unsigned int default_section_type_flags (tree, const char *, int);
  extern unsigned int default_section_type_flags_1 (tree, const char *, int, int);
  
! extern void default_no_named_section (const char *, unsigned int, tree);
! extern void default_elf_asm_named_section (const char *, unsigned int, tree);
! extern void default_coff_asm_named_section (const char *, unsigned int, tree);
! extern void default_pe_asm_named_section (const char *, unsigned int, tree);
  
  extern void default_stabs_asm_out_destructor (rtx, int);
  extern void default_named_section_asm_out_destructor (rtx, int);
  extern void default_dtor_section_asm_out_destructor (rtx, int);
  extern void default_stabs_asm_out_constructor (rtx, int);
Index: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.67.2.11
diff -c -5 -p -r1.67.2.11 target.h
*** target.h	31 Aug 2004 22:59:16 -0000	1.67.2.11
--- target.h	10 Sep 2004 18:49:55 -0000
*************** struct gcc_target
*** 94,106 ****
      void (* function_begin_epilogue) (FILE *);
  
      /* Output the assembler code for function exit.  */
      void (* function_epilogue) (FILE *, HOST_WIDE_INT);
  
!     /* Switch to an arbitrary section NAME with attributes as
!        specified by FLAGS.  */
!     void (* named_section) (const char *, unsigned int);
  
      /* Switch to the section that holds the exception table.  */
      void (* exception_section) (void);
  
      /* Switch to the section that holds the exception frames.  */
--- 94,107 ----
      void (* function_begin_epilogue) (FILE *);
  
      /* Output the assembler code for function exit.  */
      void (* function_epilogue) (FILE *, HOST_WIDE_INT);
  
!     /* Tell assembler to change to section NAME with attributes FLAGS.
!        If DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with
!        which this section is associated.  */
!     void (* named_section) (const char *name, unsigned int flags, tree decl);
  
      /* Switch to the section that holds the exception table.  */
      void (* exception_section) (void);
  
      /* Switch to the section that holds the exception frames.  */
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.395.2.5
diff -c -5 -p -r1.395.2.5 varasm.c
*** varasm.c	17 Aug 2004 03:06:25 -0000	1.395.2.5
--- varasm.c	10 Sep 2004 18:49:56 -0000
*************** set_named_section_flags (const char *sec
*** 381,401 ****
      return false;
  
    return true;
  }
  
! /* Tell assembler to change to section NAME with attributes FLAGS.  */
  
  void
! named_section_flags (const char *name, unsigned int flags)
  {
    if (in_section != in_named || strcmp (name, in_named_name) != 0)
      {
        if (! set_named_section_flags (name, flags))
  	abort ();
  
!       (*targetm.asm_out.named_section) (name, flags);
  
        if (flags & SECTION_FORGET)
  	in_section = no_section;
        else
  	{
--- 381,403 ----
      return false;
  
    return true;
  }
  
! /* Tell assembler to change to section NAME with attributes FLAGS.  If
!    DECL is non-NULL, it is the VAR_DECL or FUNCTION_DECL with which
!    this section is associated.  */
  
  void
! named_section_real (const char *name, unsigned int flags, tree decl)
  {
    if (in_section != in_named || strcmp (name, in_named_name) != 0)
      {
        if (! set_named_section_flags (name, flags))
  	abort ();
  
!       (*targetm.asm_out.named_section) (name, flags, decl);
  
        if (flags & SECTION_FORGET)
  	in_section = no_section;
        else
  	{
*************** named_section (tree decl, const char *na
*** 432,442 ****
        flags = get_named_section_flags (name);
        if ((flags & SECTION_OVERRIDE) == 0)
  	error ("%J%D causes a section type conflict", decl, decl);
      }
  
!   named_section_flags (name, flags);
  }
  
  /* If required, set DECL_SECTION_NAME to a unique name.  */
  
  void
--- 434,444 ----
        flags = get_named_section_flags (name);
        if ((flags & SECTION_OVERRIDE) == 0)
  	error ("%J%D causes a section type conflict", decl, decl);
      }
  
!   named_section_real (name, flags, decl);
  }
  
  /* If required, set DECL_SECTION_NAME to a unique name.  */
  
  void
*************** default_section_type_flags_1 (tree decl,
*** 4641,4663 ****
  /* Output assembly to switch to section NAME with attribute FLAGS.
     Four variants for common object file formats.  */
  
  void
  default_no_named_section (const char *name ATTRIBUTE_UNUSED,
! 			  unsigned int flags ATTRIBUTE_UNUSED)
  {
    /* Some object formats don't support named sections at all.  The
       front-end should already have flagged this as an error.  */
    abort ();
  }
  
  void
! default_elf_asm_named_section (const char *name, unsigned int flags)
  {
    char flagchars[10], *f = flagchars;
  
!   if (! named_section_first_declaration (name))
      {
        fprintf (asm_out_file, "\t.section\t%s\n", name);
        return;
      }
  
--- 4643,4672 ----
  /* Output assembly to switch to section NAME with attribute FLAGS.
     Four variants for common object file formats.  */
  
  void
  default_no_named_section (const char *name ATTRIBUTE_UNUSED,
! 			  unsigned int flags ATTRIBUTE_UNUSED,
! 			  tree decl ATTRIBUTE_UNUSED)
  {
    /* Some object formats don't support named sections at all.  The
       front-end should already have flagged this as an error.  */
    abort ();
  }
  
  void
! default_elf_asm_named_section (const char *name, unsigned int flags,
! 			       tree decl ATTRIBUTE_UNUSED)
  {
    char flagchars[10], *f = flagchars;
  
!   /* If we have already declared this section, we can use an
!      abbreviated form to switch back to it -- unless this section is
!      part of a COMDAT groups, in which case GAS requires the full
!      declaration every time.  */
!   if (!(HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
!       && ! named_section_first_declaration (name))
      {
        fprintf (asm_out_file, "\t.section\t%s\n", name);
        return;
      }
  
*************** default_elf_asm_named_section (const cha
*** 4673,4706 ****
      *f++ = 'M';
    if (flags & SECTION_STRINGS)
      *f++ = 'S';
    if (flags & SECTION_TLS)
      *f++ = 'T';
    *f = '\0';
  
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
  
    if (!(flags & SECTION_NOTYPE))
      {
        const char *type;
  
        if (flags & SECTION_BSS)
  	type = "nobits";
        else
  	type = "progbits";
  
!       fprintf (asm_out_file, ",@%s", type);
  
        if (flags & SECTION_ENTSIZE)
  	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
      }
  
    putc ('\n', asm_out_file);
  }
  
  void
! default_coff_asm_named_section (const char *name, unsigned int flags)
  {
    char flagchars[8], *f = flagchars;
  
    if (flags & SECTION_WRITE)
      *f++ = 'w';
--- 4682,4729 ----
      *f++ = 'M';
    if (flags & SECTION_STRINGS)
      *f++ = 'S';
    if (flags & SECTION_TLS)
      *f++ = 'T';
+   if (HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
+     *f++ = 'G';
    *f = '\0';
  
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
  
    if (!(flags & SECTION_NOTYPE))
      {
        const char *type;
+       const char *format;
  
        if (flags & SECTION_BSS)
  	type = "nobits";
        else
  	type = "progbits";
  
!       format = ",@%s";
! #ifdef ASM_COMMENT_START
!       /* On platforms that use "@" as the assembly comment character,
! 	 use "%" instead.  */
!       if (strcmp (ASM_COMMENT_START, "@") == 0)
! 	format = ",%%%s";
! #endif
!       fprintf (asm_out_file, format, type);
  
        if (flags & SECTION_ENTSIZE)
  	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
+       if (HAVE_GAS_COMDAT_GROUP && (flags & SECTION_LINKONCE))
+ 	fprintf (asm_out_file, ",%s,comdat", 
+ 		 lang_hooks.decls.comdat_group (decl));
      }
  
    putc ('\n', asm_out_file);
  }
  
  void
! default_coff_asm_named_section (const char *name, unsigned int flags, 
! 				tree decl ATTRIBUTE_UNUSED)
  {
    char flagchars[8], *f = flagchars;
  
    if (flags & SECTION_WRITE)
      *f++ = 'w';
*************** default_coff_asm_named_section (const ch
*** 4710,4722 ****
  
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
  }
  
  void
! default_pe_asm_named_section (const char *name, unsigned int flags)
  {
!   default_coff_asm_named_section (name, flags);
  
    if (flags & SECTION_LINKONCE)
      {
        /* Functions may have been compiled at various levels of
           optimization so we can't use `same_size' here.
--- 4733,4746 ----
  
    fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
  }
  
  void
! default_pe_asm_named_section (const char *name, unsigned int flags,
! 			      tree decl)
  {
!   default_coff_asm_named_section (name, flags, decl);
  
    if (flags & SECTION_LINKONCE)
      {
        /* Functions may have been compiled at various levels of
           optimization so we can't use `same_size' here.
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.335.4.6
diff -c -5 -p -r1.335.4.6 alpha.c
*** config/alpha/alpha.c	16 Aug 2004 17:13:33 -0000	1.335.4.6
--- config/alpha/alpha.c	10 Sep 2004 18:49:56 -0000
*************** vms_section_type_flags (tree decl, const
*** 9294,9304 ****
  /* Switch to an arbitrary section NAME with attributes as specified
     by FLAGS.  ALIGN specifies any known alignment requirements for
     the section; 0 if the default should be used.  */
  
  static void
! vms_asm_named_section (const char *name, unsigned int flags)
  {
    fputc ('\n', asm_out_file);
    fprintf (asm_out_file, ".section\t%s", name);
  
    if (flags & SECTION_VMS_OVERLAY)
--- 9294,9305 ----
  /* Switch to an arbitrary section NAME with attributes as specified
     by FLAGS.  ALIGN specifies any known alignment requirements for
     the section; 0 if the default should be used.  */
  
  static void
! vms_asm_named_section (const char *name, unsigned int flags, 
! 		       tree decl ATTRIBUTE_UNUSED)
  {
    fputc ('\n', asm_out_file);
    fprintf (asm_out_file, ".section\t%s", name);
  
    if (flags & SECTION_VMS_OVERLAY)
*************** unicosmk_unique_section (tree decl, int 
*** 9500,9510 ****
  /* Switch to an arbitrary section NAME with attributes as specified
     by FLAGS.  ALIGN specifies any known alignment requirements for
     the section; 0 if the default should be used.  */
  
  static void
! unicosmk_asm_named_section (const char *name, unsigned int flags)
  {
    const char *kind;
  
    /* Close the previous section.  */
  
--- 9501,9512 ----
  /* Switch to an arbitrary section NAME with attributes as specified
     by FLAGS.  ALIGN specifies any known alignment requirements for
     the section; 0 if the default should be used.  */
  
  static void
! unicosmk_asm_named_section (const char *name, unsigned int flags, 
! 			    tree decl ATTRIBUTE_UNUSED)
  {
    const char *kind;
  
    /* Close the previous section.  */
  
Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.303.2.50
diff -c -5 -p -r1.303.2.50 arm.c
*** config/arm/arm.c	31 Aug 2004 22:59:17 -0000	1.303.2.50
--- config/arm/arm.c	10 Sep 2004 18:49:56 -0000
*************** static rtx safe_vector_operand (rtx, enu
*** 142,154 ****
  static rtx arm_expand_binop_builtin (enum insn_code, tree, rtx);
  static rtx arm_expand_unop_builtin (enum insn_code, tree, rtx, int);
  static rtx arm_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
  static void emit_constant_insn (rtx cond, rtx pattern);
  
- #ifdef OBJECT_FORMAT_ELF
- static void arm_elf_asm_named_section (const char *, unsigned int);
- #endif
  #ifndef ARM_PE
  static void arm_encode_section_info (tree, rtx, int);
  #endif
  #ifdef AOF_ASSEMBLER
  static void aof_globalize_label (FILE *, const char *);
--- 142,151 ----
*************** aof_file_end (void)
*** 14210,14275 ****
    aof_dump_imports (asm_out_file);
    fputs ("\tEND\n", asm_out_file);
  }
  #endif /* AOF_ASSEMBLER */
  
- #ifdef OBJECT_FORMAT_ELF
- /* Switch to an arbitrary section NAME with attributes as specified
-    by FLAGS.  ALIGN specifies any known alignment requirements for
-    the section; 0 if the default should be used.
- 
-    Differs from the default elf version only in the prefix character
-    used before the section type.  */
- 
- static void
- arm_elf_asm_named_section (const char *name, unsigned int flags)
- {
-   char flagchars[10], *f = flagchars;
- 
-   if (! named_section_first_declaration (name))
-     {
-       fprintf (asm_out_file, "\t.section\t%s\n", name);
-       return;
-     }
- 
-   if (!(flags & SECTION_DEBUG))
-     *f++ = 'a';
-   if (flags & SECTION_WRITE)
-     *f++ = 'w';
-   if (flags & SECTION_CODE)
-     *f++ = 'x';
-   if (flags & SECTION_SMALL)
-     *f++ = 's';
-   if (flags & SECTION_MERGE)
-     *f++ = 'M';
-   if (flags & SECTION_STRINGS)
-     *f++ = 'S';
-   if (flags & SECTION_TLS)
-     *f++ = 'T';
-   *f = '\0';
- 
-   fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
- 
-   if (!(flags & SECTION_NOTYPE))
-     {
-       const char *type;
- 
-       if (flags & SECTION_BSS)
- 	type = "nobits";
-       else
- 	type = "progbits";
- 
-       fprintf (asm_out_file, ",%%%s", type);
- 
-       if (flags & SECTION_ENTSIZE)
- 	fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE);
-     }
- 
-   putc ('\n', asm_out_file);
- }
- #endif
- 
  #ifndef ARM_PE
  /* Symbols in the text segment can be accessed without indirecting via the
     constant pool; it may take an extra binary operation, but this is still
     faster than indirecting via memory.  Don't do this when not optimizing,
     since we won't be calculating al of the offsets necessary to do this
--- 14207,14216 ----
Index: config/arm/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/elf.h,v
retrieving revision 1.44.8.3
diff -c -5 -p -r1.44.8.3 elf.h
*** config/arm/elf.h	15 May 2004 13:02:09 -0000	1.44.8.3
--- config/arm/elf.h	10 Sep 2004 18:49:56 -0000
***************
*** 117,129 ****
  #endif
  
  #define TARGET_ASM_FILE_START_APP_OFF true
  #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
  
- #undef  TARGET_ASM_NAMED_SECTION
- #define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
- 
  
  /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs.  */
  #define NEED_PLT_RELOC	flag_pic
  #define NEED_GOT_RELOC	flag_pic
  
--- 117,126 ----
Index: config/c4x/c4x.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.c,v
retrieving revision 1.134.4.2
diff -c -5 -p -r1.134.4.2 c4x.c
*** config/c4x/c4x.c	3 Mar 2004 16:03:36 -0000	1.134.4.2
--- config/c4x/c4x.c	10 Sep 2004 18:49:56 -0000
*************** static int c4x_rptb_valid_p (rtx, rtx);
*** 192,202 ****
  static void c4x_reorg (void);
  static int c4x_label_ref_used_p (rtx, rtx);
  static tree c4x_handle_fntype_attribute (tree *, tree, tree, int, bool *);
  const struct attribute_spec c4x_attribute_table[];
  static void c4x_insert_attributes (tree, tree *);
! static void c4x_asm_named_section (const char *, unsigned int);
  static int c4x_adjust_cost (rtx, rtx, rtx, int);
  static void c4x_globalize_label (FILE *, const char *);
  static bool c4x_rtx_costs (rtx, int, int, int *);
  static int c4x_address_cost (rtx);
  static void c4x_init_libfuncs (void);
--- 192,202 ----
  static void c4x_reorg (void);
  static int c4x_label_ref_used_p (rtx, rtx);
  static tree c4x_handle_fntype_attribute (tree *, tree, tree, int, bool *);
  const struct attribute_spec c4x_attribute_table[];
  static void c4x_insert_attributes (tree, tree *);
! static void c4x_asm_named_section (const char *, unsigned int, tree);
  static int c4x_adjust_cost (rtx, rtx, rtx, int);
  static void c4x_globalize_label (FILE *, const char *);
  static bool c4x_rtx_costs (rtx, int, int, int *);
  static int c4x_address_cost (rtx);
  static void c4x_init_libfuncs (void);
*************** c4x_init_libfuncs (void)
*** 4867,4877 ****
    floathihf2_libfunc        = init_one_libfunc ("__floathihf2");
    floatunshihf2_libfunc     = init_one_libfunc ("__ufloathihf2");
  }
  
  static void
! c4x_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
  {
    fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
  }
  
  static void
--- 4867,4878 ----
    floathihf2_libfunc        = init_one_libfunc ("__floathihf2");
    floatunshihf2_libfunc     = init_one_libfunc ("__ufloathihf2");
  }
  
  static void
! c4x_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED,
! 		       tree decl ATTRIBUTE_UNUSED)
  {
    fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
  }
  
  static void
Index: config/cris/cris-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris-protos.h,v
retrieving revision 1.8
diff -c -5 -p -r1.8 cris-protos.h
*** config/cris/cris-protos.h	1 Oct 2003 12:43:23 -0000	1.8
--- config/cris/cris-protos.h	10 Sep 2004 18:49:56 -0000
*************** extern int cris_legitimate_pic_operand (
*** 41,51 ****
  extern int cris_gotless_symbol (rtx);
  extern int cris_got_symbol (rtx);
  extern int cris_symbol (rtx);
  extern void cris_output_addr_const (FILE *, rtx);
  extern int cris_cfun_uses_pic_table (void);
! extern void cris_target_asm_named_section (const char *, unsigned int);
  
  # ifdef TREE_CODE
  extern rtx cris_expand_builtin_va_arg (tree, tree);
  # endif
  #endif /* RTX_CODE */
--- 41,51 ----
  extern int cris_gotless_symbol (rtx);
  extern int cris_got_symbol (rtx);
  extern int cris_symbol (rtx);
  extern void cris_output_addr_const (FILE *, rtx);
  extern int cris_cfun_uses_pic_table (void);
! extern void cris_target_asm_named_section (const char *, unsigned int, tree);
  
  # ifdef TREE_CODE
  extern rtx cris_expand_builtin_va_arg (tree, tree);
  # endif
  #endif /* RTX_CODE */
Index: config/cris/cris.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.c,v
retrieving revision 1.46.4.2
diff -c -5 -p -r1.46.4.2 cris.c
*** config/cris/cris.c	9 Apr 2004 13:40:24 -0000	1.46.4.2
--- config/cris/cris.c	10 Sep 2004 18:49:56 -0000
*************** cris_reg_overlap_mentioned_p (rtx x, rtx
*** 2423,2438 ****
  
  /* The TARGET_ASM_NAMED_SECTION worker.
     We just dispatch to the functions for ELF and a.out.  */
  
  void
! cris_target_asm_named_section (const char *name, unsigned int flags)
  {
    if (! TARGET_ELF)
!     default_no_named_section (name, flags);
    else
!     default_elf_asm_named_section (name, flags);
  }
  
  /* The LEGITIMATE_PIC_OPERAND_P worker.  */
  
  int
--- 2423,2439 ----
  
  /* The TARGET_ASM_NAMED_SECTION worker.
     We just dispatch to the functions for ELF and a.out.  */
  
  void
! cris_target_asm_named_section (const char *name, unsigned int flags,
! 			       tree decl)
  {
    if (! TARGET_ELF)
!     default_no_named_section (name, flags, decl);
    else
!     default_elf_asm_named_section (name, flags, decl);
  }
  
  /* The LEGITIMATE_PIC_OPERAND_P worker.  */
  
  int
Index: config/h8300/h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.253.4.2
diff -c -5 -p -r1.253.4.2 h8300.c
*** config/h8300/h8300.c	3 Mar 2004 16:03:41 -0000	1.253.4.2
--- config/h8300/h8300.c	10 Sep 2004 18:49:56 -0000
*************** static const char *cond_string (enum rtx
*** 61,71 ****
  static unsigned int h8300_asm_insn_count (const char *);
  static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
  static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, bool *);
  static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *);
  #ifndef OBJECT_FORMAT_ELF
! static void h8300_asm_named_section (const char *, unsigned int);
  #endif
  static int h8300_and_costs (rtx);
  static int h8300_shift_costs (rtx);
  
  /* CPU_TYPE, says what cpu we're compiling for.  */
--- 61,71 ----
  static unsigned int h8300_asm_insn_count (const char *);
  static tree h8300_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
  static tree h8300_handle_eightbit_data_attribute (tree *, tree, tree, int, bool *);
  static tree h8300_handle_tiny_data_attribute (tree *, tree, tree, int, bool *);
  #ifndef OBJECT_FORMAT_ELF
! static void h8300_asm_named_section (const char *, unsigned int, tree);
  #endif
  static int h8300_and_costs (rtx);
  static int h8300_shift_costs (rtx);
  
  /* CPU_TYPE, says what cpu we're compiling for.  */
*************** output_simode_bld (int bild, rtx operand
*** 4379,4389 ****
    return "";
  }
  
  #ifndef OBJECT_FORMAT_ELF
  static void
! h8300_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
  {
    /* ??? Perhaps we should be using default_coff_asm_named_section.  */
    fprintf (asm_out_file, "\t.section %s\n", name);
  }
  #endif /* ! OBJECT_FORMAT_ELF */
--- 4379,4390 ----
    return "";
  }
  
  #ifndef OBJECT_FORMAT_ELF
  static void
! h8300_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED,
! 			 tree decl)
  {
    /* ??? Perhaps we should be using default_coff_asm_named_section.  */
    fprintf (asm_out_file, "\t.section %s\n", name);
  }
  #endif /* ! OBJECT_FORMAT_ELF */
Index: config/i386/i386-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386-protos.h,v
retrieving revision 1.101.4.3
diff -c -5 -p -r1.101.4.3 i386-protos.h
*** config/i386/i386-protos.h	17 Aug 2004 19:39:14 -0000	1.101.4.3
--- config/i386/i386-protos.h	10 Sep 2004 18:49:56 -0000
*************** extern int ix86_data_alignment (tree, in
*** 206,216 ****
  extern int ix86_local_alignment (tree, int);
  extern int ix86_constant_alignment (tree, int);
  extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);
  
  extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
! extern void i386_pe_asm_named_section (const char *, unsigned int);
  extern int x86_field_alignment (tree, int);
  #endif
  
  extern rtx ix86_tls_get_addr (void);
  extern bool ix86_must_pass_in_stack (enum machine_mode mode, tree);
--- 206,216 ----
  extern int ix86_local_alignment (tree, int);
  extern int ix86_constant_alignment (tree, int);
  extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *);
  
  extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
! extern void i386_pe_asm_named_section (const char *, unsigned int, tree);
  extern int x86_field_alignment (tree, int);
  #endif
  
  extern rtx ix86_tls_get_addr (void);
  extern bool ix86_must_pass_in_stack (enum machine_mode mode, tree);
Index: config/i386/winnt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.59.4.3
diff -c -5 -p -r1.59.4.3 winnt.c
*** config/i386/winnt.c	17 Aug 2004 19:39:17 -0000	1.59.4.3
--- config/i386/winnt.c	10 Sep 2004 18:49:57 -0000
*************** i386_pe_section_type_flags (tree decl, c
*** 630,640 ****
  
    return flags;
  }
  
  void
! i386_pe_asm_named_section (const char *name, unsigned int flags)
  {
    char flagchars[8], *f = flagchars;
  
    if ((flags & (SECTION_CODE | SECTION_WRITE)) == 0)
      /* readonly data */
--- 630,641 ----
  
    return flags;
  }
  
  void
! i386_pe_asm_named_section (const char *name, unsigned int flags, 
! 			   tree decl ATTRIBUTE_UNUSED)
  {
    char flagchars[8], *f = flagchars;
  
    if ((flags & (SECTION_CODE | SECTION_WRITE)) == 0)
      /* readonly data */
Index: config/m68k/m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.118.2.4
diff -c -5 -p -r1.118.2.4 m68k.c
*** config/m68k/m68k.c	16 Aug 2004 17:13:41 -0000	1.118.2.4
--- config/m68k/m68k.c	10 Sep 2004 18:49:57 -0000
*************** int switch_table_difference_label_flag;
*** 109,119 ****
  static rtx find_addr_reg (rtx);
  static const char *singlemove_string (rtx *);
  static void m68k_output_function_prologue (FILE *, HOST_WIDE_INT);
  static void m68k_output_function_epilogue (FILE *, HOST_WIDE_INT);
  #ifdef M68K_TARGET_COFF
! static void m68k_coff_asm_named_section (const char *, unsigned int);
  #endif /* M68K_TARGET_COFF */
  #ifdef HPUX_ASM
  static void m68k_hp320_internal_label (FILE *, const char *, unsigned long);
  static void m68k_hp320_file_start (void);
  #endif
--- 109,120 ----
  static rtx find_addr_reg (rtx);
  static const char *singlemove_string (rtx *);
  static void m68k_output_function_prologue (FILE *, HOST_WIDE_INT);
  static void m68k_output_function_epilogue (FILE *, HOST_WIDE_INT);
  #ifdef M68K_TARGET_COFF
! static void m68k_coff_asm_named_section (const char *, unsigned int,
! 					 tree decl);
  #endif /* M68K_TARGET_COFF */
  #ifdef HPUX_ASM
  static void m68k_hp320_internal_label (FILE *, const char *, unsigned long);
  static void m68k_hp320_file_start (void);
  #endif
*************** output_xorsi3 (rtx *operands)
*** 3405,3415 ****
  #ifdef M68K_TARGET_COFF
  
  /* Output assembly to switch to section NAME with attribute FLAGS.  */
  
  static void
! m68k_coff_asm_named_section (const char *name, unsigned int flags)
  {
    char flagchar;
  
    if (flags & SECTION_WRITE)
      flagchar = 'd';
--- 3406,3417 ----
  #ifdef M68K_TARGET_COFF
  
  /* Output assembly to switch to section NAME with attribute FLAGS.  */
  
  static void
! m68k_coff_asm_named_section (const char *name, unsigned int flags, 
! 			     tree decl ATTRIBUTE_UNUSED)
  {
    char flagchar;
  
    if (flags & SECTION_WRITE)
      flagchar = 'd';
Index: config/mcore/mcore.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.c,v
retrieving revision 1.54.4.1
diff -c -5 -p -r1.54.4.1 mcore.c
*** config/mcore/mcore.c	3 Mar 2004 16:03:58 -0000	1.54.4.1
--- config/mcore/mcore.c	10 Sep 2004 18:49:57 -0000
*************** static int        mcore_dllexport_p     
*** 136,146 ****
  static int        mcore_dllimport_p             (tree);
  const struct attribute_spec mcore_attribute_table[];
  static tree       mcore_handle_naked_attribute  (tree *, tree, tree, int, bool *);
  #ifdef OBJECT_FORMAT_ELF
  static void	  mcore_asm_named_section       (const char *,
! 							unsigned int);
  #endif
  static void       mcore_unique_section	        (tree, int);
  static void mcore_encode_section_info		(tree, rtx, int);
  static const char *mcore_strip_name_encoding	(const char *);
  static int        mcore_const_costs            	(rtx, RTX_CODE);
--- 136,146 ----
  static int        mcore_dllimport_p             (tree);
  const struct attribute_spec mcore_attribute_table[];
  static tree       mcore_handle_naked_attribute  (tree *, tree, tree, int, bool *);
  #ifdef OBJECT_FORMAT_ELF
  static void	  mcore_asm_named_section       (const char *,
! 						 unsigned int, tree);
  #endif
  static void       mcore_unique_section	        (tree, int);
  static void mcore_encode_section_info		(tree, rtx, int);
  static const char *mcore_strip_name_encoding	(const char *);
  static int        mcore_const_costs            	(rtx, RTX_CODE);
*************** mcore_naked_function_p (void)
*** 3422,3431 ****
    return lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)) != NULL_TREE;
  }
  
  #ifdef OBJECT_FORMAT_ELF
  static void
! mcore_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED)
  {
    fprintf (asm_out_file, "\t.section %s\n", name);
  }
  #endif /* OBJECT_FORMAT_ELF */
--- 3422,3433 ----
    return lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl)) != NULL_TREE;
  }
  
  #ifdef OBJECT_FORMAT_ELF
  static void
! mcore_asm_named_section (const char *name, 
! 			 unsigned int flags ATTRIBUTE_UNUSED,
! 			 tree decl ATTRIBUTE_UNUSED)
  {
    fprintf (asm_out_file, "\t.section %s\n", name);
  }
  #endif /* OBJECT_FORMAT_ELF */
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.336.4.5
diff -c -5 -p -r1.336.4.5 mips.c
*** config/mips/mips.c	16 Aug 2004 17:13:46 -0000	1.336.4.5
--- config/mips/mips.c	10 Sep 2004 18:49:57 -0000
*************** static void mips_init_libfuncs (void);
*** 287,297 ****
  static tree mips_build_builtin_va_list (void);
  
  #if TARGET_IRIX
  static void irix_asm_named_section_1 (const char *, unsigned int,
  				      unsigned int);
! static void irix_asm_named_section (const char *, unsigned int);
  static int irix_section_align_entry_eq (const void *, const void *);
  static hashval_t irix_section_align_entry_hash (const void *);
  static void irix_file_start (void);
  static int irix_section_align_1 (void **, void *);
  static void copy_file_data (FILE *, FILE *);
--- 287,297 ----
  static tree mips_build_builtin_va_list (void);
  
  #if TARGET_IRIX
  static void irix_asm_named_section_1 (const char *, unsigned int,
  				      unsigned int);
! static void irix_asm_named_section (const char *, unsigned int, tree);
  static int irix_section_align_entry_eq (const void *, const void *);
  static hashval_t irix_section_align_entry_hash (const void *);
  static void irix_file_start (void);
  static int irix_section_align_1 (void **, void *);
  static void copy_file_data (FILE *, FILE *);
*************** irix_asm_named_section_1 (const char *na
*** 9512,9527 ****
    fprintf (asm_out_file, "\t.section %s,%#x,%#x,%u,%u\n",
  	   name, sh_type, sh_flags, sh_entsize, align);
  }
  
  static void
! irix_asm_named_section (const char *name, unsigned int flags)
  {
    if (TARGET_SGI_O32_AS)
!     default_no_named_section (name, flags);
    else if (mips_abi == ABI_32 && TARGET_GAS)
!     default_elf_asm_named_section (name, flags);
    else
      irix_asm_named_section_1 (name, flags, 0);
  }
  
  /* In addition to emitting a .align directive, record the maximum
--- 9512,9527 ----
    fprintf (asm_out_file, "\t.section %s,%#x,%#x,%u,%u\n",
  	   name, sh_type, sh_flags, sh_entsize, align);
  }
  
  static void
! irix_asm_named_section (const char *name, unsigned int flags, tree decl)
  {
    if (TARGET_SGI_O32_AS)
!     default_no_named_section (name, flags, decl);
    else if (mips_abi == ABI_32 && TARGET_GAS)
!     default_elf_asm_named_section (name, flags, decl);
    else
      irix_asm_named_section_1 (name, flags, 0);
  }
  
  /* In addition to emitting a .align directive, record the maximum
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.536.2.6
diff -c -5 -p -r1.536.2.6 rs6000.c
*** config/rs6000/rs6000.c	16 Aug 2004 17:13:57 -0000	1.536.2.6
--- config/rs6000/rs6000.c	10 Sep 2004 18:49:57 -0000
*************** rs6000_xcoff_asm_globalize_label (FILE *
*** 15523,15533 ****
    RS6000_OUTPUT_BASENAME (stream, name);
    putc ('\n', stream);
  }
  
  static void
! rs6000_xcoff_asm_named_section (const char *name, unsigned int flags)
  {
    int smclass;
    static const char * const suffix[3] = { "PR", "RO", "RW" };
  
    if (flags & SECTION_CODE)
--- 15523,15534 ----
    RS6000_OUTPUT_BASENAME (stream, name);
    putc ('\n', stream);
  }
  
  static void
! rs6000_xcoff_asm_named_section (const char *name, unsigned int flags,
! 				tree decl ATTRIBUTE_UNUSED)
  {
    int smclass;
    static const char * const suffix[3] = { "PR", "RO", "RW" };
  
    if (flags & SECTION_CODE)
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.266.4.4
diff -c -5 -p -r1.266.4.4 sparc.c
*** config/sparc/sparc.c	16 Aug 2004 17:14:05 -0000	1.266.4.4
--- config/sparc/sparc.c	10 Sep 2004 18:49:57 -0000
*************** static void sparc_flat_save_restore (FIL
*** 161,171 ****
  				     const char *, const char *,
  				     HOST_WIDE_INT);
  static void sparc_nonflat_function_epilogue (FILE *, HOST_WIDE_INT, int);
  static void sparc_nonflat_function_prologue (FILE *, HOST_WIDE_INT, int);
  #ifdef OBJECT_FORMAT_ELF
! static void sparc_elf_asm_named_section (const char *, unsigned int);
  #endif
  static void sparc_aout_select_section (tree, int, unsigned HOST_WIDE_INT)
       ATTRIBUTE_UNUSED;
  static void sparc_aout_select_rtx_section (enum machine_mode, rtx,
  					   unsigned HOST_WIDE_INT)
--- 161,172 ----
  				     const char *, const char *,
  				     HOST_WIDE_INT);
  static void sparc_nonflat_function_epilogue (FILE *, HOST_WIDE_INT, int);
  static void sparc_nonflat_function_prologue (FILE *, HOST_WIDE_INT, int);
  #ifdef OBJECT_FORMAT_ELF
! static void sparc_elf_asm_named_section (const char *, unsigned int,
! 					 tree decl);
  #endif
  static void sparc_aout_select_section (tree, int, unsigned HOST_WIDE_INT)
       ATTRIBUTE_UNUSED;
  static void sparc_aout_select_rtx_section (enum machine_mode, rtx,
  					   unsigned HOST_WIDE_INT)
*************** sparc_profile_hook (int labelno)
*** 8685,8701 ****
    emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
  }
  
  #ifdef OBJECT_FORMAT_ELF
  static void
! sparc_elf_asm_named_section (const char *name, unsigned int flags)
  {
    if (flags & SECTION_MERGE)
      {
        /* entsize cannot be expressed in this section attributes
  	 encoding style.  */
!       default_elf_asm_named_section (name, flags);
        return;
      }
  
    fprintf (asm_out_file, "\t.section\t\"%s\"", name);
  
--- 8686,8703 ----
    emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lab, Pmode);
  }
  
  #ifdef OBJECT_FORMAT_ELF
  static void
! sparc_elf_asm_named_section (const char *name, unsigned int flags,
! 			     tree decl)
  {
    if (flags & SECTION_MERGE)
      {
        /* entsize cannot be expressed in this section attributes
  	 encoding style.  */
!       default_elf_asm_named_section (name, flags, decl);
        return;
      }
  
    fprintf (asm_out_file, "\t.section\t\"%s\"", name);
  
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.67.4.1
diff -c -5 -p -r1.67.4.1 cp-lang.c
*** cp/cp-lang.c	23 Dec 2003 22:09:08 -0000	1.67.4.1
--- cp/cp-lang.c	10 Sep 2004 18:49:57 -0000
*************** static void cxx_initialize_diagnostics (
*** 112,122 ****
  #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
  #undef LANG_HOOKS_WRITE_GLOBALS
  #define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
  #undef LANG_HOOKS_DECL_UNINIT
  #define LANG_HOOKS_DECL_UNINIT c_decl_uninit
! 
  
  #undef LANG_HOOKS_FUNCTION_INIT
  #define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
  #undef LANG_HOOKS_FUNCTION_FINAL
  #define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
--- 112,123 ----
  #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl
  #undef LANG_HOOKS_WRITE_GLOBALS
  #define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
  #undef LANG_HOOKS_DECL_UNINIT
  #define LANG_HOOKS_DECL_UNINIT c_decl_uninit
! #undef LANG_HOOKS_COMDAT_GROUP
! #define LANG_HOOKS_COMDAT_GROUP cxx_comdat_group
  
  #undef LANG_HOOKS_FUNCTION_INIT
  #define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
  #undef LANG_HOOKS_FUNCTION_FINAL
  #define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.930.2.9
diff -c -5 -p -r1.930.2.9 cp-tree.h
*** cp/cp-tree.h	31 Aug 2004 22:59:18 -0000	1.930.2.9
--- cp/cp-tree.h	10 Sep 2004 18:49:57 -0000
*************** extern void register_dtor_fn            
*** 3745,3754 ****
--- 3745,3755 ----
  extern tmpl_spec_kind current_tmpl_spec_kind    (int);
  extern tree cp_fname_init			(const char *, tree *);
  extern tree check_elaborated_type_specifier     (enum tag_types, tree, bool);
  extern tree cxx_builtin_type_decls              (void);
  extern void warn_extern_redeclared_static (tree, tree);
+ extern const char *cxx_comdat_group (tree);
  
  extern bool have_extern_spec;
  
  /* in decl2.c */
  extern bool check_java_method (tree);
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1150.2.11
diff -c -5 -p -r1.1150.2.11 decl.c
*** cp/decl.c	17 Aug 2004 19:39:18 -0000	1.1150.2.11
--- cp/decl.c	10 Sep 2004 18:49:59 -0000
*************** cp_missing_noreturn_ok_p (tree decl)
*** 11267,11273 ****
--- 11267,11293 ----
  {
    /* A missing noreturn is ok for the `main' function.  */
    return DECL_MAIN_P (decl);
  }
  
+ /* Return the COMDAT group into which DECL should be placed.  */
+ 
+ const char *
+ cxx_comdat_group (tree decl)
+ {
+   tree name;
+ 
+   /* Virtual tables, construction virtual tables, and virtual table
+      tables all go in a single COMDAT group, named after the primary
+      virtual table.  */
+   if (DECL_VTABLE_OR_VTT_P (decl))
+     name = DECL_ASSEMBLER_NAME (CLASSTYPE_VTABLES (DECL_CONTEXT (decl)));
+   /* For all other DECLs, the COMDAT group is the mangled name of the
+      declaration itself.  */
+   else
+     name = DECL_ASSEMBLER_NAME (decl);
+ 
+   return IDENTIFIER_POINTER (name);
+ }
+ 
  #include "gt-cp-decl.h"
  #include "gtype-cp.h"


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