[llvm] SymbolizableObjectFile: Invalidate Wasm addresses that map outside the code section (PR #191329)
Derek Schuff via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 10:14:02 PDT 2026
================
@@ -273,13 +273,26 @@ object::SectionedAddress SymbolizableObjectFile::convertDwarfOffsetForWasm(
object::SectionedAddress ModuleOffset) const {
if (!Module->isWasm())
return ModuleOffset;
+
+ // For Wasm object files, addresses are already section-relative.
+ if (Module->isRelocatableObject())
+ return ModuleOffset;
+
+ // We are dealing with a linked Wasm file, which uses file offsets.
for (const SectionRef &Sec : Module->sections()) {
if (Sec.getIndex() == ModuleOffset.SectionIndex) {
- if (Sec.isText())
+ if (Sec.isText()) {
ModuleOffset.Address -= Sec.getAddress();
+ return ModuleOffset;
+ }
break;
}
}
+
+ // If the address is not in a text section, or we couldn't find a
+ // matching section, invalidate it. This prevents it from incorrectly
+ // being interpreted as as section-relative DWARF offset.
+ ModuleOffset.Address = object::SectionedAddress::UndefSection;
----------------
dschuff wrote:
Oh you are right. It doesn't actually matter functionally but maybe it's better to just use UINT64_MAX directly.
https://github.com/llvm/llvm-project/pull/191329
More information about the llvm-commits
mailing list