[llvm-objcopy] --weaken-symbol/--weaken: weaken STB_GNU_UNIQUE symbols
authorFangrui Song <i@maskray.me>
Wed, 16 Mar 2022 16:48:19 +0000 (09:48 -0700)
committerFangrui Song <i@maskray.me>
Wed, 16 Mar 2022 16:48:19 +0000 (09:48 -0700)
commit30718f3aa62b81c2814564d2ca08888435202655
treee3cdff4e174206ed046e151d0c32acec3ac71f99
parent555df030121aeaaf33b1a89489960a77ef94d472
[llvm-objcopy] --weaken-symbol/--weaken: weaken STB_GNU_UNIQUE symbols

STB_GNU_UNIQUE is like STB_GLOBAL with extra semantics:

* gold and ld.lld: changed to STB_GLOBAL if --no-gnu-unique is specified
* glibc: unique even with dlopen `RTLD_LOCAL`, implies DF_1_NODELETE

Therefore, I think it makes sense for --weaken-symbol/--weaken-symbols/--weaken
to change STB_GNU_UNIQUE symbols.

binutils 2.39 will have the same behavior: https://sourceware.org/bugzilla/show_bug.cgi?id=28926

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D120638
llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
llvm/test/tools/llvm-objcopy/ELF/weaken-all.test
llvm/test/tools/llvm-objcopy/ELF/weaken.test