zig icon indicating copy to clipboard operation
zig copied to clipboard

Allow `--version-script` for executables with dynsym

Open MasterAwesome opened this issue 1 year ago • 0 comments

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-script for binaries when -rdynamic is present.
  • Linker doesn't append -version-script for binaries when -rdynamic isn'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

MasterAwesome avatar May 06 '24 00:05 MasterAwesome