From 6a0a6ac4c168206195185ec63130685ce7d7d61a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 22 Oct 2002 07:59:41 +0000 Subject: 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 --- gcc/ChangeLog | 9 +++++++++ gcc/config/arm/arm.c | 38 ++++++++++++++++++++++++++------------ gcc/output.h | 3 ++- gcc/varasm.c | 39 ++++++++++++++++++++++++++++----------- 4 files changed, 65 insertions(+), 24 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de0f8b5..c1656be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2002-10-22 Alan Modra + + * 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. + 2002-10-21 Richard Henderson * real.c (sticky_rshift_significand): Return inexact, don't diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 70e0291..d6c1a02 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -11068,8 +11068,13 @@ arm_elf_asm_named_section (name, flags) const char *name; unsigned int flags; { - char flagchars[8], *f = flagchars; - const char *type; + 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'; @@ -11083,19 +11088,28 @@ arm_elf_asm_named_section (name, flags) *f++ = 'M'; if (flags & SECTION_STRINGS) *f++ = 'S'; + if (flags & SECTION_TLS) + *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); } #endif diff --git a/gcc/output.h b/gcc/output.h index cd5cd09..4070f95 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -485,7 +485,8 @@ extern void no_asm_to_stream PARAMS ((FILE *)); embedded zeros */ #define SECTION_OVERRIDE 0x20000 /* allow override of default flags */ #define SECTION_TLS 0x40000 /* contains thread-local storage */ -#define SECTION_MACH_DEP 0x80000 /* subsequent bits reserved for target */ +#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 PARAMS ((const char *)); extern bool set_named_section_flags PARAMS ((const char *, unsigned int)); 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 -- cgit v1.1