+2022-03-16 Fangrui Song <maskray@google.com>
+
+ PR binutils/28926
+ * objcopy.c (filter_symbols): Apply weaken to STB_GNU_UNIQUE symbols
+ * NEWS: Mention feature.
+ * testsuite/binutils-all/objcopy.exp (objcopy_test_symbol_manipulation): New test.
+ * testsuite/binutils-all/weaken-gnu-unique.s: New.
+
2022-03-16 Martin Storsjö <martin@martin.st>
PR 28885
* Add an option to objdump and readelf to prevent attempts to access debuginfod
servers when following links.
+* objcopy --weaken, --weaken-symbol, and --weaken-symbols now make ELF
+ STB_GNU_UNIQUE symbols weak.
Changes in 2.38:
if (keep)
{
- if (((flags & BSF_GLOBAL) != 0
+ if (((flags & (BSF_GLOBAL | BSF_GNU_UNIQUE))
|| undefined)
&& (weaken || is_specified_symbol (name, weaken_specific_htab)))
{
- sym->flags &= ~ BSF_GLOBAL;
+ sym->flags &= ~ (BSF_GLOBAL | BSF_GNU_UNIQUE);
sym->flags |= BSF_WEAK;
}
verbose [file rootname $t]
run_dump_test [file rootname $t]
}
+
+ if { [supports_gnu_unique] } {
+ run_dump_test "weaken-gnu-unique"
+ }
}
proc objcopy_test_elf_common_symbols {} {
--- /dev/null
+#name: weaken STB_GNU_UNIQUE symbols
+#PROG: objcopy
+#objcopy: -W foo
+#source: unique.s
+#readelf: -s
+
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9]+ +OBJECT +WEAK +DEFAULT +[1-9] foo