Quote version script symbols#158607
Conversation
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @TaKO8Ki (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
Can you check if this fixes #38238? |
Thanks for referencing the issue! This PR does indeed fix it. Just a comment about trailing spaces in |
|
☔ The latest upstream changes (presumably #158663) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Hi
rustcgenerates an LD version script in the following format:However, the symbols are not quoted, which means that the following code will cause a linker failure because the gnerated LD version script has an invalid syntax.
Special characters such as
$,/,., and:are valid for a symbol name in an ELF binary. LD Script Format documentation specifies (same rules apply for symbols and file names):This PR quotes each symbol name before adding it to the
global:section. This allows exported symbols containing linker-special characters, such as$,::,/,., and:, to be handled correctly by the linker:The new run-make test builds a
cdylibwith anexport_namecontaining those characters and verifies that the exact symbol is exported from the produced shared object.Cheers
Alex