OSDN Git Service

* varasm.c (struct in_named_entry): Add declared.
authorrobertl <robertl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Oct 2001 22:41:55 +0000 (22:41 +0000)
committerrobertl <robertl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Oct 2001 22:41:55 +0000 (22:41 +0000)
(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

gcc/ChangeLog
gcc/output.h
gcc/varasm.c

index bc49dc6..2b657de 100644 (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.
index f1722f1..85485bf 100644 (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 *,
index d2a59d8..cc79f20 100644 (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)