[PATCH] D103486: [lld][WebAssemlby] Fix for string merging of -dwarf-5 sections

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 14:34:34 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc1a59fa55081: [lld][WebAssemlby] Fix for string merging of -dwarf-5 sections (authored by sbc100).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103486/new/

https://reviews.llvm.org/D103486

Files:
  lld/test/wasm/merge-string-debug.s
  lld/wasm/InputFiles.cpp


Index: lld/wasm/InputFiles.cpp
===================================================================
--- lld/wasm/InputFiles.cpp
+++ lld/wasm/InputFiles.cpp
@@ -368,8 +368,11 @@
   // 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) {
Index: lld/test/wasm/merge-string-debug.s
===================================================================
--- lld/test/wasm/merge-string-debug.s
+++ lld/test/wasm/merge-string-debug.s
@@ -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          ............


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103486.349101.patch
Type: text/x-patch
Size: 1868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210601/1d35d141/attachment.bin>


More information about the llvm-commits mailing list