* PR27493, objcopy --weaken-symbol does not weaken undefined symbols
@ 2021-03-03 7:15 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2021-03-03 7:15 UTC (permalink / raw)
To: binutils
PR 27493
* objcopy.c (filter_symbols): Apply --weaken to undefined symbols.
* NEWS: Mention feature.
diff --git a/binutils/NEWS b/binutils/NEWS
index d66944e95e..2e93100a38 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 041aceaeef..99e6cad72e 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;
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-03 7:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 7:15 PR27493, objcopy --weaken-symbol does not weaken undefined symbols Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).