Instead of always generating __wasm_apply_data_relocs when relevant options like -pie and -shared are specified, generate it only when the relevant relocations are actually necessary. Note: omitting empty __wasm_apply_data_relocs is not a problem because the export is optional in the spec (DynamicLinking.md) and all runtime linker implementations I'm aware of implement it that way. (emscripten, toywasm, wasm-tools) Motivations: * This possibly reduces the module size * This is also a preparation to fix https://github.com/llvm/llvm-project/issues/107387, for which it isn't obvious if we need these relocations at the time of createSyntheticSymbols. (unless we introduce a new explicit option like --non-pie-dynamic-link.)
46 lines
1.2 KiB
ArmAsm
46 lines
1.2 KiB
ArmAsm
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
|
|
# RUN: wasm-ld -shared --experimental-pic -o %t.so %t.o
|
|
# RUN: obj2yaml %t.so | FileCheck %s
|
|
|
|
.section .tdata.tls1,"",@
|
|
.globl tls1
|
|
.p2align 2
|
|
tls1:
|
|
.int32 1
|
|
.size tls1, 4
|
|
|
|
.section .custom_section.target_features,"",@
|
|
.int8 3
|
|
.int8 43
|
|
.int8 7
|
|
.ascii "atomics"
|
|
.int8 43
|
|
.int8 11
|
|
.ascii "bulk-memory"
|
|
.int8 43
|
|
.int8 15
|
|
.ascii "mutable-globals"
|
|
|
|
# CHECK: ExportInfo:
|
|
# CHECK-NEXT: - Name: tls1
|
|
# CHECK-NEXT: Flags: [ TLS ]
|
|
# CHECK-NEXT: - Type: TYPE
|
|
|
|
# CHECK: - Type: GLOBAL
|
|
# CHECK-NEXT: Globals:
|
|
# CHECK-NEXT: - Index: 2
|
|
# CHECK-NEXT: Type: I32
|
|
# CHECK-NEXT: Mutable: false
|
|
# CHECK-NEXT: InitExpr:
|
|
# CHECK-NEXT: Opcode: I32_CONST
|
|
# CHECK-NEXT: Value: 0
|
|
|
|
# CHECK: - Type: EXPORT
|
|
# CHECK-NEXT: Exports:
|
|
# CHECK-NEXT: - Name: __wasm_call_ctors
|
|
# CHECK-NEXT: Kind: FUNCTION
|
|
# CHECK-NEXT: Index: 0
|
|
# CHECK-NEXT: - Name: tls1
|
|
# CHECK-NEXT: Kind: GLOBAL
|
|
# CHECK-NEXT: Index: 2
|