-
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
Prologue of function missing in FatLTO but present in ThinLTO #103619
Comments
@MasterAwesome Pardon, but what's the practical implication of this regression? Does it cause some sort of runtime problem, is it a code-size or performance problem, or something else? I'm afraid I can't read assembly. |
The The fact that the |
The In fact we don't know where in LLVM this is breaking yet which means even on release we could theoretically have this issue. TLDR: It is a runtime problem that can cause a synchronous abort. It was working till LLVM-14; Broke during upgrade to LLVM-15 |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Not particular familiar with BTI, but if this works anything like CET I'd expect it to be an "all or nothing" thing. Your full LTO build likely contains a module that does not use BTI, so it's not possible to use CFI for anything. Does this actually work with thin LTO and not just get automatically disabled at a higher layer due to a missing GNU property note on the object that causes this to be disabled in the full LTO case? |
The difference between debug and release here is likely just that debug ends up using code from libstd (which presumably does not have BTI enabled, unless you're using So at least on the surface, I think everything works as expected here. |
Right, but this is broken even with build-std as mentioned in the other thread as of nightly 2022-08-14.
correct, there's a module that's not part of std or something that's getting compiled with BTI attribute in the llvm ir off. Not sure what it is because it doesn't have a name just some hash? And this doesn't work in both release and debug refer #102162 I've also pasted the llvm ir in the regressed version where the code is just as straight forward to be inlined on release. And in bigger libraries, like the one I'm testing on an arm platform. This causes a synchronous abort unless I use the PS: I'd love to contribute whether it's documentation or a code change. Let me know :) |
Looks like on debug mode, Using I still think the Min of all branch-target-enforcement is a wrong approach since the application requesting it requires it which should propagate across dependent modules and rebuild if needed. With |
Looks like this is LLVM-15's expected behaviour to accept This results in the As to why this doesn't show up on release builds on Fat LTO is because the modules required for the min never show up causing the min to be only the crate alone. For debug builds on this particular issue, it causes The only thing left is to support LLVM-15's |
Compiling with branch-target-enforcement = 1(
-Zbranch-protection=bti
) onaarch64-unknown-linux-gnu
causes different code to emitted in the prologue of the function for fat LTO and thin LTO in debug mode.Baseline assembly for function add defined as follows:
compiled into a
cdylib
.[DEBUG] llvm-objdump on ThinLTO
[DEBUG] llvm-objdump on FatLTO
[RELEASE] llvm-objdump on both FatLTO and ThinLTO
rustc version with failure first occuring:
cargo-bisect-rustc
searched nightlies: from nightly-2022-08-12 to nightly-2022-08-14
regressed nightly: nightly-2022-08-13
searched commit range: 20ffea6...f22819b
regressed commit: e2b52ff
bisected with cargo-bisect-rustc v0.6.4
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
Might be related to: #102162 as reverting the same patches in that issue solves the problem.
The text was updated successfully, but these errors were encountered: