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 emitting asm and object file output at the same time #29385

Closed
wants to merge 1 commit into from

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Oct 26, 2015

The LLVM function to output file types that involve codegen can
invalidate the IR while lowering. That means that the second time the IR
is fed to those passes, it's invalid and the LLVM verifier complains. To
workaround this, we can tell the function to skip the codegen passes the
second time around. To do this, we tell it to start adding passes only
after it has seen a pass that doesn't exist at all. Quite the hack, I
know...

Fixes #24876

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -244,11 +245,17 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target,
return false;
}

// Use a pass ID that doesn't identify any pass, so all the codegen passes
// are skipped. This lets us output both asm and obj files from the same LLVM
// module in a single run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you expand this comment a bit to explain why this is here at all?

@alexcrichton
Copy link
Member

Could a run-pass test also be added to ensure this doesn't regress?

The LLVM function to output file types that involve codegen can
invalidate the IR while lowering. That means that the second time the IR
is fed to those passes, it's invalid and the LLVM verifier complains. To
workaround this, we can tell the function to skip the codegen passes the
second time around. To do this, we tell it to start adding passes only
after it has seen a pass that doesn't exist at all. Quite the hack, I
know...

Fixes rust-lang#24876
@dotdash
Copy link
Contributor Author

dotdash commented Oct 27, 2015

Updated

@alexcrichton
Copy link
Member

@bors: r+ b90aa66

@bors
Copy link
Contributor

bors commented Oct 28, 2015

⌛ Testing commit b90aa66 with merge 1d5948b...

@bors
Copy link
Contributor

bors commented Oct 28, 2015

💔 Test failed - auto-win-gnu-32-nopt-t

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit! (r=me if so)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants