Skip to content

do not map llvm_features_by_flags back into Rust-level cfg(target_feature) - #160465

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:llvm_features_by_flags
Open

do not map llvm_features_by_flags back into Rust-level cfg(target_feature)#160465
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:llvm_features_by_flags

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 3, 2026

Copy link
Copy Markdown
Member

For some reason, we currently apply llvm_features_by_flags also to the "informational LLVM target machine" that we create to populate cfg(target_feature). This strikes me as odd: these are things that we do not treat as target features on the Rust level, why should they affect cfg(target_feature)?

From what I was able to find, the only LLVM target feature set by llvm_features_by_flags that has a corresponding Rust target feature is wasm's exception-handling. That one is unstable (tracking: #150260), so this PR should change nothing for stable users. On unstable, this PR means that if you set -Cpanic=unwind you no longer get cfg(target_feature = "exception-handling"). Is that okay? Is that a problem? I don't know. This behavior has been around since #121438 but it does not look like it was discussed much in that PR; it is not clear whether this was even intentional (this code is a total mess, after all).
What is even supposed to happen in cases like -Cpanic=unwind -Ctarget-feature=-exception-handling? It is very strange to have two flags both affect the same LLVM target feature. The easiest way to resolve this would be to mark the exception-handling target feature as "forbidden" so it can no longer be toggled via -Ctarget-feature. But that may be a bad idea?
Cc @bjorn3 @alexcrichton @cuviper @coolreader18

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2026
@rustbot

rustbot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

r? @mati865

rustbot has assigned @mati865.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 19 candidates

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [codegen] tests/codegen-llvm/asm/aarch64-clobbers.rs#aarch64_fixed_x18 stdout ----
------FileCheck stdout------------------------------

------FileCheck stderr------------------------------
/checkout/tests/codegen-llvm/asm/aarch64-clobbers.rs:40:23: error: aarch64_fixed_x18: expected string not found in input
// aarch64_fixed_x18: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"()
                      ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll:21:25: note: scanning from here
define void @clobber_abi() unnamed_addr #0 {
                        ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll:23:472: note: possible intended match here
 %0 = tail call { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w18},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() #1, !srcloc !6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ^

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll
Check file: /checkout/tests/codegen-llvm/asm/aarch64-clobbers.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'aarch64_clobbers.44a963439d1b1222-cgu.0' 
            2: source_filename = "aarch64_clobbers.44a963439d1b1222-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
            4: target triple = "aarch64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
            7: define void @cc_clobber() unnamed_addr #0 { 
            8: start: 
            9:  tail call void asm sideeffect "", "~{cc}"() #1, !srcloc !4 
           10:  ret void 
           11: } 
           12:  
           13: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
           14: define void @no_clobber() unnamed_addr #0 { 
           15: start: 
           16:  tail call void asm sideeffect "", ""() #1, !srcloc !5 
           17:  ret void 
           18: } 
           19:  
           20: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
           21: define void @clobber_abi() unnamed_addr #0 { 
check:40'0                             X~~~~~~~~~~~~~~~~~~~~ error: no match found
           22: start: 
check:40'0     ~~~~~~~
           23:  %0 = tail call { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w18},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() #1, !srcloc !6 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:40'1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           possible intended match
           24:  ret void 
check:40'0     ~~~~~~~~~~
           25: } 
check:40'0     ~~
           26:  
check:40'0     ~
           27: attributes #0 = { nounwind memory(inaccessiblemem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics,+reserve-x18" } 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           28: attributes #1 = { nounwind memory(inaccessiblemem: readwrite) } 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           29:  
