@@ -127,16 +127,11 @@ LLVMInitializeWebAssemblyTarget() {
127127// WebAssembly Lowering public interface.
128128// ===----------------------------------------------------------------------===//
129129
130- static Reloc::Model getEffectiveRelocModel (std::optional<Reloc::Model> RM,
131- const Triple &TT) {
132- if (!RM) {
133- // Default to static relocation model. This should always be more optimial
134- // than PIC since the static linker can determine all global addresses and
135- // assume direct function calls.
136- return Reloc::Static;
137- }
138-
139- return *RM;
130+ static Reloc::Model getEffectiveRelocModel (std::optional<Reloc::Model> RM) {
131+ // Default to static relocation model. This should always be more optimial
132+ // than PIC since the static linker can determine all global addresses and
133+ // assume direct function calls.
134+ return RM.value_or (Reloc::Static);
140135}
141136
142137using WebAssembly::WasmEnableEH;
@@ -197,7 +192,7 @@ WebAssemblyTargetMachine::WebAssemblyTargetMachine(
197192 const TargetOptions &Options, std::optional<Reloc::Model> RM,
198193 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, bool JIT)
199194 : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
200- getEffectiveRelocModel(RM, TT ),
195+ getEffectiveRelocModel(RM),
201196 getEffectiveCodeModel(CM, CodeModel::Large), OL),
202197 TLOF(new WebAssemblyTargetObjectFile()),
203198 UsesMultivalueABI(Options.MCOptions.getABIName() == "experimental-mv") {
0 commit comments