# Verify that we do not generate dynamic relocations for the GOT entry.
-# CHECK-NOT: __wasm_apply_relocs
+# CHECK-NOT: __wasm_apply_global_relocs
# Verify that we do not generate an import for foo
# CHECK-NEXT: Value: 66560
# Global 'undefined_weak:foo' representing the GOT entry for foo
# Unlike other internal GOT entries that need to be mutable this one
-# is immutable and not updated by `__wasm_apply_relocs`
+# is immutable and not updated by `__wasm_apply_global_relocs`
# CHECK-NEXT: - Index: 1
# CHECK-NEXT: Type: I32
# CHECK-NEXT: Mutable: false
WasmGlobal global;
// In the case of dynamic linking, internal GOT entries
// need to be mutable since they get updated to the correct
- // runtime value during `__wasm_apply_relocs`.
+ // runtime value during `__wasm_apply_global_relocs`.
bool mutable_ = config->isPic & !sym->isStub;
global.Type = {WASM_TYPE_I32, mutable_};
global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
// For -shared (PIC) output, we create create a synthetic function which will
// apply any relocations to the data segments on startup. This function is
-// called __wasm_apply_relocs and is added at the beginning of __wasm_call_ctors
-// before any of the constructors run.
+// called `__wasm_apply_data_relocs` and is added at the beginning of
+// `__wasm_call_ctors` before any of the constructors run.
void Writer::createApplyDataRelocationsFunction() {
LLVM_DEBUG(dbgs() << "createApplyDataRelocationsFunction\n");
// First write the body's contents to a string.
// in input object.
void Writer::createCallCtorsFunction() {
// If __wasm_call_ctors isn't referenced, there aren't any ctors, and we
- // aren't calling `__wasm_apply_relocs` for Emscripten-style PIC, don't
+ // aren't calling `__wasm_apply_data_relocs` for Emscripten-style PIC, don't
// define the `__wasm_call_ctors` function.
if (!WasmSym::callCtors->isLive() && !WasmSym::applyDataRelocs &&
initFunctions.empty())
raw_string_ostream os(bodyContent);
writeUleb128(os, 0, "num locals");
- // If we have any ctors, or we're calling `__wasm_apply_relocs` for
- // Emscripten-style PIC, call `__wasm_call_ctors` which performs those
- // calls.
+ // Call `__wasm_call_ctors` which call static constructors (and
+ // applies any runtime relocations in Emscripten-style PIC mode)
if (WasmSym::callCtors->isLive()) {
writeU8(os, WASM_OPCODE_CALL, "CALL");
writeUleb128(os, WasmSym::callCtors->getFunctionIndex(),