zig
zig copied to clipboard
Allow `--version-script` for executables with dynsym
When executable has -rdynamic this adds --export-dynamic to linker argument with no way to control the exported dynamic symbols. Version script can be used here to control symbols.
Tests:
- Linker appends
-version-scriptfor binaries when-rdynamicis present. - Linker doesn't append
-version-scriptfor binaries when-rdynamicisn't present. -
$ stage4/bin/zig build test -Denable-llvm -Dskip-release -Dskip-non-native
$ nm -D ./main # See linked issue for code
0000000001000a18 R FOO
$ llvm-readelf -Ss ./main
<snipped>
[ 6] .custom PROGBITS 0000000001000a18 000a18 000004 00 A 0 0 1
<snipped>
Closes: #19870