+2001-08-16 Richard Henderson <rth@redhat.com>
+
+ * varasm.c (named_section_flags): Remove align parameter.
+ * varasm.c, dwarf2out.c: Update all callers.
+ * output.h: Update prototypes.
+
+ * target.h (target.asm_out.named_section): Remove align parameter.
+ * varasm.c, config/a29k/a29k.c, config/alpha/alpha.c,
+ config/arm/arm.c, config/c4x/c4x.c, config/h8300/h8300.c,
+ config/i386/i386.c, config/i386/winnt.c, config/m68k/m68k.c,
+ config/mcore/mcore.c, config/mips/mips.c, config/rs6000/rs6000.c,
+ config/sh/sh.c, config/sparc/sparc.c: Update implementations to match.
+
+ * varasm.c (in_named_entry_eq, in_named_entry_hash): New.
+ (get_named_section_flags, set_named_section_flags): New.
+ (named_section_flags): Use them.
+ (named_section): Do decl vs section flags check here...
+ (default_section_type_flags): ... not here.
+ (init_varasm_once): Create in_named_htab.
+ (resolve_unique_section): Mark reloc unused.
+
2001-08-16 Richard Henderson <rth@redhat.com>
* varasm.c (force_const_mem): Keep pool alignment in bits.
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));
+static void a29k_asm_named_section PARAMS ((const char *, unsigned int));
#define min(A,B) ((A) < (B) ? (A) : (B))
}
static void
-a29k_asm_named_section (name, flags, align)
+a29k_asm_named_section (name, flags)
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);
#if TARGET_ABI_OPEN_VMS
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));
+static void vms_asm_named_section PARAMS ((const char *, unsigned int));
static void vms_asm_out_constructor PARAMS ((rtx, int));
static void vms_asm_out_destructor PARAMS ((rtx, int));
# undef TARGET_VALID_DECL_ATTRIBUTE
the section; 0 if the default should be used. */
static void
-vms_asm_named_section (name, flags, align)
+vms_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align;
{
const char *flag_str = "";
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);
}
/* Record an element in the table of global constructors. SYMBOL is
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
used before the section type. */
static void
-arm_elf_asm_named_section (name, flags, align)
+arm_elf_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
char flagchars[8], *f = flagchars;
const char *type;
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));
+static void c4x_asm_named_section PARAMS ((const char *, unsigned int));
\f
/* Initialize the GCC target structure. */
#undef TARGET_VALID_TYPE_ATTRIBUTE
}
static void
-c4x_asm_named_section (name, flags, align)
+c4x_asm_named_section (name, flags)
const char *name;
unsigned int flags ATTRIBUTE_UNUSED;
- unsigned int align ATTRIBUTE_UNUSED;
{
fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
}
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));
+static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
/* CPU_TYPE, says what cpu we're compiling for. */
int cpu_type;
}
static void
-h8300_asm_named_section (name, flags, align)
+h8300_asm_named_section (name, flags)
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);
static void ix86_svr3_asm_out_constructor PARAMS ((rtx, int));
#endif
#if defined(TARGET_ELF) && defined(TARGET_COFF)
-static void sco_asm_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
+static void sco_asm_named_section PARAMS ((const char *, unsigned int));
static void sco_asm_out_constructor PARAMS ((rtx, int));
#endif
\f
error_mark_node);
DECL_ONE_ONLY (decl) = 1;
UNIQUE_SECTION (decl, 0);
- named_section (decl, NULL, 0);
+ named_section (decl, NULL);
}
else
#else
#if defined(TARGET_ELF) && defined(TARGET_COFF)
static void
-sco_asm_named_section (name, flags, align)
+sco_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align;
{
if (TARGET_ELF)
- default_elf_asm_named_section (name, flags, align);
+ default_elf_asm_named_section (name, flags);
else
- default_coff_asm_named_section (name, flags, align);
+ default_coff_asm_named_section (name, flags);
}
static void
}
void
-i386_pe_asm_named_section (name, flags, align)
+i386_pe_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
char flagchars[8], *f = flagchars;
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));
+static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int));
#ifdef CTOR_LIST_BEGIN
static void m68k_svr3_asm_out_constructor PARAMS ((rtx, int));
#endif
/* Output assembly to switch to section NAME with attribute FLAGS. */
static void
-m68k_coff_asm_named_section (name, flags, align)
+m68k_coff_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
char flagchar;
static int mcore_valid_decl_attribute PARAMS ((tree, tree,
tree, tree));
static void mcore_asm_named_section PARAMS ((const char *,
- unsigned int,
unsigned int));
\f
/* Initialize the GCC target structure. */
}
static void
-mcore_asm_named_section (name, flags, align)
+mcore_asm_named_section (name, flags)
const char *name;
unsigned int flags ATTRIBUTE_UNUSED;
- unsigned int align ATTRIBUTE_UNUSED;
{
fprintf (asm_out_file, "\t.section %s\n", name);
}
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. */
/* Output assembly to switch to section NAME with attribute FLAGS. */
static void
-iris6_asm_named_section (name, flags, align)
+iris6_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align;
{
unsigned int sh_type, sh_flags, sh_entsize;
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);
+ name, sh_type, sh_flags, sh_entsize, 0);
}
/* Cover function for UNIQUE_SECTION. */
static void rs6000_elf_asm_out_destructor PARAMS ((rtx, int));
#endif
#ifdef OBJECT_FORMAT_COFF
-static void xcoff_asm_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
+static void xcoff_asm_named_section PARAMS ((const char *, unsigned int));
#endif
\f
/* Default register names. */
section = buf;
}
- named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+ named_section_flags (section, SECTION_WRITE);
+ assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
{
section = buf;
}
- named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+ named_section_flags (section, SECTION_WRITE);
+ assemble_align (POINTER_SIZE);
if (TARGET_RELOCATABLE)
{
#ifdef OBJECT_FORMAT_COFF
static void
-xcoff_asm_named_section (name, flags, align)
+xcoff_asm_named_section (name, flags)
const char *name;
unsigned int flags ATTRIBUTE_UNUSED;
- unsigned int align ATTRIBUTE_UNUSED;
{
fprintf (asm_out_file, "\t.csect %s\n", name);
}
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));
+static void sh_asm_named_section PARAMS ((const char *, unsigned int));
\f
/* Initialize the GCC target structure. */
#undef TARGET_VALID_DECL_ATTRIBUTE
}
static void
-sh_asm_named_section (name, flags, align)
+sh_asm_named_section (name, flags)
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);
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));
+static void sparc_elf_asm_named_section PARAMS ((const char *, unsigned int));
\f
/* Option handling. */
}
static void
-sparc_elf_asm_named_section (name, flags, align)
+sparc_elf_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
fprintf (asm_out_file, "\t.section\t\"%s\"", name);
if (for_eh)
{
#ifdef EH_FRAME_SECTION_NAME
- named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE,
- DWARF_OFFSET_SIZE);
+ named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE);
#else
tree label = get_file_function_name ('F');
assemble_label ("__FRAME_BEGIN__");
}
else
- named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
/* Output the CIE. */
ASM_GENERATE_INTERNAL_LABEL (l1, CIE_AFTER_SIZE_LABEL, for_eh);
secname = (const char *) DEBUG_INFO_SECTION;
/* Output debugging information. */
- named_section_flags (secname, SECTION_DEBUG, 1);
+ named_section_flags (secname, SECTION_DEBUG);
output_compilation_unit_header ();
output_die (die);
}
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (lineno, "Included from line number %d",
lineno);
}
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_end_file, "End file");
}
}
}
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_define, "Define macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
{
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_undef, "Undefine macro");
dw2_asm_output_data_uleb128 (lineno, "At line number %d", lineno);
dw2_asm_output_nstring (buffer, -1, "The macro");
ASM_GENERATE_INTERNAL_LABEL (debug_line_section_label,
DEBUG_LINE_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (loc_section_label, DEBUG_LOC_SECTION_LABEL, 0);
- named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
ASM_OUTPUT_LABEL (asm_out_file, loc_section_label);
- named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
ASM_OUTPUT_LABEL (asm_out_file, abbrev_section_label);
- named_section_flags (DEBUG_INFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_INFO_SECTION, SECTION_DEBUG);
ASM_OUTPUT_LABEL (asm_out_file, debug_info_section_label);
- named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
DEBUG_MACINFO_SECTION_LABEL, 0);
ASM_OUTPUT_LABEL (asm_out_file, macinfo_section_label);
examining the file. */
if (! DWARF2_ASM_LINE_DEBUG_INFO)
{
- named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_LINE_SECTION, SECTION_DEBUG);
output_line_info ();
}
output_comp_unit (comp_unit_die);
/* Output the abbreviation table. */
- named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_ABBREV_SECTION, SECTION_DEBUG);
output_abbrev_section ();
if (pubname_table_in_use)
{
/* Output public names table. */
- named_section_flags (DEBUG_PUBNAMES_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_PUBNAMES_SECTION, SECTION_DEBUG);
output_pubnames ();
}
if (fde_table_in_use)
{
/* Output the address range information. */
- named_section_flags (DEBUG_ARANGES_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_ARANGES_SECTION, SECTION_DEBUG);
output_aranges ();
}
if (have_location_lists)
{
/* Output the location lists info. */
- named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_LOC_SECTION, SECTION_DEBUG);
output_location_lists (die);
have_location_lists = 0;
}
/* Output ranges section if necessary. */
if (ranges_table_in_use)
{
- named_section_flags (DEBUG_RANGES_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_RANGES_SECTION, SECTION_DEBUG);
output_ranges ();
}
/* Have to end the primary source file. */
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
- named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG, 1);
+ named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
dw2_asm_output_data (1, DW_MACINFO_end_file, "End file");
}
}
{
#ifdef JCR_SECTION_NAME
tree t;
- named_section_flags (JCR_SECTION_NAME, SECTION_WRITE,
- POINTER_SIZE / BITS_PER_UNIT);
+ named_section_flags (JCR_SECTION_NAME, SECTION_WRITE);
+ assemble_align (POINTER_SIZE);
for (t = registered_class; t; t = TREE_CHAIN (t))
assemble_integer (XEXP (DECL_RTL (t), 0),
POINTER_SIZE / BITS_PER_UNIT, 1);
#define SECTION_FORGET 64 /* forget that we've entered the section */
#define SECTION_MACH_DEP 128 /* subsequent bits reserved for target */
-extern void named_section_flags PARAMS ((const char *, unsigned int,
- unsigned int));
+extern unsigned int get_named_section_flags PARAMS ((const char *));
+extern bool set_named_section_flags PARAMS ((const char *, unsigned int));
+extern void named_section_flags PARAMS ((const char *, unsigned int));
union tree_node;
extern unsigned int default_section_type_flags PARAMS ((union tree_node *,
const char *, int));
-extern void default_no_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
-extern void default_elf_asm_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
-extern void default_coff_asm_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
-extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int,
- unsigned int));
+extern void default_no_named_section PARAMS ((const char *, unsigned int));
+extern void default_elf_asm_named_section PARAMS ((const char *, unsigned int));
+extern void default_coff_asm_named_section PARAMS ((const char *,
+ unsigned int));
+extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int));
extern void default_stabs_asm_out_destructor PARAMS ((struct rtx_def *, int));
extern void default_named_section_asm_out_destructor PARAMS ((struct rtx_def *,
/* Output the assembler code for function exit. */
void (* function_epilogue) PARAMS ((FILE *, HOST_WIDE_INT));
- /* 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. */
- void (* named_section) PARAMS ((const char *, unsigned int,
- unsigned int));
+ /* Switch to an arbitrary section NAME with attributes as
+ specified by FLAGS. */
+ void (* named_section) PARAMS ((const char *, unsigned int));
/* Output a constructor for a symbol with a given priority. */
void (* constructor) PARAMS ((struct rtx_def *, int));
#ifdef ASM_WEAKEN_LABEL
static void remove_from_pending_weak_list PARAMS ((const char *));
#endif
+static int in_named_entry_eq PARAMS ((const PTR, const PTR));
+static hashval_t in_named_entry_hash PARAMS ((const PTR));
#ifdef ASM_OUTPUT_BSS
static void asm_output_bss PARAMS ((FILE *, tree, const char *, int, int));
#endif
/* Text of section name when in_section == in_named. */
static const char *in_named_name;
+/* Hash table of flags that have been used for a particular named section. */
+
+struct in_named_entry
+{
+ const char *name;
+ unsigned int flags;
+};
+
+static htab_t in_named_htab;
+
/* Define functions like text_section for any extra sections. */
#ifdef EXTRA_SECTION_FUNCTIONS
EXTRA_SECTION_FUNCTIONS
return in_section == in_data;
}
+/* Helper routines for maintaining in_named_htab. */
+
+static int
+in_named_entry_eq (p1, p2)
+ const PTR p1;
+ const PTR p2;
+{
+ const struct in_named_entry *old = p1;
+ const char *new = p2;
+
+ return strcmp (old->name, new) == 0;
+}
+
+static hashval_t
+in_named_entry_hash (p)
+ const PTR p;
+{
+ const struct in_named_entry *old = p;
+ return htab_hash_string (old->name);
+}
+
+/* If SECTION has been seen before as a named section, return the flags
+ that were used. Otherwise, return 0. Note, that 0 is a perfectly valid
+ set of flags for a section to have, so 0 does not mean that the section
+ has not been seen. */
+
+unsigned int
+get_named_section_flags (section)
+ const char *section;
+{
+ struct in_named_entry **slot;
+
+ slot = (struct in_named_entry**)
+ htab_find_slot_with_hash (in_named_htab, section,
+ htab_hash_string (section), NO_INSERT);
+
+ return slot ? (*slot)->flags : 0;
+}
+
+/* Record FLAGS for SECTION. If SECTION was previously recorded with a
+ different set of flags, return false. */
+
+bool
+set_named_section_flags (section, flags)
+ const char *section;
+ unsigned int flags;
+{
+ struct in_named_entry **slot, *entry;
+
+ slot = (struct in_named_entry**)
+ htab_find_slot_with_hash (in_named_htab, section,
+ htab_hash_string (section), INSERT);
+ entry = *slot;
+
+ if (!entry)
+ {
+ entry = (struct in_named_entry *) xmalloc (sizeof (*entry));
+ *slot = entry;
+ entry->name = ggc_strdup (section);
+ entry->flags = flags;
+ }
+ else if (entry->flags != flags)
+ return false;
+
+ return true;
+}
+
/* Tell assembler to change to section NAME with attributes FLAGS. */
void
-named_section_flags (name, flags, align)
+named_section_flags (name, flags)
const char *name;
unsigned int flags;
- unsigned int align;
{
- if (in_section != in_named || strcmp (name, in_named_name))
+ if (in_section != in_named || strcmp (name, in_named_name) != 0)
{
- (* targetm.asm_out.named_section) (name, flags, align);
+ if (! set_named_section_flags (name, flags))
+ abort ();
+
+ (* targetm.asm_out.named_section) (name, flags);
if (flags & SECTION_FORGET)
in_section = no_section;
name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
flags = (* targetm.section_type_flags) (decl, name, reloc);
- named_section_flags (name, flags, 0);
+
+ /* Sanity check user variables for flag changes. Non-user
+ section flag changes will abort in named_section_flags. */
+ if (decl && ! set_named_section_flags (name, flags))
+ {
+ error_with_decl (decl, "%s causes a section type conflict");
+ flags = get_named_section_flags (name);
+ }
+
+ named_section_flags (name, flags);
}
/* If required, set DECL_SECTION_NAME to a unique name. */
static void
resolve_unique_section (decl, reloc)
tree decl;
- int reloc;
+ int reloc ATTRIBUTE_UNUSED;
{
if (DECL_SECTION_NAME (decl) == NULL_TREE
&& (flag_function_sections
section = buf;
}
- named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+ named_section_flags (section, SECTION_WRITE);
+ assemble_align (POINTER_SIZE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
}
section = buf;
}
- named_section_flags (section, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+ named_section_flags (section, SECTION_WRITE);
assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
}
{
const_str_htab = htab_create (128, const_str_htab_hash, const_str_htab_eq,
const_str_htab_del);
+ in_named_htab = htab_create (31, in_named_entry_hash,
+ in_named_entry_eq, NULL);
+
ggc_add_root (const_hash_table, MAX_HASH_TABLE, sizeof const_hash_table[0],
mark_const_hash_entry);
ggc_add_root (&const_str_htab, 1, sizeof const_str_htab,
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. */
+ read-only for a const data decl, and writable for a non-const data decl. */
unsigned int
default_section_type_flags (decl, name, reloc)
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;
|| strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
flags |= SECTION_BSS;
- /* 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;
}
Four variants for common object file formats. */
void
-default_no_named_section (name, flags, align)
+default_no_named_section (name, flags)
const char *name ATTRIBUTE_UNUSED;
unsigned int flags ATTRIBUTE_UNUSED;
- unsigned int align ATTRIBUTE_UNUSED;
{
/* Some object formats don't support named sections at all. The
front-end should already have flagged this as an error. */
}
void
-default_elf_asm_named_section (name, flags, align)
+default_elf_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
char flagchars[8], *f = flagchars;
const char *type;
}
void
-default_coff_asm_named_section (name, flags, align)
+default_coff_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
char flagchars[8], *f = flagchars;
}
void
-default_pe_asm_named_section (name, flags, align)
+default_pe_asm_named_section (name, flags)
const char *name;
unsigned int flags;
- unsigned int align ATTRIBUTE_UNUSED;
{
- default_coff_asm_named_section (name, flags, align);
+ default_coff_asm_named_section (name, flags);
if (flags & SECTION_LINKONCE)
{