aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-03 15:15:23 +1030
committerAlan Modra <amodra@gmail.com>2021-03-03 17:46:52 +1030
commitfd5c076a06d88dc53e56a17d43ea4ad5e27515a0 (patch)
tree6be5f0d9208e061037b5c5f8bc1c67e0e6f8f040 /binutils
parent5789f845fbf67d271e0f5ff154eb03319b551211 (diff)
downloadfsf-binutils-gdb-fd5c076a06d88dc53e56a17d43ea4ad5e27515a0.zip
fsf-binutils-gdb-fd5c076a06d88dc53e56a17d43ea4ad5e27515a0.tar.gz
fsf-binutils-gdb-fd5c076a06d88dc53e56a17d43ea4ad5e27515a0.tar.bz2
PR27493, objcopy --weaken-symbol does not weaken undefined symbols
PR 27493 * objcopy.c (filter_symbols): Apply --weaken to undefined symbols. * NEWS: Mention feature.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/NEWS3
-rw-r--r--binutils/objcopy.c3
3 files changed, 11 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3aec667..10ff167 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2021-03-03 Alan Modra <amodra@gmail.com>
+
+ PR 27493
+ * objcopy.c (filter_symbols): Apply --weaken to undefined symbols.
+ * NEWS: Mention feature.
+
2021-03-01 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/27486
diff --git a/binutils/NEWS b/binutils/NEWS
index d66944e..461ddab 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,5 +1,8 @@
-*- text -*-
+* objcopy --weaken, --weaken-symbol and --weaken-symbols now make undefined
+ symbols weak on targets that support weak symbols.
+
* Readelf and objdump can now display and use the contents of .debug_sup
sections.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 041acea..99e6cad 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1673,7 +1673,8 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
if (keep)
{
- if ((flags & BSF_GLOBAL) != 0
+ if (((flags & BSF_GLOBAL) != 0
+ || undefined)
&& (weaken || is_specified_symbol (name, weaken_specific_htab)))
{
sym->flags &= ~ BSF_GLOBAL;