Created attachment 12988 [details] test.cpp, reduced from Qt qbytearray.cpp Since the following commit: commit bb68f22c8e648032a0d1c1d17353eec599ff5e6a Author: Fangrui Song <maskray@google.com> Date: Wed May 20 18:31:39 2020 -0700 ld: Handle --dynamic-list* before -Bsymbolic -Bsymbolic-functions there has been a behavior change when linking with "-Bsymbolic-functions --dynamic-list" To reproduce, use the attached test.cpp and dummy.dynlist and run: g++-9 -fPIC test.cpp -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list dummy.dynlist && objdump -R a.out | grep 'R_X86_64_GLOB_DAT.*_ZN1A10sharedDataE@@Base' ld before the change (309cae1f7b): match ld HEAD (abd20cb637): no match gold HEAD (abd20cb637): match ld HEAD (abd20cb637) when additionally specifying --dynamic-list-data: match -> It seems that -Bsymbolic-functions used to imply --dynamic-list-data, but after the change does not any more. The change was found when debugging a regression when compiling Qt 4 (qbytearray.cpp).
Created attachment 12989 [details] dummy.dynlist
Created attachment 12990 [details] For the record: libqt4 build fix
Dup. *** This bug has been marked as a duplicate of bug 26407 ***
"ld: Handle --dynamic-list* before -Bsymbolic -Bsymbolic-functions" actually fixes a bug. For a shared object, --dynamic-list dummy.dynlist means references to matched non-local STV_DEFAULT symbols shouldn't be bound to definitions within the shared object. Other references can be bound within the shared object. If you don't consider the DF_SYMBOLIC difference, --dynamic-list dummy.dynlist is identical to -Bsymbolic --dynamic-list dummy.dynlist Then, -Bsymbolic-functions -Bsymbolic --dynamic-list dummy.dynlist should be identical to -Bsymbolic --dynamic-list dummy.dynlist i.e. -Bsymbolic-functions should be a no-op. The old behavior does not make sense.
Thanks for clarifying. I was not sure whether the behavior change was intentional, since gold and ld behave differently now and I lack the domain knowledge to say which behavior is the right one.