-
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
Make globals with private linkage unnamed. Fixes #50862. #51007
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
I'm not sure if doing this unconditionally (i.e. even under --emit=llvm-ir for example) is a good idea. While |
r? @nagisa |
src/librustc_codegen_llvm/declare.rs
Outdated
/// Use this function when you intend to define a global without a name. | ||
pub fn define_private_global(cx: &CodegenCx, ty: Type) -> ValueRef { | ||
unsafe { | ||
llvm::LLVMRustGetOrInsertGlobal(cx.llmod, ptr::null(), ty.to_ref()) |
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.
This should probably also set the appropriate linkage, so that the users of this function don’t need to do that.
@AstralSorcerer can you make elision of names |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r+ |
📌 Commit f464e66 has been approved by |
⌛ Testing commit f464e66ecf75032a873173e609af7a428cc2d75b with merge 087dd0b6a5feb6349368ae17efe6433bc6e3867e... |
💔 Test failed - status-appveyor |
|
ping @QuietMisdreavus |
let using_thin_buffers = config.emit_bc || config.obj_is_bitcode | ||
|| config.emit_bc_compressed || config.embed_bitcode; | ||
let prepare_for_thin_lto = cgcx.lto == Lto::Thin || cgcx.lto == Lto::ThinLocal | ||
|| using_thin_buffers; |
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.
Note that PrepareForThinLTO also disables various unrolling / vectorization passes. That's desired if ThinLTO is actually used, but I suspect it's not what you want if we're just embedding bitcode.
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.
It's probably sufficient for this case to just run the NameAnonGlobals pass (the unnamed globals are what's causing problems with the thin buffers).
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.
That should indeed be sufficient. I'm wondering though why bytecode emission is still done using ThinLTOBitcodeWriter, even if ThinLTO is not used.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r+ |
📌 Commit e146f3c has been approved by |
Ping from triage @AstralSorcerer! It's been a while since we heard from you, will you have time to work on this again? |
Yep! I'd already addressed the changes that were requested, I just hadn't had time to deal with a rebase until recently.
|
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Emitting LLVM bitcode uses ThinLTOBuffers, so we need to prepare for thin LTO or we will likely cause errors in LLVM.
@bors r+ |
📌 Commit 3da7c65 has been approved by |
⌛ Testing commit 3da7c65 with merge 15e6466dbe623959e65ac3d456ccda44671e67fb... |
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☀️ Test successful - status-appveyor, status-travis |
cc @oli-obk @nagisa