[ELF] Refine isExported/isPreemptible condition
commit994cea3f0a2d0caf4d66321ad5a06ab330144d89
authorFangrui Song <i@maskray.me>
Sat, 1 Feb 2025 04:37:17 +0000 (31 20:37 -0800)
committerFangrui Song <i@maskray.me>
Sat, 1 Feb 2025 04:37:18 +0000 (31 20:37 -0800)
treeede1e2e205b342817252dc07fb8acf875b9848ea
parent386af4a5c64ab75eaee2448dc38f2e34a40bfed0
[ELF] Refine isExported/isPreemptible condition

Commit f10441ad003236ef3b9e5415a571d2be0c0ce5ce dropped a special case
for isUndefWeak and --no-dynamic-linking but also made --export-dynamic
ineffective for static PIE.

This change restores the --export-dynamic behavior and entirely drops
special handling of --no-dynamic-linker:

* -pie with no input DSO, similar to --no-dynamic-linker, suppresses
  undefined symbols in .dynsym

The new behaviors resemble GNU ld more.
12 files changed:
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Symbols.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/Writer.cpp
lld/test/ELF/executable-undefined-ignoreall.s
lld/test/ELF/ppc32-weak-undef-call.s
lld/test/ELF/ppc64-undefined-weak.s
lld/test/ELF/riscv-gp.s
lld/test/ELF/weak-undef-lib.s
lld/test/ELF/weak-undef-no-dynamic-linker.s
lld/test/ELF/weak-undef-rw.s