aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object
diff options
context:
space:
mode:
authorMitch Phillips <mitchp@google.com>2024-01-03 11:08:03 +0100
committerMitch Phillips <mitchp@google.com>2024-01-03 11:23:10 +0100
commit665d1a0eb4e50cdc1b6f0f678a4c2b1e1875dc66 (patch)
tree8292c7138fbccd128e142d0a49146cb8086e4943 /llvm/lib/Object
parent40236257ea9d1e451daee5c0938bd23abd5d1450 (diff)
downloadllvm-665d1a0eb4e50cdc1b6f0f678a4c2b1e1875dc66.zip
llvm-665d1a0eb4e50cdc1b6f0f678a4c2b1e1875dc66.tar.gz
llvm-665d1a0eb4e50cdc1b6f0f678a4c2b1e1875dc66.tar.bz2
Revert "[WebAssembly][Object]Use file offset as function symbol address for linked files (#76198)"
This reverts commit fc5f51cf5af4364b38bf22e491d46e1e892ade0c. Reason: Broke the sanitizer buildbot - https://lab.llvm.org/buildbot/#/builders/5/builds/39751/steps/12/logs/stdio
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index ccc29d0..40665d6 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -1667,18 +1667,10 @@ 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)) {
- // For object files, use the section offset. The linker relies on this.
- // For linked files, use the file offset. This behavior matches the way
- // browsers print stack traces and is useful for binary size analysis.
- // (see https://webassembly.github.io/spec/web-api/index.html#conventions)
- uint32_t Adjustment = isRelocatableObject() || isSharedObject()
- ? 0
- : Sections[CodeSection].Offset;
- return getDefinedFunction(Sym.Info.ElementIndex).CodeSectionOffset +
- Adjustment;
- }
- return getSymbolValue(Symb);
+ isDefinedFunctionIndex(Sym.Info.ElementIndex))
+ return getDefinedFunction(Sym.Info.ElementIndex).CodeSectionOffset;
+ else
+ return getSymbolValue(Symb);
}
uint64_t WasmObjectFile::getWasmSymbolValue(const WasmSymbol &Sym) const {