* config/obj-elf.c (elf_frob_file_before_adjust): Remove symbols
authorJakub Jelinek <jakub@redhat.com>
Mon, 28 Jan 2002 13:34:39 +0000 (13:34 +0000)
committerJakub Jelinek <jakub@redhat.com>
Mon, 28 Jan 2002 13:34:39 +0000 (13:34 +0000)
made because of .weak, if they are neither defined nor used in any
way.

gas/ChangeLog
gas/config/obj-elf.c

index 9696d64a7c9d3139fbaf0e18a367a1478b22800c..9d98f75ed3f6aef314afaee511601eeaf7c65c36 100644 (file)
@@ -1,3 +1,9 @@
+2002-01-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * config/obj-elf.c (elf_frob_file_before_adjust): Remove symbols
+       made because of .weak, if they are neither defined nor used in any
+       way.
+
 2002-01-27  Daniel Jacobowitz  <drow@mvista.com>
 
        * configure: Regenerated.
index 6ec08820242c07bc357b1cefacb9acff2046b383..13c748211c499c21c6d3f9b74ea0a04bff9094f1 100644 (file)
@@ -1995,9 +1995,9 @@ elf_frob_file_before_adjust ()
       symbolS *symp;
 
       for (symp = symbol_rootP; symp; symp = symbol_next (symp))
-       if (symbol_get_obj (symp)->versioned_name)
+       if (!S_IS_DEFINED (symp))
          {
-           if (!S_IS_DEFINED (symp))
+           if (symbol_get_obj (symp)->versioned_name)
              {
                char *p;
 
@@ -2017,6 +2017,14 @@ elf_frob_file_before_adjust ()
                    && symbol_used_in_reloc_p (symp) == 0)
                  symbol_remove (symp, &symbol_rootP, &symbol_lastP);
              }
+
+           /* If there was .weak foo, but foo was neither defined nor
+              used anywhere, remove it.  */
+
+           else if (S_IS_WEAK (symp)
+                    && symbol_used_p (symp) == 0
+                    && symbol_used_in_reloc_p (symp) == 0)
+             symbol_remove (symp, &symbol_rootP, &symbol_lastP);
          }
     }
 }