[lld] [lld][WebAssembly]: Avoid emitting empty __wasm_apply_data_relocs function (PR #109249)

YAMAMOTO Takashi via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 17:48:41 PDT 2024


================
@@ -378,7 +378,7 @@ void InputChunk::generateRelocationCode(raw_ostream &os) const {
     uint64_t offset = getVA(rel.Offset) - getInputSectionOffset();
 
     Symbol *sym = file->getSymbol(rel);
-    if (!ctx.isPic && sym->isDefined())
+    if (!ctx.isPic && !sym->hasGOTIndex())
----------------
yamt wrote:

> I'm finding this clauses a little hard to grok without a lot of introspection.

i agree!

> Maybe we could add a comment here? Something like:
> 
> `// Runtime relocations are needed when we don't know the address of a symbol statically.`
> 
> Or better still, we could add a variable to make it more clear what is going on:
> 
> ```
> bool requiresRuntimeReloc = ctx.isPic || sym->hasGOTIndex();
> if (!requiresRuntimeReloc)
>    continue;
> ```

applied. thank you.

https://github.com/llvm/llvm-project/pull/109249


More information about the llvm-commits mailing list