Set hidden visibility on naked functions in compiler-builtins#151998
Set hidden visibility on naked functions in compiler-builtins#151998zmodem wants to merge 2 commits intorust-lang:mainfrom
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. |
|
I think this is probably the correct approach if we're doing it for regular functions, but r? @saethlin is probably the most familiar with these details and how this should be tested. There is also a check for symbol properties in compiler-builtins https://github.com/rust-lang/compiler-builtins/blob/0e5f78cd1963b89bf0b715c810919917e3fdce6b/crates/symbol-check/src/main.rs. If you're able, would you mind also submitting a PR there adding another |
|
cc @tgross35 |
9b63cc4 to
73d06be
Compare
|
Sorry, git had me confused for a bit.
Thanks for the pointer! That seems like a good way to test this. I've sent rust-lang/compiler-builtins#1073 |
|
I've updated the PR to handle statics as well, as symbol-check discovered that |
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.