-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Set hidden visibility on naked functions in compiler-builtins #151998
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
base: main
Are you sure you want to change the base?
Conversation
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
This comment has been minimized.
This comment has been minimized.
88b4646 made builtin functions hidden, but it doesn't apply to naked functions, which are generated through a different code path.
b8326fc to
73d06be
Compare
|
r? @tgross35 Also @bjorn3 and @folkertdev from rust-lang/compiler-builtins#349 (comment) I wasn't sure how to test this. Looking at the non-naked case for inspiration didn't help, since that doesn't seem tested either :-) I did verify locally that the symbols in libcompiler_builtins_compiler_builtins.rlib do get hidden. |
|
|
|
We have something to figure out here. Since #148339 the visibility (in LLVM IR) is actually hidden, but the assembly itself does not reflect that. So there is some sort of mismatch. A special-case for compiler-builtins seems a little hacky to me, though it is special of course. Can we do this in a more principled way? |
I'm not sure where it happens in the code, but based on this comment: rust/tests/assembly-llvm/naked-functions/hidden.rs Lines 18 to 19 in f60a0f1
it sounds intentional that the "hidden" part does not apply to
Agreed. It's a continuation of 88b4646. I think the ultimate principled way would be to have a function attribute for controlling visibility (#151425) and use it on the builtins. |
|
Right, I'd rather wait for that attribute I think, assuming that has a decent chance of making it in. If it's an urgent problem for compiler-builtins we could ask T-lang to bump its priority. |
This would not help for compiler-builtins. The special case for compiler-builtins needs to apply to all functions codegened as part of the compiler-builtins rlib, not just IMO copying the same logic as we already have for regular functions like this PR does is the right approach. |
88b4646 made builtin functions hidden, but it doesn't apply to naked functions, which are generated through a different code path.
This was discovered in #151486 where aarch64 outline atomics showed up in shared objects, overriding the symbols from compiler-rt.