aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-01-28 13:34:39 +0000
committerJakub Jelinek <jakub@redhat.com>2002-01-28 13:34:39 +0000
commit00e6e13d12377b6463072a112eb1f58b701abd6e (patch)
treef044897ab8cc608d15ff139874d1185d9d76a8cd
parent4867be4168ffab5aa3afecbe6473e429090ceace (diff)
downloadgdb-00e6e13d12377b6463072a112eb1f58b701abd6e.zip
gdb-00e6e13d12377b6463072a112eb1f58b701abd6e.tar.gz
gdb-00e6e13d12377b6463072a112eb1f58b701abd6e.tar.bz2
* 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.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/obj-elf.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9696d64..9d98f75 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 6ec0882..13c7482 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -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);
}
}
}