[llvm] [WebAssembly][Object]Use file offset as function symbol address for linked files (PR #76198)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 10:42:46 PST 2024


================
@@ -1662,10 +1662,16 @@ Expected<StringRef> WasmObjectFile::getSymbolName(DataRefImpl Symb) const {
 Expected<uint64_t> WasmObjectFile::getSymbolAddress(DataRefImpl Symb) const {
   auto &Sym = getWasmSymbol(Symb);
   if (Sym.Info.Kind == wasm::WASM_SYMBOL_TYPE_FUNCTION &&
-      isDefinedFunctionIndex(Sym.Info.ElementIndex))
-    return getDefinedFunction(Sym.Info.ElementIndex).CodeSectionOffset;
-  else
-    return getSymbolValue(Symb);
+      isDefinedFunctionIndex(Sym.Info.ElementIndex)) {
+    // For object files, use the section offset. For linked files, use the file
+    // offset
----------------
sbc100 wrote:

Perhaps mention here that file offset are using in other places such as backtraces and crash dumps?

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


More information about the llvm-commits mailing list