-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Share the naked asm impl between cg_ssa and cg_clif #134232
base: master
Are you sure you want to change the base?
Conversation
cc @folkertdev |
r? @chenyukang rustbot has assigned @chenyukang. Use |
This comment has been minimized.
This comment has been minimized.
b8677a2
to
d6b3c06
Compare
This comment has been minimized.
This comment has been minimized.
d6b3c06
to
0dd4292
Compare
Some changes occurred in compiler/rustc_codegen_gcc |
if let Visibility::Hidden = item_data.visibility { | ||
writeln!(begin, ".hidden {asm_name}").unwrap(); | ||
match item_data.visibility { | ||
Visibility::Default => {} | ||
Visibility::Protected => writeln!(begin, ".protected {asm_name}").unwrap(), | ||
Visibility::Hidden => writeln!(begin, ".hidden {asm_name}").unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we discussed documenting https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/mono/enum.Visibility.html a while ago, now might be a good time for that? (you had some ideas for that I believe)?
Also I don't think .hidden
and .protected
are ever hit by tests, is there any way we could reach them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we discussed documenting https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/mono/enum.Visibility.html a while ago, now might be a good time for that? (you had some ideas for that I believe)?
Will open a separate PR for that. Edit: #134261
Also I don't think .hidden and .protected are ever hit by tests, is there any way we could reach them?
You can set the visibility for all symbols using -Zdefault-visibility
. Also I'm not sure if using .protected
or .hidden
in case of internal linkage will cause the symbol to be exported anyway, but that is a pre-existing issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's fine, we just want to make sure that naked functions behave like standard functions
☔ The latest upstream changes (presumably #134381) made this pull request unmergeable. Please resolve the merge conflicts. |
42ae211
to
1358f53
Compare
1358f53
to
dcf8b87
Compare
r? compiler |
☔ The latest upstream changes (presumably #135959) made this pull request unmergeable. Please resolve the merge conflicts. |
While LLVM is rather permissive in this regards, some other codegen backends demand that once you declare a function for definition you actually define contents of the function, which doesn't happen for naked functions as we actually generate assembly for them.
This allows it to be reused by codegen backends that don't use cg_ssa like cg_clif.
dcf8b87
to
0b43964
Compare
This was introduced in #128004.