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
This commit is contained in:
Robert Lipe 2001-10-08 22:41:55 +00:00 committed by Robert Lipe
parent 646ded90c6
commit a8c01a592b
3 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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>
* i386.md (movsi_xor): Export.

View File

@ -475,6 +475,7 @@ extern void no_asm_to_stream PARAMS ((FILE *));
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));
extern bool named_section_first_declaration PARAMS((const char *));
union tree_node;
extern unsigned int default_section_type_flags PARAMS ((union tree_node *,

View File

@ -216,6 +216,7 @@ struct in_named_entry
{
const char *name;
unsigned int flags;
bool declared;
};
static htab_t in_named_htab;
@ -340,6 +341,31 @@ get_named_section_flags (section)
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
different set of flags, return false. */
@ -5205,6 +5231,12 @@ default_elf_asm_named_section (name, flags)
char flagchars[10], *f = flagchars;
const char *type;
if (! named_section_first_declaration (name))
{
fprintf (asm_out_file, "\t.section\t%s\n", name);
return;
}
if (!(flags & SECTION_DEBUG))
*f++ = 'a';
if (flags & SECTION_WRITE)