forked from OSchip/llvm-project
[lld][WebAssemlby] Fix for string merging of -dwarf-5 sections
We were mistakenly treating `.debug_str_offsets` as a string mergable section when it is not (it contains integers not strings). This is an indication that we really should find a way to store flags for custom sections. Fixes: https://bugs.llvm.org/show_bug.cgi?id=48828 Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1172217 Differential Revision: https://reviews.llvm.org/D103486
This commit is contained in:
parent
8ae7fe24c1
commit
c1a59fa550
|
@ -11,6 +11,7 @@
|
|||
|
||||
# RUN: wasm-ld -O0 %t.o %t2.o -o %tO0.wasm --no-entry
|
||||
# RUN: llvm-readobj -x .debug_str %tO0.wasm | FileCheck %s --check-prefixes CHECK,CHECK-O0
|
||||
# RUN: llvm-readobj -x .debug_str_offsets %tO0.wasm | FileCheck %s --check-prefixes CHECK-OFFSETS
|
||||
|
||||
.section .debug_str,"S",@
|
||||
.Linfo_string0:
|
||||
|
@ -21,6 +22,11 @@
|
|||
.section .debug_other,"",@
|
||||
.int32 .Linfo_string0
|
||||
|
||||
.section .debug_str_offsets,"",@
|
||||
.int32 .Linfo_string0
|
||||
.int32 .Linfo_string0
|
||||
.int32 .Linfo_string0
|
||||
|
||||
# CHECK: Hex dump of section '.debug_str':
|
||||
|
||||
# CHECK-O0: 0x00000000 636c616e 67207665 7273696f 6e203133 clang version 13
|
||||
|
@ -30,3 +36,6 @@
|
|||
|
||||
# CHECK-O1: 0x00000000 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang
|
||||
# CHECK-O1: 0x00000010 20766572 73696f6e 2031332e 302e3000 version 13.0.0.
|
||||
|
||||
# CHECK-OFFSETS: Hex dump of section '.debug_str_offsets':
|
||||
# CHECK-OFFSETS: 0x00000000 00000000 00000000 00000000 ............
|
||||
|
|
|
@ -368,8 +368,11 @@ static bool shouldMerge(const WasmSection &sec) {
|
|||
// currently go by the name alone.
|
||||
// TODO(sbc): Add ability for wasm sections to carry flags so we don't
|
||||
// need to use names here.
|
||||
return sec.Name.startswith(".debug_str") ||
|
||||
sec.Name.startswith(".debug_line_str");
|
||||
// For now, keep in sync with uses of wasm::WASM_SEG_FLAG_STRINGS in
|
||||
// MCObjectFileInfo::initWasmMCObjectFileInfo which creates these custom
|
||||
// sections.
|
||||
return sec.Name == ".debug_str" || sec.Name == ".debug_str.dwo" ||
|
||||
sec.Name == ".debug_line_str";
|
||||
}
|
||||
|
||||
static bool shouldMerge(const WasmSegment &seg) {
|
||||
|
|
Loading…
Reference in New Issue