[PATCH] D101399: [lld][WebAssembly] Allow relocations against non-live global symbols

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 13:48:12 PDT 2021


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, sunfish, jgravelle-google, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

Just like the in case for function and data symbols this is needed to
support relocations in debug info sections which are allowed contains
relocations against non-live symbols.

The motivating use case is an object file that contains debug info that
references `__stack_pointer` (a local symbol) but does not actually
contain any uses of `__stack_pointer`.

Fixes: https://github.com/emscripten-core/emscripten/issues/14025


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101399

Files:
  lld/wasm/InputFiles.cpp


Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -212,7 +212,7 @@
     // so this will not produce a valid range conflicting with ranges of actual
     // code. In other sections we return reloc.Addend.
 
-    if ((isa<FunctionSymbol>(sym) || isa<DataSymbol>(sym)) && !sym->isLive())
+    if (!isa<SectionSymbol>(sym) && !sym->isLive())
       return tombstone ? tombstone : reloc.Addend;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101399.340980.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210427/4b3291dd/attachment.bin>


More information about the llvm-commits mailing list