[PATCH] D95623: [lld][WebAssembly] Update comments mentioning legacy function names. NFC

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 08:52:39 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c0164890c26: [lld][WebAssembly] Update comments mentioning legacy function names. NFC (authored by sbc100).

Changed prior to commit:
  https://reviews.llvm.org/D95623?vs=319879&id=319889#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95623/new/

https://reviews.llvm.org/D95623

Files:
  lld/test/wasm/shared.ll
  lld/test/wasm/weak-undefined-pic.s
  lld/wasm/MarkLive.cpp
  lld/wasm/SyntheticSections.cpp
  lld/wasm/Writer.cpp


Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -1121,8 +1121,8 @@
 
 // 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.
@@ -1160,7 +1160,7 @@
 // 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())
@@ -1203,9 +1203,8 @@
     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(),
Index: lld/wasm/SyntheticSections.cpp
===================================================================
--- lld/wasm/SyntheticSections.cpp
+++ lld/wasm/SyntheticSections.cpp
@@ -333,7 +333,7 @@
     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;
Index: lld/wasm/MarkLive.cpp
===================================================================
--- lld/wasm/MarkLive.cpp
+++ lld/wasm/MarkLive.cpp
@@ -189,7 +189,7 @@
     return false;
 
   // In Emscripten-style PIC, we call `__wasm_call_ctors` which calls
-  // `__wasm_apply_relocs`.
+  // `__wasm_apply_data_relocs`.
   if (config->isPic)
     return true;
 
Index: lld/test/wasm/weak-undefined-pic.s
===================================================================
--- lld/test/wasm/weak-undefined-pic.s
+++ lld/test/wasm/weak-undefined-pic.s
@@ -29,7 +29,7 @@
 
 # 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
 
@@ -45,7 +45,7 @@
 # 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
Index: lld/test/wasm/shared.ll
===================================================================
--- lld/test/wasm/shared.ll
+++ lld/test/wasm/shared.ll
@@ -132,7 +132,7 @@
 ; CHECK-NEXT:           Index:           2
 ; CHECK-NEXT:         Functions:       [ 4, 3 ]
 
-; check the generated code in __wasm_call_ctors and __wasm_apply_relocs functions
+; check the generated code in __wasm_call_ctors and __wasm_apply_data_relocs functions
 ; TODO(sbc): Disassemble and verify instructions.
 
 ; CHECK:        - Type:            CODE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95623.319889.patch
Type: text/x-patch
Size: 4143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210128/1f8ff283/attachment.bin>


More information about the llvm-commits mailing list