diff options
| author | robertl <robertl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-08 22:41:55 +0000 |
|---|---|---|
| committer | robertl <robertl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-08 22:41:55 +0000 |
| commit | 5cdb6d3147d1aa9c70ee30e474b7b2b785e071b2 (patch) | |
| tree | 855a56530e6a6db9b761b28846fc3a61c596e605 | |
| parent | ebed3b99a35afe8bd311b4be73d0103d67c5a97f (diff) | |
| download | ppe42-gcc-5cdb6d3147d1aa9c70ee30e474b7b2b785e071b2.tar.gz ppe42-gcc-5cdb6d3147d1aa9c70ee30e474b7b2b785e071b2.zip | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46108 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/output.h | 1 | ||||
| -rw-r--r-- | gcc/varasm.c | 32 |
3 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc49dc67e14..2b657de4ff1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/output.h b/gcc/output.h index f1722f146b6..85485bf52d7 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -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 *, diff --git a/gcc/varasm.c b/gcc/varasm.c index d2a59d8e43e..cc79f206432 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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) |

