Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,15 @@ pub(crate) unsafe fn create_module<'ll>(
);
}

if llvm_version >= (24, 0, 0) && wants_wasm_eh(&sess.target) {
llvm::add_module_flag_str(
llmod,
llvm::ModuleFlagMergeBehavior::Error,
"exception-model",
"wasm",
);
}

// Add module flags specified via -Z llvm_module_flag
for (key, value, merge_behavior) in &sess.opts.unstable_opts.llvm_module_flag {
let merge_behavior = match merge_behavior.as_str() {
Expand Down
9 changes: 5 additions & 4 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,11 @@ extern "C" void LLVMRustAddLibraryInfo(LLVMTargetMachineRef T,
TLII.disableAllFunctions();
unwrap(PMR)->add(new TargetLibraryInfoWrapperPass(TLII));
#if LLVM_VERSION_GE(24, 0)
// LLVM 24 removed TargetOptions::EABIVersion; the EABI version is now
// derived from the target triple instead.
unwrap(PMR)->add(new RuntimeLibraryInfoWrapper(
Options->ExceptionModel, Options->MCOptions.ABIName, Options->VecLib));
// LLVM 24 removed TargetOptions::EABIVersion and ExceptionModel; the EABI
// version and exception model are now derived from the target triple and
// module flags respectively instead.
unwrap(PMR)->add(new RuntimeLibraryInfoWrapper(Options->MCOptions.ABIName,
Options->VecLib));
#elif LLVM_VERSION_GE(22, 0)
unwrap(PMR)->add(new RuntimeLibraryInfoWrapper(
TargetTriple, Options->ExceptionModel, Options->FloatABIType,
Expand Down
Loading