Skip to content

Commit 665d1a0

Browse files
committed
Revert "[WebAssembly][Object]Use file offset as function symbol address for linked files (#76198)"
This reverts commit fc5f51c. Reason: Broke the sanitizer buildbot - https://lab.llvm.org/buildbot/#/builders/5/builds/39751/steps/12/logs/stdio
1 parent 4023625 commit 665d1a0

File tree

3 files changed

+4
-161
lines changed

3 files changed

+4
-161
lines changed

llvm/lib/Object/WasmObjectFile.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,18 +1667,10 @@ Expected<StringRef> WasmObjectFile::getSymbolName(DataRefImpl Symb) const {
16671667
Expected<uint64_t> WasmObjectFile::getSymbolAddress(DataRefImpl Symb) const {
16681668
auto &Sym = getWasmSymbol(Symb);
16691669
if (Sym.Info.Kind == wasm::WASM_SYMBOL_TYPE_FUNCTION &&
1670-
isDefinedFunctionIndex(Sym.Info.ElementIndex)) {
1671-
// For object files, use the section offset. The linker relies on this.
1672-
// For linked files, use the file offset. This behavior matches the way
1673-
// browsers print stack traces and is useful for binary size analysis.
1674-
// (see https://webassembly.github.io/spec/web-api/index.html#conventions)
1675-
uint32_t Adjustment = isRelocatableObject() || isSharedObject()
1676-
? 0
1677-
: Sections[CodeSection].Offset;
1678-
return getDefinedFunction(Sym.Info.ElementIndex).CodeSectionOffset +
1679-
Adjustment;
1680-
}
1681-
return getSymbolValue(Symb);
1670+
isDefinedFunctionIndex(Sym.Info.ElementIndex))
1671+
return getDefinedFunction(Sym.Info.ElementIndex).CodeSectionOffset;
1672+
else
1673+
return getSymbolValue(Symb);
16821674
}
16831675

16841676
uint64_t WasmObjectFile::getWasmSymbolValue(const WasmSymbol &Sym) const {

llvm/test/tools/llvm-nm/wasm/linked.yaml

Lines changed: 0 additions & 74 deletions
This file was deleted.

llvm/test/tools/llvm-objdump/wasm/linked-symbol-table.yaml

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)