Skip to content

Commit e5a1556

Browse files
committed
RuntimeLibcalls: Account for Triple default exception handling
Previously we were taking the raw TargetOptions exception mode. This only works correctly for the TargetLowering usage, when the -exception-model flag is explicitly used. The interface isn't great, and interprets none to both mean use target default and unsupported, such that it's not possible to opt-out of exceptions on targets that report a non-none default. We also still get the wrong mode in the linker usecase of RuntimeLibcalls since it doesn't have the TargetMachine. But at least wrongly being the default is an improvement over being unset. I'm not really sure how to write a test for this.
1 parent 2bd31ed commit e5a1556

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ struct RuntimeLibcallsInfo {
5353
EABI EABIVersion = EABI::Default, StringRef ABIName = "") {
5454
initSoftFloatCmpLibcallPredicates();
5555
initDefaultLibCallImpls();
56+
57+
// FIXME: The ExceptionModel parameter is to handle the field in
58+
// TargetOptions. This interface fails to distinguish the forced disable
59+
// case for targets which support exceptions by default. This should
60+
// probably be a module flag and removed from TargetOptions.
61+
if (ExceptionModel == ExceptionHandling::None)
62+
ExceptionModel = TT.getDefaultExceptionHandling();
63+
5664
initLibcalls(TT, ExceptionModel, FloatABI, EABIVersion, ABIName);
5765
}
5866

0 commit comments

Comments
 (0)