check:40'0     ~
           30: !llvm.module.flags = !{!0, !1, !2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !llvm.ident = !{!3} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~
           32:  
check:40'0     ~
           33: !0 = !{i32 8, !"PIC Level", i32 2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           34: !1 = !{i32 7, !"uwtable", i32 2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           35: !2 = !{i32 7, !"frame-pointer", i32 1} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           36: !3 = !{!"rustc version 1.99.0-nightly (c309f9e23 2026-08-03)"} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           37: !4 = !{i64 4758823765076} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           38: !5 = !{i64 5428838663408} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           39: !6 = !{i64 15466177236497} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

------------------------------------------

error in revision `aarch64_fixed_x18`: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-21/bin/FileCheck" "--input-file" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll" "/checkout/tests/codegen-llvm/asm/aarch64-clobbers.rs" "--check-prefix=CHECK" "--check-prefix" "aarch64_fixed_x18" "--allow-unused-prefixes" "--dump-input-context" "100"
stdout: none
--- stderr -------------------------------
/checkout/tests/codegen-llvm/asm/aarch64-clobbers.rs:40:23: error: aarch64_fixed_x18: expected string not found in input
// aarch64_fixed_x18: asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"()
                      ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll:21:25: note: scanning from here
define void @clobber_abi() unnamed_addr #0 {
                        ^
/checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll:23:472: note: possible intended match here
 %0 = tail call { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w18},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() #1, !srcloc !6
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ^

Input file: /checkout/obj/build/aarch64-unknown-linux-gnu/test/codegen-llvm/asm/aarch64-clobbers.aarch64_fixed_x18/aarch64-clobbers.ll
Check file: /checkout/tests/codegen-llvm/asm/aarch64-clobbers.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'aarch64_clobbers.44a963439d1b1222-cgu.0' 
            2: source_filename = "aarch64_clobbers.44a963439d1b1222-cgu.0" 
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" 
            4: target triple = "aarch64-unknown-linux-gnu" 
            5:  
            6: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
            7: define void @cc_clobber() unnamed_addr #0 { 
            8: start: 
            9:  tail call void asm sideeffect "", "~{cc}"() #1, !srcloc !4 
           10:  ret void 
           11: } 
           12:  
           13: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
           14: define void @no_clobber() unnamed_addr #0 { 
           15: start: 
           16:  tail call void asm sideeffect "", ""() #1, !srcloc !5 
           17:  ret void 
           18: } 
           19:  
           20: ; Function Attrs: nounwind memory(inaccessiblemem: readwrite) uwtable 
           21: define void @clobber_abi() unnamed_addr #0 { 
check:40'0                             X~~~~~~~~~~~~~~~~~~~~ error: no match found
           22: start: 
check:40'0     ~~~~~~~
           23:  %0 = tail call { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } asm sideeffect "", "={w0},={w1},={w2},={w3},={w4},={w5},={w6},={w7},={w8},={w9},={w10},={w11},={w12},={w13},={w14},={w15},={w16},={w17},={w18},={w30},={q0},={q1},={q2},={q3},={q4},={q5},={q6},={q7},={q8},={q9},={q10},={q11},={q12},={q13},={q14},={q15},={q16},={q17},={q18},={q19},={q20},={q21},={q22},={q23},={q24},={q25},={q26},={q27},={q28},={q29},={q30},={q31},~{p0},~{p1},~{p2},~{p3},~{p4},~{p5},~{p6},~{p7},~{p8},~{p9},~{p10},~{p11},~{p12},~{p13},~{p14},~{p15},~{ffr}"() #1, !srcloc !6 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:40'1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           possible intended match
           24:  ret void 
check:40'0     ~~~~~~~~~~
           25: } 
check:40'0     ~~
           26:  
check:40'0     ~
           27: attributes #0 = { nounwind memory(inaccessiblemem: readwrite) uwtable "frame-pointer"="non-leaf" "probe-stack"="inline-asm" "target-cpu"="generic" "target-features"="+v8a,+outline-atomics,+reserve-x18" } 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           28: attributes #1 = { nounwind memory(inaccessiblemem: readwrite) } 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           29:  
check:40'0     ~
           30: !llvm.module.flags = !{!0, !1, !2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: !llvm.ident = !{!3} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~
           32:  
check:40'0     ~
           33: !0 = !{i32 8, !"PIC Level", i32 2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           34: !1 = !{i32 7, !"uwtable", i32 2} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           35: !2 = !{i32 7, !"frame-pointer", i32 1} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           36: !3 = !{!"rustc version 1.99.0-nightly (c309f9e23 2026-08-03)"} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           37: !4 = !{i64 4758823765076} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           38: !5 = !{i64 5428838663408} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
           39: !6 = !{i64 15466177236497} 
check:40'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>
------------------------------------------

---- [codegen] tests/codegen-llvm/asm/aarch64-clobbers.rs#aarch64_fixed_x18 stdout end ----

failures:
    [codegen] tests/codegen-llvm/asm/aarch64-clobbers.rs#aarch64_fixed_x18

test result: FAILED. 923 passed; 1 failed; 222 ignored; 0 measured; 3 filtered out; finished in 17.72s

@alexcrichton

Copy link
Copy Markdown
Member

I think it's reasonable to consider the exception-handling LLVM-level feature an implementation detail of wasm targets. There's already cfg(panic = "abort") and such to effectively test this on stable, and that's largely what Rust code should be using instead. Which is to say that while I don't fully understand this change if it's tweaking exception-handling and/or if exception-handling becomes a private feature I think that's fine. I suspect most historical work around this is along the lines of "align the various bits and pieces of implementation across LLVM, rustc, libstd, etc" and getting something working. The exception-handling feature in general isn't 100% done yet.

@RalfJung

RalfJung commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Looking at that CI failure...

What I did not realize is that we put "forbidden" target features into sess.unstable_target_features, and other parts of rustc will query them from there. I don't think we should do that but, uh, this could be non-trivial to clean up... in particular sess.unstable_target_features is forwarded deep into the inline asm logic where I am getting quite lost. The fact that rustc_target cannot access &Session makes this very awkward. IMO the inline asm validation logic in compiler/rustc_target/src/asm/mod.rs should move somewhere where &Session is available, since it fundamentally needs to know about the session configuration. Currently we shove everything relevant from the session into a FxIndexSet<Symbol> and call it "target features" but that's a pretty bad hack and flies in the face of all the work we did to separate Rust target features from LLVM target features. @Amanieu any ideas how to best improve this?

For this PR that means we have to be on the look for things checking for the retpoline stuff or reserved-x18 in sess.unstable_target_features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants