aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-10-22 07:59:41 +0000
committerAlan Modra <amodra@gcc.gnu.org>2002-10-22 17:29:41 +0930
commit6a0a6ac4c168206195185ec63130685ce7d7d61a (patch)
tree994d078816785a89195501d16762dd944bcc8cc7 /gcc/varasm.c
parentf87229e947c5dea5a1ffb8ead338ee5b023a19b5 (diff)
downloadgcc-6a0a6ac4c168206195185ec63130685ce7d7d61a.zip
gcc-6a0a6ac4c168206195185ec63130685ce7d7d61a.tar.gz
gcc-6a0a6ac4c168206195185ec63130685ce7d7d61a.tar.bz2
output.h (SECTION_NOTYPE): Define.
* output.h (SECTION_NOTYPE): Define. * varasm.c (default_section_type_flags_1): Set SECTION_NOTYPE for init array sections. (default_elf_asm_named_section): Mind SECTION_NOTYPE. * config/arm/arm.c (arm_elf_asm_named_section): Likewise. Also merge TLS support. From-SVN: r58404
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 2894f89..e2d5f3a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4828,6 +4828,17 @@ default_section_type_flags_1 (decl, name, reloc, shlib)
|| strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
flags |= SECTION_TLS;
+ /* These three sections have special ELF types. They are neither
+ SHT_PROGBITS nor SHT_NOBITS, so when changing sections we don't
+ want to print a section type (@progbits or @nobits). If someone
+ is silly enough to emit code or TLS variables to one of these
+ sections, then don't handle them specially. */
+ if (!(flags & (SECTION_CODE | SECTION_BSS | SECTION_TLS))
+ && (strcmp (name, ".init_array") == 0
+ || strcmp (name, ".fini_array") == 0
+ || strcmp (name, ".preinit_array") == 0))
+ flags |= SECTION_NOTYPE;
+
return flags;
}
@@ -4850,7 +4861,6 @@ default_elf_asm_named_section (name, flags)
unsigned int flags;
{
char flagchars[10], *f = flagchars;
- const char *type;
if (! named_section_first_declaration (name))
{
@@ -4874,17 +4884,24 @@ default_elf_asm_named_section (name, flags)
*f++ = 'T';
*f = '\0';
- if (flags & SECTION_BSS)
- type = "nobits";
- else
- type = "progbits";
+ fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);
- if (flags & SECTION_ENTSIZE)
- fprintf (asm_out_file, "\t.section\t%s,\"%s\",@%s,%d\n",
- name, flagchars, type, flags & SECTION_ENTSIZE);
- else
- fprintf (asm_out_file, "\t.section\t%s,\"%s\",@%s\n",
- name, flagchars, type);
+ 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