[ELF] Allow STV_PROTECTED shared definition to set exportDynamic
authorFangrui Song <i@maskray.me>
Sat, 5 Feb 2022 09:10:43 +0000 (01:10 -0800)
committerFangrui Song <i@maskray.me>
Sat, 5 Feb 2022 09:10:43 +0000 (01:10 -0800)
commit9e08e9298059651e4f42eb608c3de9d4ad8004b2
tree635065c5fe40aa23303689792304a84cea3bcb13
parenta37c38176a5a1f797e6bc2b8771be017394e8e32
[ELF] Allow STV_PROTECTED shared definition to set exportDynamic

A STV_PROTECTED shared definition does not set exportDynamic of a defined
symbol. This is on the basis that a protected definition cannot be preempted so
the export is unnecessary. However, the condition is imperfect because we don't
know whether the shared object was built with a symbolic option. Since dropping
the condition simplifies code and matches GNU ld, let's do it.
lld/ELF/LTO.cpp
lld/ELF/Symbols.h
lld/test/ELF/lto/unnamed-addr-lib.ll