* 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
+2002-10-22 Alan Modra <amodra@bigpond.net.au>
+
+ * 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 <rth@redhat.com>
* real.c (sticky_rshift_significand): Return inexact, don't
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';
*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
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));
|| 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;
}
unsigned int flags;
{
char flagchars[10], *f = flagchars;
- const char *type;
if (! named_section_first_declaration (name))
{
*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