; RUN: llc -relocation-model=pic -mattr=+mutable-globals -filetype=obj %s -o %t.o
-; RUN: wasm-ld --no-gc-sections --allow-undefined -pie -o %t.wasm %t.o
+; RUN: wasm-ld --no-gc-sections --allow-undefined --experimental-pic -pie -o %t.wasm %t.o
; RUN: obj2yaml %t.wasm | FileCheck %s
target triple = "wasm32-unknown-emscripten"
ret void
}
+; CHECK: Sections:
+; CHECK-NEXT: - Type: CUSTOM
+; CHECK-NEXT: Name: dylink
+; CHECK-NEXT: MemorySize: 16
+; CHECK-NEXT: MemoryAlignment: 2
+; CHECK-NEXT: TableSize: 1
+; CHECK-NEXT: TableAlignment: 0
+; CHECK-NEXT: Needed: []
+
; CHECK: - Type: IMPORT
; CHECK-NEXT: Imports:
; CHECK-NEXT: - Module: env
if (WasmSym::dataEnd)
WasmSym::dataEnd->setVirtualAddress(memoryPtr);
- log("mem: static data = " + Twine(memoryPtr - dataStart));
-
- if (config->shared) {
- out.dylinkSec->memSize = memoryPtr;
+ uint64_t staticDataSize = memoryPtr - dataStart;
+ log("mem: static data = " + Twine(staticDataSize));
+ if (config->isPic) {
+ out.dylinkSec->memSize = staticDataSize;
return;
}
Twine(maxMemorySetting));
memoryPtr = config->initialMemory;
}
- out.dylinkSec->memSize = memoryPtr;
out.memorySec->numMemoryPages =
alignTo(memoryPtr, WasmPageSize) / WasmPageSize;
log("mem: total pages = " + Twine(out.memorySec->numMemoryPages));