[PATCH] D74781: Wasm-ld emits invalid .debug_ranges entries for non-live symbols
Paolo Severini via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 26 14:42:25 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaff75e1a1fac: [lld][Wasm] Wasm-ld emits invalid .debug_ranges entries for non-live symbols (authored by paolosev).
Changed prior to commit:
https://reviews.llvm.org/D74781?vs=252477&id=252983#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74781/new/
https://reviews.llvm.org/D74781
Files:
lld/test/wasm/debug-removed-fn.ll
lld/wasm/InputFiles.cpp
Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -168,9 +168,11 @@
sym = symbols[reloc.Index];
// We can end up with relocations against non-live symbols. For example
- // in debug sections.
+ // in debug sections. We return reloc.Addend because always returning zero
+ // causes the generation of spurious range-list terminators in the
+ // .debug_ranges section.
if ((isa<FunctionSymbol>(sym) || isa<DataSymbol>(sym)) && !sym->isLive())
- return 0;
+ return reloc.Addend;
}
switch (reloc.Type) {
Index: lld/test/wasm/debug-removed-fn.ll
===================================================================
--- lld/test/wasm/debug-removed-fn.ll
+++ lld/test/wasm/debug-removed-fn.ll
@@ -1,11 +1,16 @@
; RUN: llc -filetype=obj < %s -o %t.o
; RUN: wasm-ld %t.o --no-entry --export=foo -o %t.wasm
-; RUN: llvm-dwarfdump -debug-line %t.wasm | FileCheck %s
+; RUN: llvm-dwarfdump -debug-line -debug-ranges %t.wasm | FileCheck %s
; CHECK: Address
; CHECK: 0x0000000000000005
; CHECK: 0x0000000000000000
+; CHECK: .debug_ranges contents:
+; CHECK: 00000000 {{[0-9]+}} {{[0-9]+}}
+; CHECK: 00000000 {{[0-9]+}} {{[0-9]+}}
+; CHECK: 00000000 <End of list>
+
; ModuleID = 't.bc'
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown-wasm"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74781.252983.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200326/a17e0054/attachment.bin>
More information about the llvm-commits
mailing list