Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined symbol error in version script #55363

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Zentrik
Copy link
Member

@Zentrik Zentrik commented Aug 3, 2024

lld 17 and above by default error if symbols listed in the version script are undefined. Julia has a few of these, as some symbols are defined conditionally in Julia (e.g. based on OS), others perhaps have been removed from Julia and other seem to be defined in other libraries. Further the version script is used in linking three times, each time linking together different objects and so having different symbols defined.

Adding -Wl,--undefined-version is not a great solution as passing that to ld < 2.40 errors and there doesn't seem to be a great way to check if a linker supports this flag.
I don't know how to get around these errors for symbols like _IO_stdin_used which Julia doesn't define and it seems to matter whether or not they are exported, see https://libc-alpha.sourceware.narkive.com/SevIQmU3/io-stdin-used-stripped-by-version-scripts. So I've converted all undefined symbols into wildcards to work around the error.

Fixes #50414, fixes #54533 and replaces #55319.

lld 17 and above by default error if symbols listed in the version script are undefined. Julia has a few of these, as some symbols are defined conditionally in Julia (e.g. based on OS), others perhaps have been removed from Julia and other seem to be defined in other libraries. Further the version script is used in linking three times, each time linking together different objects and so having different symbols defined.

Adding `-Wl,--undefined-version` is not a great solution as passing that to ld < 2.40 errors and there doesn't seem to be a great way to check if a linker supports this flag.
I don't know how to get around these errors for symbols like `_IO_stdin_used` which Julia doesn't define and it seems to matter whether or not they are exported, see https://libc-alpha.sourceware.narkive.com/SevIQmU3/io-stdin-used-stripped-by-version-scripts.
So I've converted all undefined symbols into wildcards to work around the error.
@giordano giordano added the building Build system, or building Julia or its dependencies label Aug 3, 2024
Make.inc Show resolved Hide resolved
src/julia.expmap.in Outdated Show resolved Hide resolved
@fingolfin
Copy link
Contributor

Did you simply add * to all symbols? Or just those that caused you problems?

I wonder if applying this too widely might hide some issues? I.e. if a symbol truly is gone, and we just forgot to remove it from the version script then it might be good if on some platform we get an error, so that we can remove it (though it would be better if the error just showed on all platforms, otherwise "fringe" platforms suffer unfairly from "bugs" accidentally introduced by devs on the most active platforms).

That said, overall I'd like to approach these things pragmatically: this seems to resolve a real issue for people and I don't see any major downside, so I'd just apply it (and if somebody has a better idea: they are welcome to submit a PR improving things further).

@Zentrik
Copy link
Member Author

Zentrik commented Sep 3, 2024

I did add * to all symbols but iirc it's essentially required for all of them as libjulia-codegen doesn't use most of them, see codegen.expmap in https://github.com/JuliaLang/julia/pull/55319/files for a minimal expmap where I didn't add any * (only llvmGetPassPluginInfo gets used but that isn't used when linking flisp anyways).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
4 participants