summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/a29k/a29k.c12
-rw-r--r--gcc/config/a29k/a29k.h7
-rw-r--r--gcc/config/alpha/alpha.c56
-rw-r--r--gcc/config/alpha/elf.h67
-rw-r--r--gcc/config/alpha/vms.h26
-rw-r--r--gcc/config/arm/arm.c38
-rw-r--r--gcc/config/arm/coff.h17
-rw-r--r--gcc/config/arm/conix-elf.h18
-rw-r--r--gcc/config/arm/elf.h20
-rw-r--r--gcc/config/arm/linux-elf.h13
-rw-r--r--gcc/config/arm/pe.h27
-rw-r--r--gcc/config/arm/unknown-elf.h21
-rw-r--r--gcc/config/avr/avr-protos.h3
-rw-r--r--gcc/config/avr/avr.c17
-rw-r--r--gcc/config/avr/avr.h22
-rw-r--r--gcc/config/c4x/c4x.c11
-rw-r--r--gcc/config/c4x/c4x.h4
-rw-r--r--gcc/config/d30v/d30v.h38
-rw-r--r--gcc/config/elfos.h67
-rw-r--r--gcc/config/h8300/h8300.c12
-rw-r--r--gcc/config/h8300/h8300.h9
-rw-r--r--gcc/config/i386/cygwin.h63
-rw-r--r--gcc/config/i386/djgpp.h19
-rw-r--r--gcc/config/i386/i386-interix.h74
-rw-r--r--gcc/config/i386/i386-protos.h4
-rw-r--r--gcc/config/i386/i386.c41
-rw-r--r--gcc/config/i386/i386elf.h17
-rw-r--r--gcc/config/i386/sco5.h68
-rw-r--r--gcc/config/i386/win32.h27
-rw-r--r--gcc/config/i386/winnt.c96
-rw-r--r--gcc/config/ia64/ia64.h22
-rw-r--r--gcc/config/ia64/sysv4.h5
-rw-r--r--gcc/config/m68k/coff.h10
-rw-r--r--gcc/config/m68k/m68k.c20
-rw-r--r--gcc/config/m68k/rtemself.h3
-rw-r--r--gcc/config/m88k/m88k.h2
-rw-r--r--gcc/config/mcore/mcore-pe.h28
-rw-r--r--gcc/config/mcore/mcore.c12
-rw-r--r--gcc/config/mcore/mcore.h5
-rw-r--r--gcc/config/mips/elf.h23
-rw-r--r--gcc/config/mips/elf64.h23
-rw-r--r--gcc/config/mips/iris6.h37
-rw-r--r--gcc/config/mips/iris6gld.h2
-rw-r--r--gcc/config/mips/mips.c50
-rw-r--r--gcc/config/mips/mips.h6
-rw-r--r--gcc/config/mips/netbsd.h21
-rw-r--r--gcc/config/mips/openbsd.h20
-rw-r--r--gcc/config/nextstep.h5
-rw-r--r--gcc/config/pa/pa64-hpux.h66
-rw-r--r--gcc/config/psos.h9
-rw-r--r--gcc/config/rs6000/rs6000.c43
-rw-r--r--gcc/config/rs6000/sysv4.h57
-rw-r--r--gcc/config/rs6000/xcoff.h7
-rw-r--r--gcc/config/sh/elf.h2
-rw-r--r--gcc/config/sh/sh.c11
-rw-r--r--gcc/config/sh/sh.h9
-rw-r--r--gcc/config/sparc/sparc.c22
-rw-r--r--gcc/config/sparc/sysv4.h23
58 files changed, 512 insertions, 945 deletions
diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c
index 896f162fb7b..a4905e6597c 100644
--- a/gcc/config/a29k/a29k.c
+++ b/gcc/config/a29k/a29k.c
@@ -48,6 +48,8 @@ static void compute_regstack_size PARAMS ((void));
static void check_epilogue_internal_label PARAMS ((FILE *));
static void output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void a29k_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
#define min(A,B) ((A) < (B) ? (A) : (B))
@@ -1568,3 +1570,13 @@ output_function_epilogue (file, size)
free (a29k_first_epilogue_insn);
a29k_first_epilogue_insn = 0;
}
+
+static void
+a29k_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ /* ??? Is it really correct to mark all sections as "bss"? */
+ fprintf (asm_out_file, "\t.sect %s, bss\n\t.use %s\n", name, name);
+}
diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h
index 96d19ac6df4..8568d5e484d 100644
--- a/gcc/config/a29k/a29k.h
+++ b/gcc/config/a29k/a29k.h
@@ -1428,11 +1428,8 @@ literal_section () \
extern int a29k_debug_reg_map[];
#define DBX_REGISTER_NUMBER(REGNO) a29k_debug_reg_map[REGNO]
-/* This how to write an assembler directive to FILE to switch to
- section NAME for DECL. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf (FILE, "\t.sect %s, bss\n\t.use %s\n", NAME, NAME)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION a29k_asm_named_section
/* This is how to output the definition of a user-level label named NAME,
such as the label on a static function or variable NAME. */
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 2456e995977..345d95e2f6b 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -148,9 +148,14 @@ static void alpha_output_function_end_prologue
/* Initialize the GCC target structure. */
#if TARGET_ABI_OPEN_VMS
- static int vms_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
-# undef TARGET_VALID_DECL_ATTRIBUTE
-# define TARGET_VALID_DECL_ATTRIBUTE vms_valid_decl_attribute_p
+static int vms_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
+static unsigned int vms_section_type_flags PARAMS ((tree, const char *, int));
+static void vms_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
+# undef TARGET_VALID_DECL_ATTRIBUTE
+# define TARGET_VALID_DECL_ATTRIBUTE vms_valid_decl_attribute_p
+# undef TARGET_SECTION_TYPE_FLAGS
+# define TARGET_SECTION_TYPE_FLAGS vms_section_type_flags
#endif
#undef TARGET_ASM_FUNCTION_END_PROLOGUE
@@ -6535,6 +6540,51 @@ alpha_write_linkage (stream)
splay_tree_foreach (alpha_links, alpha_write_one_linkage, stream);
}
+/* Given a decl, a section name, and whether the decl initializer
+ has relocs, choose attributes for the section. */
+
+#define SECTION_VMS_OVERLAY SECTION_FORGET
+
+static unsigned int
+vms_section_type_flags (decl, name, reloc)
+ tree decl;
+ const char *name;
+ int reloc;
+{
+ unsigned int flags = default_section_type_flags (decl, name, reloc);
+
+ if (decl && DECL_MACHINE_ATTRIBUTES (decl)
+ && lookup_attribute ("overlaid", DECL_MACHINE_ATTRIBUTES (decl)))
+ flags |= SECTION_VMS_OVERLAY;
+
+ return flags;
+}
+
+/* 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 (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align;
+{
+ const char *flag_str = "";
+
+ if (flags & SECTION_VMS_OVERLAY)
+ flag_str = ",OVR";
+ else if (flags & SECTION_DEBUG)
+ flag_str = ",NOWRT";
+
+ fprintf (asm_out_file, ".section\t%s%s\n", name, flag_str);
+
+ /* ??? An indicated alignment of 1 byte is only used by dwarf,
+ and for that we turn off auto-alignment. */
+ if (align == 1)
+ ASM_OUTPUT_ALIGN (asm_out_file, 0);
+}
+
#else
rtx
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index dbec2b487f3..a8e89003be4 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -294,69 +294,8 @@ void FN () \
} \
}
-
-/* Switch into a generic section.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl.
-
- If the section has already been defined, we must not emit the
- attributes here. The SVR4 assembler does not recognize section
- redefinitions. If DECL is NULL, no attributes are emitted. */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- do \
- { \
- static htab_t htab; \
- \
- struct section_info \
- { \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- }; \
- \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- PTR* slot; \
- \
- /* The names we put in the hashtable will always be the unique \
- versions gived to us by the stringtable, so we can just use \
- their addresses as the keys. */ \
- if (!htab) \
- htab = htab_create (31, \
- htab_hash_pointer, \
- htab_eq_pointer, \
- NULL); \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- /* See if we already have an entry for this section. */ \
- slot = htab_find_slot (htab, NAME, INSERT); \
- if (!*slot) \
- { \
- s = (struct section_info *) xmalloc (sizeof (* s)); \
- s->type = type; \
- *slot = s; \
- fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
- NAME, mode); \
- } \
- else \
- { \
- s = (struct section_info *) *slot; \
- if (DECL && s->type != type) \
- error_with_decl (DECL, \
- "%s causes a section type conflict"); \
- \
- fprintf (FILE, "\t.section\t%s\n", NAME); \
- } \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* A C statement (sans semicolon) to output an element in the table of
global constructors. */
@@ -460,8 +399,6 @@ void FN () \
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
-
#undef UNIQUE_SECTION
#define UNIQUE_SECTION(DECL, RELOC) \
do \
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index d10a19df396..bc7e1e6afac 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -407,30 +407,8 @@ do { \
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
fprintf (FILE, "\t.align %d\n", LOG);
-#define ASM_OUTPUT_SECTION(FILE,SECTION) \
- (strcmp (SECTION, ".text") == 0) \
- ? text_section () \
- : named_section (NULL_TREE, SECTION, 0), \
- ASM_OUTPUT_ALIGN (FILE, 0) \
-
-#define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \
- do \
- { \
- const char *flags; \
- int ovr = 0; \
- if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \
- && lookup_attribute \
- ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \
- flags = ",OVR", ovr = 1; \
- else if (strncmp (NAME,".debug", 6) == 0) \
- flags = ",NOWRT"; \
- else \
- flags = ""; \
- fputc ('\n', (FILE)); \
- fprintf (FILE, ".section\t%s%s\n", NAME, flags); \
- if (ovr) \
- (NAME) = ""; \
- } while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do { literals_section(); \
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 35c520c31ec..b79a92bae90 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -114,6 +114,9 @@ static void thumb_output_function_prologue PARAMS ((FILE *,
HOST_WIDE_INT));
static int arm_comp_type_attributes PARAMS ((tree, tree));
static void arm_set_default_type_attributes PARAMS ((tree));
+static void arm_elf_asm_named_section PARAMS ((const char *,
+ unsigned int,
+ unsigned int));
#undef Hint
#undef Mmode
#undef Ulong
@@ -10632,3 +10635,38 @@ aof_dump_imports (f)
}
}
#endif /* AOF_ASSEMBLER */
+
+/* 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 (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ char flagchars[8], *f = flagchars;
+ const char *type;
+
+ if (!(flags & SECTION_DEBUG))
+ *f++ = 'a';
+ if (flags & SECTION_WRITE)
+ *f++ = 'w';
+ if (flags & SECTION_CODE)
+ *f++ = 'x';
+ if (flags & SECTION_SMALL)
+ *f++ = 's';
+ *f = '\0';
+
+ if (flags & SECTION_BSS)
+ type = "nobits";
+ else
+ type = "progbits";
+
+ fprintf (asm_out_file, "\t.section\t%s,\"%s\",%%%s\n",
+ name, flagchars, type);
+}
diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h
index eeea20b2a9d..11cb9bb1fca 100644
--- a/gcc/config/arm/coff.h
+++ b/gcc/config/arm/coff.h
@@ -64,21 +64,8 @@ Boston, MA 02111-1307, USA. */
} \
while (0)
-/* A C statement to output something to the assembler file to switch to
- section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_coff_asm_named_section
/* Support the ctors/dtors and other sections. */
diff --git a/gcc/config/arm/conix-elf.h b/gcc/config/arm/conix-elf.h
index a626af88fd8..f32228f6e88 100644
--- a/gcc/config/arm/conix-elf.h
+++ b/gcc/config/arm/conix-elf.h
@@ -83,28 +83,14 @@ func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }
asm (DTORS_SECTION_ASM_OP); \
func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* The ARM development system defines __main. */
#define NAME__MAIN "__gccmain"
#define SYMBOL__MAIN __gccmain
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#define UNIQUE_SECTION(DECL,RELOC) \
do \
{ \
diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h
index 2eb2388be8c..102b53ae0c7 100644
--- a/gcc/config/arm/elf.h
+++ b/gcc/config/arm/elf.h
@@ -299,23 +299,9 @@ dtors_section () \
}
#endif
-/* A C statement to output something to the assembler file to switch to
- section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL
- or NULL_TREE. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"ax\",%%progbits\n", NAME); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"a\"\n", NAME); \
- else if (! strncmp (NAME, ".bss", 4)) \
- fprintf (STREAM, "\t.section %s,\"aw\",%%nobits\n", NAME); \
- else \
- fprintf (STREAM, "\t.section %s,\"aw\"\n", NAME); \
- } \
- while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section
/* Support the ctors/dtors sections for g++. */
#ifndef INT_ASM_OP
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index 4940ae92a56..06519604ff0 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -132,15 +132,8 @@ const_section () \
} \
}
-/* Switch into a generic section.
- This is currently only used to support section attributes.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf (FILE, ".section\t%s,\"%s\",%%progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
@@ -171,8 +164,6 @@ const_section () \
}
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
-
#define UNIQUE_SECTION(DECL, RELOC) \
do \
{ \
diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h
index 82818861c19..6d4f61d942f 100644
--- a/gcc/config/arm/pe.h
+++ b/gcc/config/arm/pe.h
@@ -118,35 +118,12 @@ Boston, MA 02111-1307, USA. */
symbols must be explicitly imported from shared libraries (DLLs). */
#define MULTIPLE_SYMBOL_SPACES
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
-
#define UNIQUE_SECTION(DECL, RELOC) arm_pe_unique_section (DECL, RELOC)
#define SUPPORTS_ONE_ONLY 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. \
- Instead, have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
/* This outputs a lot of .req's to define alias for various registers.
Let's try to avoid this. */
diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
index fab8155f1ef..1eebb7b0801 100644
--- a/gcc/config/arm/unknown-elf.h
+++ b/gcc/config/arm/unknown-elf.h
@@ -85,23 +85,8 @@ rdata_section () \
asm (DTORS_SECTION_ASM_OP); \
func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \
- else if (! strncmp (NAME, ".bss", 4)) \
- fprintf (STREAM, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* The ARM development system defines __main. */
#define NAME__MAIN "__gccmain"
@@ -114,8 +99,6 @@ rdata_section () \
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
-
#define UNIQUE_SECTION(DECL, RELOC) \
do \
{ \
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 9d9839831b3..b6f4d74cb00 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -45,9 +45,6 @@ extern void asm_output_external PARAMS ((FILE *file, tree decl,
char *name));
extern void unique_section PARAMS ((tree decl, int reloc));
extern void encode_section_info PARAMS ((tree decl));
-extern void asm_output_section_name PARAMS ((FILE *file, tree decl,
- const char *name,
- int reloc));
extern int avr_progmem_p PARAMS ((tree decl));
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 605360a601b..6d11d058374 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -4556,23 +4556,6 @@ unique_section (decl, reloc)
}
-/* Output section name to file FILE
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-
-void
-asm_output_section_name(file, decl, name, reloc)
- FILE *file;
- tree decl;
- const char *name;
- int reloc ATTRIBUTE_UNUSED;
-{
- fprintf (file, ".section %s, \"%s\", @progbits\n", name,
- decl && TREE_CODE (decl) == FUNCTION_DECL ? "ax" :
- decl && TREE_READONLY (decl) ? "a" : "aw");
-}
-
-
/* The routine used to output NUL terminated strings. We use a special
version of this for most svr4 targets because doing so makes the
generated assembly code more compact (and thus faster to assemble)
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index dfb588231ec..5467fa41720 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -1956,12 +1956,6 @@ progmem_section (void) \
Decode SYM_NAME and store the real name part in VAR, sans the
characters that encode section info. Define this macro if
`ENCODE_SECTION_INFO' alters the symbol's name string. */
-/* `UNIQUE_SECTION_P (DECL)'
- A C expression which evaluates to true if DECL should be placed
- into a unique section for some target-specific reason. If you do
- not define this macro, the default is `0'. Note that the flag
- `-ffunction-sections' will also cause functions to be placed into
- unique sections. */
#define UNIQUE_SECTION(DECL, RELOC) unique_section (DECL, RELOC)
/* `UNIQUE_SECTION (DECL, RELOC)'
@@ -1971,7 +1965,6 @@ progmem_section (void) \
link-time relocations. If you do not define this macro, GNU CC
will use the symbol name prefixed by `.' as the section name. */
-
#define ASM_FILE_START(STREAM) asm_file_start (STREAM)
/* A C expression which outputs to the stdio stream STREAM some
appropriate text to go at the start of an assembler file.
@@ -2022,19 +2015,8 @@ progmem_section (void) \
This macro need not be defined if the standard form of debugging
information for the debugger in use is appropriate. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- asm_output_section_name(FILE, DECL, NAME, RELOC)
-
-/* `ASM_OUTPUT_SECTION_NAME (STREAM, DECL, NAME, RELOC)'
- A C statement to output something to the assembler file to switch
- to section NAME for object DECL which is either a `FUNCTION_DECL',
- a `VAR_DECL' or `NULL_TREE'. RELOC indicates whether the initial
- value of EXP requires link-time relocations. Some target formats
- do not support arbitrary sections. Do not define this macro in
- such cases.
-
- At present this macro is only used to support section attributes.
- When this macro is undefined, section attributes are disabled. */
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
#define OBJC_PROLOGUE {}
/* A C statement to output any assembler statements which are
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index 02a3dcd22a7..da2f90d895c 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -191,6 +191,8 @@ static int c4x_rptb_valid_p PARAMS ((rtx, rtx));
static int c4x_label_ref_used_p PARAMS ((rtx, rtx));
static int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
static void c4x_insert_attributes PARAMS ((tree, tree *));
+static void c4x_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
/* Initialize the GCC target structure. */
#undef TARGET_VALID_TYPE_ATTRIBUTE
@@ -5177,3 +5179,12 @@ c4x_expand_builtin (exp, target, subtarget, mode, ignore)
}
return NULL_RTX;
}
+
+static void
+c4x_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
+}
diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h
index 102346f6a04..dba5e478073 100644
--- a/gcc/config/c4x/c4x.h
+++ b/gcc/config/c4x/c4x.h
@@ -2087,8 +2087,8 @@ dtors_section () \
} \
}
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf (FILE, "\t.sect\t\"%s\"\n", NAME);
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION c4x_asm_named_section
/* This is machine-dependent because it needs to push something
on the stack. */
diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h
index 5e0f0b0a02b..2b1321b4ca9 100644
--- a/gcc/config/d30v/d30v.h
+++ b/gcc/config/d30v/d30v.h
@@ -3760,16 +3760,6 @@ extern const char *d30v_branch_cost_string;
the symbol's name string. */
/* #define STRIP_NAME_ENCODING(VAR, SYM_NAME) */
-/* A C expression which evaluates to true if DECL should be placed
- into a unique section for some target-specific reason. If you do
- not define this macro, the default is `0'. Note that the flag
- `-ffunction-sections' will also cause functions to be placed into
- unique sections.
-
- Defined in svr4.h. */
-/* #define UNIQUE_SECTION_P(DECL) */
-
-/* A C statement to build up a unique section name, expressed as a
STRING_CST node, and assign it to `DECL_SECTION_NAME (DECL)'.
RELOC indicates whether the initial value of EXP requires
link-time relocations. If you do not define this macro, GNU CC
@@ -3888,17 +3878,6 @@ extern const char *d30v_branch_cost_string;
Defined in svr4.h. */
/* #define ASM_OUTPUT_IDENT(STREAM, STRING) */
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a `FUNCTION_DECL', a `VAR_DECL' or
- `NULL_TREE'. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases.
-
- At present this macro is only used to support section attributes. When this
- macro is undefined, section attributes are disabled.
-
- Defined in svr4.h. */
-/* #define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME) */
-
/* A C statement to output any assembler statements which are required to
precede any Objective C object definitions or message sending. The
statement is executed only when compiling an Objective C program. */
@@ -4852,23 +4831,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE)
This macro need not be defined on most platforms. */
/* #define ASM_OUTPUT_EH_REGION_END() */
-/* A C expression to switch to the section in which the main exception table is
- to be placed (*note Sections::.). The default is a section named
- `.gcc_except_table' on machines that support named sections via
- `ASM_OUTPUT_SECTION_NAME', otherwise if `-fpic' or `-fPIC' is in effect, the
- `data_section', otherwise the `readonly_data_section'. */
-/* #define EXCEPTION_SECTION() */
-
-/* If defined, a C string constant for the assembler operation to switch to the
- section for exception handling frame unwind information. If not defined,
- GNU CC will provide a default definition if the target supports named
- sections. `crtstuff.c' uses this macro to switch to the appropriate
- section.
-
- You should define this symbol if your target supports DWARF 2 frame unwind
- information and the default definition does not work. */
-/* #define EH_FRAME_SECTION_ASM_OP */
-
/* A C expression that is nonzero if the normal exception table output should
be omitted.
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index eef41150047..82dde08c758 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -338,8 +338,6 @@ dtors_section () \
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
-
#define UNIQUE_SECTION(DECL, RELOC) \
do \
{ \
@@ -403,69 +401,8 @@ dtors_section () \
} \
while (0)
-/* Switch into a generic section.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl.
-
- If the section has already been defined, we must not
- emit the attributes here. The SVR4 assembler does not
- recognize section redefinitions.
- If DECL is NULL, no attributes are emitted. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- do \
- { \
- static htab_t htab; \
- \
- struct section_info \
- { \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- }; \
- \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- PTR* slot; \
- \
- /* The names we put in the hashtable will always be the unique \
- versions gived to us by the stringtable, so we can just use \
- their addresses as the keys. */ \
- if (!htab) \
- htab = htab_create (31, \
- htab_hash_pointer, \
- htab_eq_pointer, \
- NULL); \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- \
- /* See if we already have an entry for this section. */ \
- slot = htab_find_slot (htab, NAME, INSERT); \
- if (!*slot) \
- { \
- s = (struct section_info *) xmalloc (sizeof (* s)); \
- s->type = type; \
- *slot = s; \
- fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
- NAME, mode); \
- } \
- else \
- { \
- s = (struct section_info *) *slot; \
- if (DECL && s->type != type) \
- error_with_decl (DECL, \
- "%s causes a section type conflict"); \
- \
- fprintf (FILE, "\t.section\t%s\n", NAME); \
- } \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* A C statement or statements to switch to the appropriate
section for output of RTX in mode MODE. RTX is some kind
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 46282086de7..55aef3876f7 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -56,6 +56,8 @@ static const char *cond_string PARAMS ((enum rtx_code));
static int h8300_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
static void h8300_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void h8300_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void h8300_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
/* CPU_TYPE, says what cpu we're compiling for. */
int cpu_type;
@@ -3325,3 +3327,13 @@ h8300_adjust_insn_length (insn, length)
return 0;
}
+
+static void
+h8300_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ /* ??? Perhaps we should be using default_coff_asm_named_section. */
+ fprintf (asm_out_file, "\t.section %s\n", name);
+}
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 96fbbbb0fe5..f419ba4b1d0 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -1225,13 +1225,8 @@ readonly_data () \
fprintf (FILE, \
"\t.text\n.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO)
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf (FILE, "\t.section %s\n", NAME)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION h8300_asm_named_section
/* This is how to output the definition of a user-level label named NAME,
such as the label on a static function or variable NAME. */
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 6e76f1c7bec..9ea367f3a8f 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -407,69 +407,16 @@ do { \
symbols must be explicitly imported from shared libraries (DLLs). */
#define MULTIPLE_SYMBOL_SPACES
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
extern void i386_pe_unique_section PARAMS ((TREE, int));
#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
#define SUPPORTS_ONE_ONLY 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "x"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = ""; \
- else \
- { \
- type = SECT_RW; \
- if (DECL && TREE_CODE (DECL) == VAR_DECL \
- && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (DECL))) \
- mode = "ws"; \
- else \
- mode = "w"; \
- } \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. Instead, \
- have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
- } \
- else \
- { \
- fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
- } \
-} while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
+
+/* Select attributes for named sections. */
+#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
/* Write the extra assembler code needed to declare a function
properly. If we are generating SDB debugging information, this
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index 14a43570e75..f5e79c2ba0f 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -57,10 +57,6 @@ Boston, MA 02111-1307, USA. */
#undef DTORS_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP "\t.section .dtor"
-/* Define the name of the .eh_frame section. */
-#undef EH_FRAME_SECTION_ASM_OP
-#define EH_FRAME_SECTION_ASM_OP "\t.section .eh_frame"
-
/* Define the name of the .ident op. */
#undef IDENT_ASM_OP
#define IDENT_ASM_OP "\t.ident\t"
@@ -189,14 +185,8 @@ dtor_section () \
fprintf (FILE, "\n"); \
} while (0)
-/* Tell GCC how to output a section name. Add "x" for code sections. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
- do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf ((FILE), "\t.section %s,\"x\"\n", (NAME)); \
- else \
- fprintf ((FILE), "\t.section %s\n", (NAME)); \
- } while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_coff_asm_named_section
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
do { \
@@ -287,11 +277,6 @@ while (0)
#undef MAKE_DECL_ONE_ONLY
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-/* Additional support for C++ templates and support for
- garbage collection. */
-#undef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
-
#undef UNIQUE_SECTION
#define UNIQUE_SECTION(DECL,RELOC) \
do { \
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index 0460b64b07b..864f5200c7c 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -341,26 +341,6 @@ dtors_section () \
} \
}
-#if 0
-/* Currently gas chokes on this; that's not too hard to fix, but there's
- not a lot of impeteus to do it, either. If it is done, gas will have
- to handle long section name escapes (which are defined in the COFF/PE
- document as /nnn where nnn is a string table index). The benefit:
- section attributes and -ffunction-sections, neither of which seem to
- be critical. */
-/* gas may have been fixed? bfd was. */
-
-/* Switch into a generic section.
- This is currently only used to support section attributes.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && TREE_READONLY (DECL) ? "a" : "aw")
-#endif
-
/* The MS compilers take alignment as a number of bytes, so we do as well */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
@@ -505,63 +485,13 @@ do { \
symbols must be explicitly imported from shared libraries (DLLs). */
#define MULTIPLE_SYMBOL_SPACES
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
extern void i386_pe_unique_section ();
#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
#define SUPPORTS_ONE_ONLY 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "x"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = "r"; \
- else \
- type = SECT_RW, mode = "w"; \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. Instead, \
- have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
- } \
- else \
- { \
- fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
- } \
-} while (0)
-
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
#endif /* 0 */
/* DWARF2 Unwinding doesn't work with exception handling yet. */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5b9e9792e1f..e263116ace3 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -181,4 +181,8 @@ extern int ix86_constant_alignment PARAMS ((tree, int));
extern int ix86_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
extern int i386_pe_valid_decl_attribute_p PARAMS ((tree, tree, tree, tree));
extern int i386_pe_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
+extern unsigned int i386_pe_section_type_flags PARAMS ((tree, const char *,
+ int));
+extern void i386_pe_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
#endif
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9017207e292..2547ea40a53 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -608,6 +608,11 @@ static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code));
static int ix86_save_reg PARAMS ((int, int));
static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));
static int ix86_comp_type_attributes PARAMS ((tree, tree));
+
+#if defined(TARGET_ELF) && defined(TARGET_COFF)
+static void sco_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
+#endif
/* Initialize the GCC target structure. */
#undef TARGET_VALID_TYPE_ATTRIBUTE
@@ -2323,7 +2328,7 @@ ix86_asm_file_end (file)
/* ??? Binutils 2.10 and earlier has a linkonce elimination bug related
to updating relocations to a section being discarded such that this
doesn't work. Ought to detect this at configure time. */
-#if 0 && defined (ASM_OUTPUT_SECTION_NAME)
+#if 0
/* The trick here is to create a linkonce section containing the
pic label thunk, but to refer to it with an internal label.
Because the label is internal, we don't have inter-dso name
@@ -2331,16 +2336,18 @@ ix86_asm_file_end (file)
In order to use these macros, however, we must create a fake
function decl. */
- {
- tree decl = build_decl (FUNCTION_DECL,
- get_identifier ("i686.get_pc_thunk"),
- error_mark_node);
- DECL_ONE_ONLY (decl) = 1;
- UNIQUE_SECTION (decl, 0);
- named_section (decl, NULL, 0);
- }
+ if (targetm.have_named_sections)
+ {
+ tree decl = build_decl (FUNCTION_DECL,
+ get_identifier ("i686.get_pc_thunk"),
+ error_mark_node);
+ DECL_ONE_ONLY (decl) = 1;
+ UNIQUE_SECTION (decl, 0);
+ named_section (decl, NULL, 0);
+ }
+ else
#else
- text_section ();
+ text_section ();
#endif
/* This used to call ASM_DECLARE_FUNCTION_NAME() but since it's an
@@ -10822,3 +10829,17 @@ ix86_output_main_function_alignment_hack (file, size)
fprintf (file, "\tret\n");
ASM_OUTPUT_INTERNAL_LABEL (file, "L", CODE_LABEL_NUMBER (label));
}
+
+#if defined(TARGET_ELF) && defined(TARGET_COFF)
+static void
+sco_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align;
+{
+ if (TARGET_ELF)
+ default_elf_asm_named_section (name, flags, align);
+ else
+ default_coff_asm_named_section (name, flags, align);
+}
+#endif
diff --git a/gcc/config/i386/i386elf.h b/gcc/config/i386/i386elf.h
index 1d7d4b7e650..c2c5cff7513 100644
--- a/gcc/config/i386/i386elf.h
+++ b/gcc/config/i386/i386elf.h
@@ -170,21 +170,8 @@ do { long value[3]; \
#define LOCAL_LABEL_PREFIX "."
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (FILE, ".section\t%s,\"ax\"\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (FILE, ".section\t%s,\"a\"\n", (NAME)); \
- else \
- fprintf (FILE, ".section\t%s,\"aw\"\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* If defined, a C expression whose value is a string containing the
assembler operation to identify the following data as
diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h
index 2477b6a0cdc..b7a7cdbfd29 100644
--- a/gcc/config/i386/sco5.h
+++ b/gcc/config/i386/sco5.h
@@ -75,10 +75,10 @@ Boston, MA 02111-1307, USA. */
#define GLOBAL_ASM_OP "\t.globl\t"
#undef EH_FRAME_SECTION_ASM_OP
-#define EH_FRAME_SECTION_ASM_OP_COFF "\t.section\t.ehfram, \"x\""
-#define EH_FRAME_SECTION_ASM_OP_ELF "\t.section\t.eh_frame, \"aw\""
-#define EH_FRAME_SECTION_ASM_OP \
- ((TARGET_ELF) ? EH_FRAME_SECTION_ASM_OP_ELF : EH_FRAME_SECTION_ASM_OP_COFF)
+#define EH_FRAME_SECTION_NAME_COFF ".ehfram"
+#define EH_FRAME_SECTION_NAME_ELF ".eh_frame"
+#define EH_FRAME_SECTION_NAME \
+ ((TARGET_ELF) ? EH_FRAME_SECTION_NAME_ELF : EH_FRAME_SECTION_NAME_COFF)
/* Avoid problems (long sectino names, forward assembler refs) with DWARF
exception unwinding when we're generating COFF */
@@ -444,56 +444,14 @@ do { \
#define USER_LABEL_PREFIX ""
/*
- * Compensate for the difference between ELF and COFF assembler syntax.
- * Otherwise, this is cribbed from ../svr4.h.
* We rename 'gcc_except_table' to the shorter name in preparation
- * for the day when we're ready to do DWARF2 eh unwinding under COFF
+ * for the day when we're ready to do DWARF2 eh unwinding under COFF.
*/
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- const char *sname = NAME ; \
- if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ; \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode, \
- (TARGET_ELF) ? ",@progbits" : "" ); \
- } \
- else \
- { \
- if (DECL && s->type != type) \
- error_with_decl (DECL, "%s causes a section type conflict"); \
- \
- fprintf (FILE, ".section\t%s\n", sname); \
- } \
-} while (0)
+#define EXCEPTION_SECTION() named_section (NULL, ".gccexc", 1)
+
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION sco_asm_named_section
#undef ASM_OUTPUT_SKIP
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
@@ -925,7 +883,7 @@ compiler at the end of the day. Onward we go ...
# undef FINI_SECTION_ASM_OP
# undef CTORS_SECTION_ASM_OP
# undef DTORS_SECTION_ASM_OP
-# undef EH_FRAME_SECTION_ASM_OP
+# undef EH_FRAME_SECTION_NAME
# undef CTOR_LIST_BEGIN
# undef CTOR_LIST_END
# undef DO_GLOBAL_CTORS_BODY
@@ -936,13 +894,13 @@ compiler at the end of the day. Onward we go ...
# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF
# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF
# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF
-# define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_ELF
+# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF
# else /* ! _SCO_ELF */
# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF
# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF
# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF
# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF
-# define EH_FRAME_SECTION_ASM_OP EH_FRAME_SECTION_ASM_OP_COFF
+# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF
# define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0")
# define CTOR_LIST_END CTOR_LIST_BEGIN
# define DO_GLOBAL_CTORS_BODY \
diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h
index 24d8e2d278d..7e03383f29f 100644
--- a/gcc/config/i386/win32.h
+++ b/gcc/config/i386/win32.h
@@ -233,33 +233,16 @@ do { \
symbols must be explicitly imported from shared libraries (DLLs). */
#define MULTIPLE_SYMBOL_SPACES
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
extern void i386_pe_unique_section ();
#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC)
#define SUPPORTS_ONE_ONLY 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. Instead, \
- have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
-} while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
+
+/* Select attributes for named sections. */
+#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
#undef ASM_COMMENT_START
#define ASM_COMMENT_START " #"
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 2d85b66930e..ff13c3863b7 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */
#include "flags.h"
#include "tm_p.h"
#include "toplev.h"
+#include "hashtab.h"
/* i386/PE specific attribute support.
@@ -55,7 +56,7 @@ void i386_pe_mark_dllimport PARAMS ((tree));
int
i386_pe_valid_decl_attribute_p (decl, attributes, attr, args)
tree decl;
- tree attributes;
+ tree attributes ATTRIBUTE_UNUSED;
tree attr;
tree args;
{
@@ -455,6 +456,99 @@ i386_pe_unique_section (decl, reloc)
DECL_SECTION_NAME (decl) = build_string (len, string);
}
+
+/* Select a set of attributes for section NAME based on the properties
+ of DECL and whether or not RELOC indicates that DECL's initializer
+ might contain runtime relocations.
+
+ We make the section read-only and executable for a function decl,
+ read-only for a const data decl, and writable for a non-const data decl.
+
+ If the section has already been defined, to not allow it to have
+ different attributes, as (1) this is ambiguous since we're not seeing
+ all the declarations up front and (2) some assemblers (e.g. SVR4)
+ do not recoginize section redefinitions. */
+/* ??? This differs from the "standard" PE implementation in that we
+ handle the SHARED variable attribute. Should this be done for all
+ PE targets? */
+
+#define SECTION_PE_SHARED SECTION_MACH_DEP
+
+unsigned int
+i386_pe_section_type_flags (decl, name, reloc)
+ tree decl;
+ const char *name;
+ int reloc;
+{
+ static htab_t htab;
+ unsigned int flags;
+ unsigned int **slot;
+
+ /* The names we put in the hashtable will always be the unique
+ versions gived to us by the stringtable, so we can just use
+ their addresses as the keys. */
+ if (!htab)
+ htab = htab_create (31, htab_hash_pointer, htab_eq_pointer, NULL);
+
+ if (decl && TREE_CODE (decl) == FUNCTION_DECL)
+ flags = SECTION_CODE;
+ else if (decl && DECL_READONLY_SECTION (decl, reloc))
+ flags = 0;
+ else
+ {
+ flags = SECTION_WRITE;
+
+ if (decl && TREE_CODE (decl) == VAR_DECL
+ && lookup_attribute ("shared", DECL_MACHINE_ATTRIBUTES (decl)))
+ flags |= SECTION_PE_SHARED;
+ }
+
+ if (decl && DECL_ONE_ONLY (decl))
+ flags |= SECTION_LINKONCE;
+
+ /* See if we already have an entry for this section. */
+ slot = (unsigned int **) htab_find_slot (htab, name, INSERT);
+ if (!*slot)
+ {
+ *slot = (unsigned int *) xmalloc (sizeof (unsigned int));
+ **slot = flags;
+ }
+ else
+ {
+ if (decl && **slot != flags)
+ error_with_decl (decl, "%s causes a section type conflict");
+ }
+
+ return flags;
+}
+
+void
+i386_pe_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ char flagchars[8], *f = flagchars;
+
+ if (flags & SECTION_CODE)
+ *f++ = 'x';
+ if (flags & SECTION_WRITE)
+ *f++ = 'w';
+ if (flags & SECTION_PE_SHARED)
+ *f++ = 's';
+ *f = '\0';
+
+ fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
+
+ if (flags & SECTION_LINKONCE)
+ {
+ /* Functions may have been compiled at various levels of
+ optimization so we can't use `same_size' here.
+ Instead, have the linker pick one. */
+ fprintf (asm_out_file, "\t.linkonce %s\n",
+ (flags & SECTION_CODE ? "discard" : "same_size"));
+ }
+}
/* The Microsoft linker requires that every function be marked as
DT_FCN. When using gas on cygwin, we must emit appropriate .type
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 0df4ceb8b18..b5fe7ef88a5 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -2454,16 +2454,6 @@ do { \
/* Assembler Commands for Exception Regions. */
-/* If defined, a C string constant for the assembler operation to switch to the
- section for exception handling frame unwind information. If not defined,
- GNU CC will provide a default definition if the target supports named
- sections. `crtstuff.c' uses this macro to switch to the appropriate
- section.
-
- You should define this symbol if your target supports DWARF 2 frame unwind
- information and the default definition does not work. */
-#define EH_FRAME_SECTION_ASM_OP "\t.section\t.IA_64.unwind,\"aw\""
-
/* Select a format to encode pointers in exception handling data. CODE
is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
true if the symbol may be affected by dynamic relocations. */
@@ -2551,18 +2541,6 @@ do { \
#define DWARF2_DEBUGGING_INFO
-/* Section names for DWARF2 debug info. */
-
-#define DEBUG_INFO_SECTION ".debug_info, \"\", \"progbits\""
-#define DEBUG_ABBREV_SECTION ".debug_abbrev, \"\", \"progbits\""
-#define DEBUG_ARANGES_SECTION ".debug_aranges, \"\", \"progbits\""
-#define DEBUG_MACINFO_SECTION ".debug_macinfo, \"\", \"progbits\""
-#define DEBUG_LINE_SECTION ".debug_line, \"\", \"progbits\""
-#define DEBUG_LOC_SECTION ".debug_loc, \"\", \"progbits\""
-#define DEBUG_PUBNAMES_SECTION ".debug_pubnames, \"\", \"progbits\""
-#define DEBUG_STR_SECTION ".debug_str, \"\", \"progbits\""
-#define DEBUG_RANGES_SECTION ".debug_ranges, \"\", \"progbits\""
-
/* C string constants giving the pseudo-op to use for a sequence of
2, 4, and 8 byte unaligned constants. dwarf2out.c needs these. */
diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h
index de39c1ebc5f..ea9eb2f7014 100644
--- a/gcc/config/ia64/sysv4.h
+++ b/gcc/config/ia64/sysv4.h
@@ -47,11 +47,6 @@ do { \
ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1); \
} while (0)
-/* ??? Intel assembler does not allow "." in section names, so turn off
- gnu.linkonce section support, but only when using the Intel assembler. */
-#undef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (TARGET_GNU_AS ? DECL_ONE_ONLY (DECL) : 0)
-
/* The # tells the Intel assembler that this is not a register name.
However, we can't emit the # in a label definition, so we set a variable
in ASM_OUTPUT_LABEL to control whether we want the postfix here or not.
diff --git a/gcc/config/m68k/coff.h b/gcc/config/m68k/coff.h
index 4565f77fbec..8a63c6ca5ba 100644
--- a/gcc/config/m68k/coff.h
+++ b/gcc/config/m68k/coff.h
@@ -100,13 +100,9 @@ Boston, MA 02111-1307, USA. */
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
-/* Support generic sections */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf((FILE), ".section\t%s,\"%c\"\n", (NAME), \
- (DECL) && (TREE_CODE (DECL) == FUNCTION_DECL || \
- DECL_READONLY_SECTION (DECL, RELOC)) ? 'x' : 'd')
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION m68k_coff_asm_named_section
/* Support the ctors and dtors sections for g++. */
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 46aeea02e7d..b18c07cd089 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -60,6 +60,8 @@ static rtx find_addr_reg PARAMS ((rtx));
static const char *singlemove_string PARAMS ((rtx *));
static void m68k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void m68k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
/* Alignment to use for loops and jumps */
@@ -4208,3 +4210,21 @@ output_xorsi3 (operands)
}
return "eor%.l %2,%0";
}
+
+/* Output assembly to switch to section NAME with attribute FLAGS. */
+
+static void
+m68k_coff_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ char flagchar;
+
+ if (flags & SECTION_WRITE)
+ flagchar = 'd';
+ else
+ flagchar = 'x';
+
+ fprintf (asm_out_file, "\t.section\t%s,\"%c\"\n", name, flagchar);
+}
diff --git a/gcc/config/m68k/rtemself.h b/gcc/config/m68k/rtemself.h
index 6a06d35acce..a8b32e6e90d 100644
--- a/gcc/config/m68k/rtemself.h
+++ b/gcc/config/m68k/rtemself.h
@@ -58,9 +58,6 @@ Boston, MA 02111-1307, USA. */
#undef FINI_SECTION_ASM_OP
#define FINI_SECTION_ASM_OP "\t.section\t.fini"
-#undef EH_FRAME_SECTION_ASM_OP
-#define EH_FRAME_SECTION_ASM_OP "\t.section\t.eh_frame"
-
/* Do I need this? */
#undef INVOKE__main
diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h
index 2be34328f14..81358f717bf 100644
--- a/gcc/config/m88k/m88k.h
+++ b/gcc/config/m88k/m88k.h
@@ -1673,7 +1673,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
#undef CONST_SECTION_ASM_OP
#undef CTORS_SECTION_ASM_OP
#undef DTORS_SECTION_ASM_OP
-#undef ASM_OUTPUT_SECTION_NAME
+#undef TARGET_ASM_NAMED_SECTION
#undef INIT_SECTION_ASM_OP
#undef FINI_SECTION_ASM_OP
#undef TYPE_ASM_OP
diff --git a/gcc/config/mcore/mcore-pe.h b/gcc/config/mcore/mcore-pe.h
index 417271d21f2..2d0c195549a 100644
--- a/gcc/config/mcore/mcore-pe.h
+++ b/gcc/config/mcore/mcore-pe.h
@@ -221,30 +221,8 @@ rdata_section () \
#undef DO_GLOBAL_DTORS_BODY
#undef INIT_SECTION_ASM_OP
-#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL)
-
#define SUPPORTS_ONE_ONLY 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
- do \
- { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", NAME); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", NAME); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", NAME); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. \
- Instead, have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
- } \
- while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index e1f0f3382e4..778b734be35 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -132,6 +132,9 @@ static int mcore_dllexport_p PARAMS ((tree));
static int mcore_dllimport_p PARAMS ((tree));
static int mcore_valid_decl_attribute PARAMS ((tree, tree,
tree, tree));
+static void mcore_asm_named_section PARAMS ((const char *,
+ unsigned int,
+ unsigned int));
/* Initialize the GCC target structure. */
#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -3594,3 +3597,12 @@ mcore_naked_function_p ()
{
return lookup_attribute ("naked", DECL_MACHINE_ATTRIBUTES (current_function_decl)) != NULL_TREE;
}
+
+static void
+mcore_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file, "\t.section %s\n", name);
+}
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index fecb9d8b4cf..3cd595efb36 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -1137,9 +1137,8 @@ switch_to_section (section, decl) \
} \
}
-
-#define ASM_OUTPUT_SECTION(file, nam) \
- do { fprintf (file, "\t.section\t%s\n", nam); } while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION mcore_asm_named_section
/* This is how to output an insn to push a register on the stack.
It need not be very fast code. */
diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h
index 34d26c773da..3ef9020c28a 100644
--- a/gcc/config/mips/elf.h
+++ b/gcc/config/mips/elf.h
@@ -56,24 +56,9 @@ do { \
#undef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT (32768*8)
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else if (! strcmp (NAME, ".bss")) \
- fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
@@ -211,8 +196,6 @@ do { \
} while (0)
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#undef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#undef UNIQUE_SECTION
#define UNIQUE_SECTION(DECL,RELOC) \
do { \
diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h
index 0636200ed4b..782c62bad8d 100644
--- a/gcc/config/mips/elf64.h
+++ b/gcc/config/mips/elf64.h
@@ -73,24 +73,9 @@ do { \
fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a)); \
} while (0)
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else if (! strcmp (NAME, ".bss")) \
- fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* The following macro defines the format used to output the second
operand of the .type assembler directive. Different svr4 assemblers
@@ -192,8 +177,6 @@ do { \
} while (0)
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#undef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#undef UNIQUE_SECTION
#define UNIQUE_SECTION(DECL,RELOC) \
do { \
diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h
index 62ddc19b0cd..4e3a227638a 100644
--- a/gcc/config/mips/iris6.h
+++ b/gcc/config/mips/iris6.h
@@ -217,19 +217,6 @@ Boston, MA 02111-1307, USA. */
#define POPSECTION_ASM_OP "\t.popsection"
-#define DEBUG_INFO_SECTION ".debug_info,0x7000001e,0,0,1"
-#define DEBUG_LINE_SECTION ".debug_line,0x7000001e,0,0,1"
-#define DEBUG_SFNAMES_SECTION ".debug_sfnames,0x7000001e,0,0,1"
-#define DEBUG_SRCINFO_SECTION ".debug_srcinfo,0x7000001e,0,0,1"
-#define DEBUG_MACINFO_SECTION ".debug_macinfo,0x7000001e,0,0,1"
-#define DEBUG_PUBNAMES_SECTION ".debug_pubnames,0x7000001e,0,0,1"
-#define DEBUG_ARANGES_SECTION ".debug_aranges,0x7000001e,0,0,1"
-#define DEBUG_FRAME_SECTION ".debug_frame,0x7000001e,0x08000000,0,1"
-#define DEBUG_ABBREV_SECTION ".debug_abbrev,0x7000001e,0,0,1"
-#define DEBUG_LOC_SECTION ".debug_loc,0x7000001e,0,0,1"
-#define DEBUG_STR_SECTION ".debug_str,0x7000001e,0,0,1"
-#define DEBUG_RANGES_SECTION ".debug_ranges,0x7000001e,0,0,1"
-
/* ??? If no mabi=X option give, but a mipsX option is, then should depend
on the mipsX option. */
/* If no mips[3,4] option given, give the appropriate default for mabi=X */
@@ -278,12 +265,9 @@ Boston, MA 02111-1307, USA. */
#if _MIPS_SZPTR == 64
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,1,2,0,8"
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,1,2,0,8"
-#define EH_FRAME_SECTION_ASM_OP "\t.section\t.eh_frame,1,2,0,8"
#else /* _MIPS_SZPTR != 64 */
#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,1,2,0,4"
#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,1,2,0,4"
-#define EH_FRAME_SECTION_ASM_OP "\t.section\t.eh_frame,1,2,0,4"
-
#endif /* _MIPS_SZPTR == 64 */
#else /* ! (defined (CRT_BEGIN) || defined (CRT_END)) */
@@ -293,8 +277,6 @@ Boston, MA 02111-1307, USA. */
(Pmode == DImode ? "\t.section\t.ctors,1,2,0,8" : "\t.section\t.ctors,1,2,0,4")
#define DTORS_SECTION_ASM_OP \
(Pmode == DImode ? "\t.section\t.dtors,1,2,0,8" : "\t.section\t.dtors,1,2,0,4")
-#define EH_FRAME_SECTION_ASM_OP \
- (Pmode == DImode ? "\t.section\t.eh_frame,1,2,0,8" : "\t.section\t.eh_frame,1,2,0,4")
#endif /* defined (CRT_BEGIN) || defined (CRT_END) */
/* A default list of other sections which we might be "in" at any given
@@ -382,22 +364,9 @@ dtors_section () \
fprintf (FILE, "\n"); \
} while (0)
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. */
-
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,1,6,4,4\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,1,2,0,8\n", (NAME)); \
- else if (! strcmp (NAME, ".bss")) \
- fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,1,3,0,8\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION iris6_asm_named_section
/* Stuff for constructors. End here. */
diff --git a/gcc/config/mips/iris6gld.h b/gcc/config/mips/iris6gld.h
index 76559e372ca..409af7d0ff4 100644
--- a/gcc/config/mips/iris6gld.h
+++ b/gcc/config/mips/iris6gld.h
@@ -49,8 +49,6 @@ Boston, MA 02111-1307, USA. */
/* The GNU linker supports one-only sections. */
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#undef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#define UNIQUE_SECTION(DECL, RELOC) \
do \
{ \
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index fc181f64e06..be0033a9fb1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -110,7 +110,9 @@ static void mips_add_gc_roots PARAMS ((void));
static void mips_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void mips_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static enum processor_type mips_parse_cpu PARAMS ((const char *));
-
+static void iris6_asm_named_section PARAMS ((const char *,
+ unsigned int,
+ unsigned int));
/* Global variables for machine-dependent things. */
/* Threshold for data being put into the small data/bss area, instead
@@ -9800,3 +9802,49 @@ mips_parse_cpu (cpu_string)
return cpu;
}
+
+/* Output assembly to switch to section NAME with attribute FLAGS. */
+
+static void
+iris6_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align;
+{
+ unsigned int sh_type, sh_flags, sh_entsize;
+
+ sh_flags = 0;
+ if (!(flags & SECTION_DEBUG))
+ sh_flags |= 2; /* SHF_ALLOC */
+ if (flags & SECTION_WRITE)
+ sh_flags |= 1; /* SHF_WRITE */
+ if (flags & SECTION_CODE)
+ sh_flags |= 4; /* SHF_EXECINSTR */
+ if (flags & SECTION_SMALL)
+ sh_flags |= 0x10000000; /* SHF_MIPS_GPREL */
+ if (strcmp (name, ".debug_frame") == 0)
+ sh_flags |= 0x08000000; /* SHF_MIPS_NOSTRIP */
+
+ if (flags & SECTION_DEBUG)
+ sh_type = 0x7000001e; /* SHT_MIPS_DWARF */
+ else if (flags & SECTION_BSS)
+ sh_type = 8; /* SHT_NOBITS */
+ else
+ sh_type = 1; /* SHT_PROGBITS */
+
+ if (flags & SECTION_CODE)
+ sh_entsize = 4;
+ else
+ sh_entsize = 0;
+
+ if (align == 0)
+ {
+ if (flags & SECTION_CODE)
+ align = 4;
+ else
+ align = 8;
+ }
+
+ fprintf (asm_out_file, "\t.section %s,%u,%u,%u,%u\n",
+ name, sh_type, sh_flags, sh_entsize, align);
+}
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 0d47c087b66..fab6957a20d 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3097,10 +3097,6 @@ typedef struct mips_args {
If you are changing this macro, you should look at
mips_select_section and see if it needs a similar change. */
-#ifndef UNIQUE_SECTION_P
-#define UNIQUE_SECTION_P(DECL) (0)
-#endif
-
#define ENCODE_SECTION_INFO(DECL) \
do \
{ \
@@ -3120,7 +3116,7 @@ do \
references again. We force it to work by putting string \
addresses in the constant pool and indirecting. */ \
&& (! current_function_decl \
- || ! UNIQUE_SECTION_P (current_function_decl))) \
+ || ! DECL_ONE_ONLY (current_function_decl))) \
{ \
SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \
mips_string_length += TREE_STRING_LENGTH (DECL); \
diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h
index e3f7821aac7..13e7b089d79 100644
--- a/gcc/config/mips/netbsd.h
+++ b/gcc/config/mips/netbsd.h
@@ -201,24 +201,9 @@ do { \
} \
} while (0)
-/*
- A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases.
-*/
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else if (! strcmp (NAME, ".bss")) \
- fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* Since gas and gld are standard on NetBSD, we don't need these */
#undef ASM_FINAL_SPEC
diff --git a/gcc/config/mips/openbsd.h b/gcc/config/mips/openbsd.h
index 14a1594c337..e4847cef9a2 100644
--- a/gcc/config/mips/openbsd.h
+++ b/gcc/config/mips/openbsd.h
@@ -103,23 +103,9 @@ Boston, MA 02111-1307, USA. */
#undef ASM_FINAL_SPEC
#undef STARTFILE_SPEC
-/* A C statement to output something to the assembler file to switch to
- section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL
- or NULL_TREE. Some target formats do not support arbitrary sections.
- Do not define this macro in such cases. mips.h doesn't define this,
- do it here. */
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \
- else if (! strcmp (NAME, ".bss")) \
- fprintf (F, "\t.section %s,\"aw\",@nobits\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \
-} while (0)
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* collect2 support (Macros for initialization). */
diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h
index 76e1a3505a6..d32675cfc5e 100644
--- a/gcc/config/nextstep.h
+++ b/gcc/config/nextstep.h
@@ -232,6 +232,11 @@ Boston, MA 02111-1307, USA. */
fprintf (FILE, ".reference .destructors_used\n"); \
} while (0)
+/* ??? Should be changed to EH_FRAME_SECTION_NAME, but that requires
+ named section support. Based on this definition, it seems clear
+ that the object file format supports named sections, but it has
+ not been implemented in gcc. */
+#error "Implement named section support"
#define EH_FRAME_SECTION_ASM_OP "\t.section __TEXT,__eh_frame,regular"
/* Don't output a .file directive. That is only used by the assembler for
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 04bc25bad74..bc2cc92698f 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -186,72 +186,10 @@ dtors_section () \
} \
}
-/* Switch into a generic section.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl.
-
- If the section has already been defined, we must not
- emit the attributes here. The SVR4 assembler does not
- recognize section redefinitions.
- If DECL is NULL, no attributes are emitted. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- do \
- { \
- static htab_t htab; \
- \
- struct section_info \
- { \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- }; \
- \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- PTR* slot; \
- \
- /* The names we put in the hashtable will always be the unique \
- versions gived to us by the stringtable, so we can just use \
- their addresses as the keys. */ \
- if (!htab) \
- htab = htab_create (31, \
- htab_hash_pointer, \
- htab_eq_pointer, \
- NULL); \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- \
- /* See if we already have an entry for this section. */ \
- slot = htab_find_slot (htab, NAME, INSERT); \
- if (!*slot) \
- { \
- s = (struct section_info *) xmalloc (sizeof (* s)); \
- s->type = type; \
- *slot = s; \
- fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
- NAME, mode); \
- } \
- else \
- { \
- s = (struct section_info *) *slot; \
- if (DECL && s->type != type) \
- error_with_decl (DECL, \
- "%s causes a section type conflict"); \
- \
- fprintf (FILE, "\t.section\t%s\n", NAME); \
- } \
- } \
- while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
#define UNIQUE_SECTION(DECL,RELOC) \
do { \
int len; \
diff --git a/gcc/config/psos.h b/gcc/config/psos.h
index 361c5bb86cf..6f67f35cc1d 100644
--- a/gcc/config/psos.h
+++ b/gcc/config/psos.h
@@ -73,13 +73,8 @@ Boston, MA 02111-1307, USA.
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
fputc ('\n', FILE); } while (0)
-/* Switch into a generic section. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \
- (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \
- (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw")
-
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
/* Define the pseudo-ops used to switch to the .ctors and .dtors
sections. */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 867206dedf4..96ac5c7dc83 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -130,6 +130,14 @@ static void rs6000_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void rs6000_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static rtx rs6000_emit_set_long_const PARAMS ((rtx,
HOST_WIDE_INT, HOST_WIDE_INT));
+#if TARGET_ELF
+static unsigned int rs6000_elf_section_type_flags PARAMS ((tree, const char *,
+ int));
+#endif
+#ifdef OBJECT_FORMAT_COFF
+static void xcoff_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
+#endif
/* Default register names. */
char rs6000_reg_names[][8] =
@@ -177,6 +185,11 @@ static char alt_reg_names[][8] =
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE rs6000_output_function_epilogue
+#if TARGET_ELF
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS rs6000_elf_section_type_flags
+#endif
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Override command line options. Mostly we process the processor
@@ -8675,3 +8688,33 @@ toc_section ()
}
#endif /* TARGET_MACHO */
+
+#if TARGET_ELF
+static unsigned int
+rs6000_elf_section_type_flags (decl, name, reloc)
+ tree decl;
+ const char *name;
+ int reloc;
+{
+ unsigned int flags = default_section_type_flags (decl, name, reloc);
+
+ /* ??? The flag_pic check appears redundant with the DECL_READONLY_SECTION
+ check in default_section_type_flags. */
+ if (TARGET_RELOCATABLE || flag_pic)
+ flags &= ~SECTION_WRITE;
+
+ /* Solaris doesn't like @nobits, and gas can handle .sbss without it. */
+ flags &= ~SECTION_BSS;
+}
+#endif
+
+#ifdef OBJECT_FORMAT_COFF
+static void
+xcoff_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file, "\t.csect %s\n", name);
+}
+#endif
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 9871d20c1f6..3011c30a669 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -992,63 +992,6 @@ do { \
asm_fprintf (FILE, "%U%s", _name); \
} while (0)
-/* Switch into a generic section.
-
- We make the section read-only and executable for a function decl,
- read-only for a const data decl, and writable for a non-const data decl.
-
- If the section has already been defined, we must not
- emit the attributes here. The SVR4 assembler does not
- recognize section redefinitions.
- If DECL is NULL, no attributes are emitted.
-
- Note, Solaris as doesn't like @nobits, and gas can handle .sbss without
- needing @nobits. */
-
-/* Override elfos.h definition. */
-#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
-do { \
- static struct section_info \
- { \
- struct section_info *next; \
- char *name; \
- enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
- } *sections; \
- struct section_info *s; \
- const char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
- if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
- type = SECT_EXEC, mode = "ax"; \
- else if (DECL && DECL_READONLY_SECTION (DECL, RELOC) && !TARGET_RELOCATABLE && !flag_pic) \
- type = SECT_RO, mode = "a"; \
- else \
- type = SECT_RW, mode = "aw"; \
- \
- if (s == 0) \
- { \
- s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
- s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
- strcpy (s->name, NAME); \
- s->type = type; \
- s->next = sections; \
- sections = s; \
- fprintf (FILE, "\t.section\t\"%s\",\"%s\"\n", NAME, mode); \
- } \
- else \
- { \
- if (DECL && s->type != type) \
- error_with_decl (DECL, "%s causes a section type conflict"); \
- \
- fprintf (FILE, "\t.section\t\"%s\"\n", NAME); \
- } \
-} while (0)
-
/* Override elfos.h definition. */
#undef ASM_OUTPUT_CONSTRUCTOR
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 53cc7e730bb..4d0a7fd3949 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -489,11 +489,8 @@ toc_section () \
} \
} while (0)
-#define ASM_OUTPUT_SECTION_NAME(ASM_OUT_FILE,DECL,NAME,RELOC) \
- do { fputs ("\t.csect ", ASM_OUT_FILE); \
- fputs (TREE_STRING_POINTER (DECL_SECTION_NAME (DECL)), ASM_OUT_FILE); \
- putc ('\n', ASM_OUT_FILE); \
- } while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION xcoff_asm_named_section
/* Define the name of the section to use for the exception tables.
TODO: test and see if we can use read_only_data_section, if so,
diff --git a/gcc/config/sh/elf.h b/gcc/config/sh/elf.h
index 5acfe75e151..183fa96c2ab 100644
--- a/gcc/config/sh/elf.h
+++ b/gcc/config/sh/elf.h
@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA. */
#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
#undef CTORS_SECTION_ASM_OP
#undef DTORS_SECTION_ASM_OP
-#undef ASM_OUTPUT_SECTION_NAME
+#undef TARGET_ASM_NAMED_SECTION
#undef ASM_OUTPUT_CONSTRUCTOR
#undef ASM_OUTPUT_DESTRUCTOR
#undef ASM_DECLARE_FUNCTION_NAME
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 87b5be9ee9e..6c2104f2585 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -156,6 +156,8 @@ static rtx mark_constant_pool_use PARAMS ((rtx));
static int sh_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
static void sh_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void sh_insert_attributes PARAMS ((tree, tree *));
+static void sh_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
/* Initialize the GCC target structure. */
#undef TARGET_VALID_DECL_ATTRIBUTE
@@ -5556,3 +5558,12 @@ sh_can_redirect_branch (branch1, branch2)
return 0;
}
+static void
+sh_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags ATTRIBUTE_UNUSED;
+ unsigned int flags ATTRIBUTE_UNUSED;
+{
+ /* ??? Perhaps we should be using default_coff_asm_named_section. */
+ fprintf (asm_out_file, "\t.section %s\n", name);
+}
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index e82a9d24375..1377610a319 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1948,13 +1948,8 @@ dtors_section() \
which could be text or it could be a user defined section. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
- do { fprintf (FILE, ".section\t%s\n", NAME); } while (0)
+/* Switch into a generic section. */
+#define TARGET_ASM_NAMED_SECTION sh_asm_named_section
/* This is the pseudo-op used to generate a reference to a specific
symbol in some section. */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e7413ee3046..2693f73cacb 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -164,6 +164,8 @@ static void sparc_nonflat_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT,
int));
static void sparc_nonflat_function_prologue PARAMS ((FILE *, HOST_WIDE_INT,
int));
+static void sparc_elf_asm_named_section PARAMS ((const char *, unsigned int,
+ unsigned int));
/* Option handling. */
@@ -8688,3 +8690,23 @@ sparc_add_gc_roots ()
ggc_add_root (ultra_pipe_hist, ARRAY_SIZE (ultra_pipe_hist),
sizeof (ultra_pipe_hist[0]), &mark_ultrasparc_pipeline_state);
}
+
+static void
+sparc_elf_asm_named_section (name, flags, align)
+ const char *name;
+ unsigned int flags;
+ unsigned int align ATTRIBUTE_UNUSED;
+{
+ fprintf (asm_out_file, "\t.section\t\"%s\"", name);
+
+ if (!(flags & SECTION_DEBUG))
+ fputs (",#alloc", asm_out_file);
+ if (flags & SECTION_WRITE)
+ fputs (",#write", asm_out_file);
+ if (flags & SECTION_CODE)
+ fputs (",#execinstr", asm_out_file);
+
+ /* ??? Handle SECTION_BSS. */
+
+ fputc ('\n', asm_out_file);
+}
diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h
index 19b7f15fc4c..4cd0b396ca7 100644
--- a/gcc/config/sparc/sysv4.h
+++ b/gcc/config/sparc/sysv4.h
@@ -182,25 +182,10 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \
#define CTORS_SECTION_ASM_OP "\t.section\t\".ctors\",#alloc,#write"
#undef DTORS_SECTION_ASM_OP
#define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write"
-#undef EH_FRAME_SECTION_ASM_OP
-#define EH_FRAME_SECTION_ASM_OP "\t.section\t\".eh_frame\",#alloc,#write"
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. Some target formats do not support arbitrary sections. Do not
- define this macro in such cases. */
-
-#undef ASM_OUTPUT_SECTION_NAME /* Override svr4.h's definition. */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (FILE, ".section\t\"%s\",#alloc,#execinstr\n", \
- (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME)); \
- else \
- fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME)); \
-} while (0)
+
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section
/* A C statement (sans semicolon) to output to the stdio stream
FILE the assembler definition of uninitialized global DECL named