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

Read target-abi from the first bitcode file for LTO #543

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

arichardson
Copy link
Member

Not exactly a clean approach but seems to work.

The current tests don't actually include the function in the output file.
I found this while trying to debug a LTO crash for CHERI-RISC-V that
wasn't reproducible with these tests until I changed them to actually
emit the function code. We could also override the entry symbol, but
changing the LLVM IR function name to _start seemed simpler.
This is done in a rather ugly way inside createTargetMachine(): when
the Config object is created, we haven't read the first llvm::Module yet
so we create a copy of the TargetOptions and update the ABIName there.
In the case of LTO invoked directly via LLD we might not have a valid
features string, so fall back to reading the ABI.
@arichardson arichardson requested a review from jrtc27 July 8, 2021 17:16
@arichardson arichardson marked this pull request as draft July 27, 2021 21:09
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.

1 participant