File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1+ ;; The explicit relocation model flag.
2+
3+ ; RUN: llvm-as %s -o %t.o
4+
5+ ; RUN: wasm-ld %t.o -o %t.wasm -save-temps -r -mllvm -relocation-model=pic
6+ ; RUN: llvm-readobj -r %t.wasm.lto.o | FileCheck %s --check-prefix=PIC
7+
8+ ; RUN: wasm-ld %t.o -o %t_static.wasm -save-temps -r -mllvm -relocation-model=static
9+ ; RUN: llvm-readobj -r %t_static.wasm.lto.o | FileCheck %s --check-prefix=STATIC
10+
11+ ; PIC: R_WASM_GLOBAL_INDEX_LEB foo
12+ ; STATIC: R_WASM_MEMORY_ADDR_LEB foo
13+
14+ target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
15+ target triple = "wasm32-unknown-unknown"
16+
17+ @foo = external global i32
18+ define i32 @_start () {
19+ %t = load i32 , i32* @foo
20+ ret i32 %t
21+ }
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ static lto::Config createConfig() {
5757 c.DebugPassManager = ctx.arg .ltoDebugPassManager ;
5858 c.AlwaysEmitRegularLTOObj = !ctx.arg .ltoObjPath .empty ();
5959
60- if (ctx.arg .relocatable )
60+ if (auto relocModel = getRelocModelFromCMModel ())
61+ c.RelocModel = *relocModel;
62+ else if (ctx.arg .relocatable )
6163 c.RelocModel = std::nullopt ;
6264 else if (ctx.isPic )
6365 c.RelocModel = Reloc::PIC_;
You can’t perform that action at this time.
0 commit comments