[BOLT][AArch64] Refuse to run JTFootprintReduction pass (#193946)

JTFootprintReduction results in a no-op on AArch64. This is because it
emits createIJmp32Frag() which is unimplemented for AArch64 and is only
overridden by x86.

- Add a guard for non-x86
- Update unsupported-passes.test with expected error message
This commit is contained in:
Amina Chabane
2026-04-24 14:50:02 +01:00
committed by GitHub
parent aca5d1ed27
commit 8baf33522d
2 changed files with 7 additions and 1 deletions

View File

@@ -247,6 +247,11 @@ void JTFootprintReduction::optimizeFunction(BinaryFunction &Function,
}
Error JTFootprintReduction::runOnFunctions(BinaryContext &BC) {
if (!BC.isX86()) {
BC.errs() << "BOLT-ERROR: " << getName() << " is supported only on X86\n";
exit(1);
}
if (opts::JumpTables == JTS_BASIC && BC.HasRelocations)
return Error::success();

View File

@@ -5,9 +5,10 @@
RUN: %clang %cflags %p/../Inputs/hello.c -o %t -Wl,-q,-z,undefs
RUN: not llvm-bolt %t -o %t.bolt --frame-opt=all 2>&1 | FileCheck %s --check-prefix=CHECK-FRAME-OPT
RUN: not llvm-bolt %t -o %t.bolt --three-way-branch 2>&1 | FileCheck %s --check-prefix=CHECK-THREE-WAY
RUN: not llvm-bolt %t -o %t.bolt --jt-footprint-reduction 2>&1 | FileCheck %s --check-prefix=CHECK-JT-FOOTPRINT-REDUCTION
CHECK-FRAME-OPT: BOLT-ERROR: frame-optimizer is supported only on X86
CHECK-THREE-WAY: BOLT-ERROR: three way branch is supported only on X86
CHECK-JT-FOOTPRINT-REDUCTION: BOLT-ERROR: jt-footprint-reduction is supported only on X86
RUN: not llvm-bolt %t -o %t.bolt split-functions --split-strategy=cdsplit 2>&1 | FileCheck %s --check-prefix=CHECK-CDSPLIT
CHECK-CDSPLIT: BOLT-ERROR: CDSplit is not supported with LongJmp. Try with '--compact-code-model'