Skip to content

Commit 7b269b6

Browse files
committed
[clang] Unify -mspeculative-load-hardening as a benign compiler option
Before this patch, compilations using modules & -mspeculative-load-hardening because of a configuration mismatch because it was not consistent whether this option impacts module compatibility. This repairs it by always treating it as benign. This was determined by checking if the option enables any kind of preprocessor checks and comparing how the compiler handles a similiar option that impacts codegen (-fvisibility=hidden) but is more widely used.
1 parent db6231b commit 7b269b6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ LANGOPT(BranchTargetEnforcement, 1, 0, NotCompatible, "Branch-target enforcement
454454
LANGOPT(BranchProtectionPAuthLR, 1, 0, NotCompatible, "Use PC as a diversifier using PAuthLR NOP instructions.")
455455
LANGOPT(GuardedControlStack, 1, 0, NotCompatible, "Guarded control stack enabled")
456456

457-
LANGOPT(SpeculativeLoadHardening, 1, 0, NotCompatible, "Speculative load hardening enabled")
457+
LANGOPT(SpeculativeLoadHardening, 1, 0, Benign, "Speculative load hardening enabled")
458458

459459
LANGOPT(RelativeCXXABIVTables, 1, 0, NotCompatible,
460460
"Use an ABI-incompatible v-table layout that uses relative references")

clang/test/ClangScanDeps/strip-codegen-args.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// CHECK-NOT: "-flto"
1717
// CHECK-NOT: "-fno-autolink"
1818
// CHECK-NOT: "-mrelax-relocations=no"
19+
// CHECK-NOT: "-mspeculative-load-hardening"
1920
// CHECK: ]
2021
// CHECK: "name": "A"
2122
// CHECK: }
@@ -39,6 +40,11 @@
3940
"command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -O2 -flto=full -fsyntax-only DIR/t3.m",
4041
"file": "DIR/t2.m"
4142
}
43+
{
44+
"directory": "DIR",
45+
"command": "clang -Imodules/A -fmodules -fmodules-cache-path=DIR/module-cache -fimplicit-modules -O2 -mspeculative-load-hardening -fsyntax-only DIR/t3.m",
46+
"file": "DIR/t3.m"
47+
}
4248
]
4349

4450
//--- modules/A/module.modulemap

0 commit comments

Comments
 (0)