27 lines · plain
1;; The explicit relocation model flag.2 3; RUN: llvm-as %s -o %t.o4 5; RUN: wasm-ld %t.o -o %t.wasm -save-temps -r -mllvm -relocation-model=pic6; RUN: llvm-readobj -r %t.wasm.lto.o | FileCheck %s --check-prefix=PIC7 8; RUN: wasm-ld %t.o -o %t_static.wasm -save-temps -r -mllvm -relocation-model=static9; RUN: llvm-readobj -r %t_static.wasm.lto.o | FileCheck %s --check-prefix=STATIC10 11;; Linking with --unresolved-symbols=import-dynamic should also generate PIC12;; code for external references.13; RUN: wasm-ld %t.o -o %t_import.wasm -save-temps --experimental-pic --unresolved-symbols=import-dynamic14; RUN: llvm-readobj -r %t_import.wasm.lto.o | FileCheck %s --check-prefix=PIC15 16; PIC: R_WASM_GLOBAL_INDEX_LEB foo17; STATIC: R_WASM_MEMORY_ADDR_LEB foo18 19target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"20target triple = "wasm32-unknown-unknown"21 22@foo = external global i3223define i32 @_start() {24 %t = load i32, i32* @foo25 ret i32 %t26}27