Skip to content

LTO doesn't store -mcmodel= information in the bitcode files #32653

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

Closed
petrhosek opened this issue Jun 5, 2017 · 6 comments
Closed

LTO doesn't store -mcmodel= information in the bitcode files #32653

petrhosek opened this issue Jun 5, 2017 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:codegen IR generation bugs: mangling, exceptions, etc.

Comments

@petrhosek
Copy link
Member

Bugzilla Link 33306
Resolution FIXED
Resolved on Sep 24, 2018 11:01
Version trunk
OS All
CC @cmtice,@frobtech

Extended Description

LTO doesn't store -mcmodel= information in the bitcode files as it does for many other codegen options and this has to be passed explicitly when invoking linker through the -mllvm -code-model= flag.

@petrhosek
Copy link
Member Author

assigned to @cmtice

@llvmbot
Copy link
Member

llvmbot commented Jun 16, 2017

Interesting. Do you have a repro where this matters, Petr? Thanks in advance!

@petrhosek
Copy link
Member Author

Yes, in Fuchsia on AArch64 -mcmodel=kernel is different from -mcmodel=small, concretely it moves the thread pointer from TPIDR_EL0 to TPIDR_EL1, see https://reviews.llvm.org/D31624. We're trying to enable LTO for our kernel and we hit this issue.

@frobtech
Copy link
Contributor

-fPIE (and presumably -fPIC and all the related variants) seems to be in the same boat. But I can't even figure out how to force that with an lld -mllvm option as we do with -mllvm -code-model=kernel. Should we file that as a separate bug or consider it part of this one?

I think it's a general bug if there's anything on the individual TU command line that's lost in LTO so that you can't just use the exact same command lines with the sole addition of -flto for your compile and link steps.

@frobtech
Copy link
Contributor

Hmm, looks like PIC/PIE is encoded in IR metadata.
But LTO codegen seems to be ignoring it in the Zircon (Fuchsia) kernel build.

@cmtice
Copy link
Contributor

cmtice commented Sep 24, 2018

I believe https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323 fix this problem. They definitely fix the issue of passing the mcmodel information to LTO.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen IR generation bugs: mangling, exceptions, etc.
Projects
None yet
Development

No branches or pull requests

4 participants