Commit a8c01a59 by Robert Lipe Committed by Robert Lipe

varasm.c (struct in_named_entry): Add declared.

	* varasm.c  (struct in_named_entry): Add declared.
	(named_section_first_declaration): New function.
	(default_elf_asm_named_section): Use it.
	* output.h (named_section_first_declaration): New.

From-SVN: r46108
parent 646ded90
2001-10-08 Robert Lipe <robertlipe@usa.net>
* varasm.c (struct in_named_entry): Add declared.
(named_section_first_declaration): New function.
(default_elf_asm_named_section): Use it.
* output.h (named_section_first_declaration): New.
2001-10-08 Richard Henderson <rth@redhat.com> 2001-10-08 Richard Henderson <rth@redhat.com>
* i386.md (movsi_xor): Export. * i386.md (movsi_xor): Export.
......
...@@ -475,6 +475,7 @@ extern void no_asm_to_stream PARAMS ((FILE *)); ...@@ -475,6 +475,7 @@ extern void no_asm_to_stream PARAMS ((FILE *));
extern unsigned int get_named_section_flags PARAMS ((const char *)); extern unsigned int get_named_section_flags PARAMS ((const char *));
extern bool set_named_section_flags PARAMS ((const char *, unsigned int)); extern bool set_named_section_flags PARAMS ((const char *, unsigned int));
extern void named_section_flags PARAMS ((const char *, unsigned int)); extern void named_section_flags PARAMS ((const char *, unsigned int));
extern bool named_section_first_declaration PARAMS((const char *));
union tree_node; union tree_node;
extern unsigned int default_section_type_flags PARAMS ((union tree_node *, extern unsigned int default_section_type_flags PARAMS ((union tree_node *,
......
...@@ -216,6 +216,7 @@ struct in_named_entry ...@@ -216,6 +216,7 @@ struct in_named_entry
{ {
const char *name; const char *name;
unsigned int flags; unsigned int flags;
bool declared;
}; };
static htab_t in_named_htab; static htab_t in_named_htab;
...@@ -340,6 +341,31 @@ get_named_section_flags (section) ...@@ -340,6 +341,31 @@ get_named_section_flags (section)
return slot ? (*slot)->flags : 0; return slot ? (*slot)->flags : 0;
} }
/* Returns true if the section has been declared before. Sets internal
flag on this section in in_named_hash so subsequent calls on this
section will return false. */
bool
named_section_first_declaration (name)
const char *name;
{
struct in_named_entry **slot;
slot = (struct in_named_entry**)
htab_find_slot_with_hash (in_named_htab, name,
htab_hash_string (name), NO_INSERT);
if (! (*slot)->declared)
{
(*slot)->declared = true;
return true;
}
else
{
return false;
}
}
/* Record FLAGS for SECTION. If SECTION was previously recorded with a /* Record FLAGS for SECTION. If SECTION was previously recorded with a
different set of flags, return false. */ different set of flags, return false. */
...@@ -5205,6 +5231,12 @@ default_elf_asm_named_section (name, flags) ...@@ -5205,6 +5231,12 @@ default_elf_asm_named_section (name, flags)
char flagchars[10], *f = flagchars; char flagchars[10], *f = flagchars;
const char *type; const char *type;
if (! named_section_first_declaration (name))
{
fprintf (asm_out_file, "\t.section\t%s\n", name);
return;
}
if (!(flags & SECTION_DEBUG)) if (!(flags & SECTION_DEBUG))
*f++ = 'a'; *f++ = 'a';
if (flags & SECTION_WRITE) if (flags & SECTION_WRITE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment