[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 12:52:24 PDT 2021


sbc100 created this revision.
Herald added a subscriber: wingo.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103486

Files:
  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) {


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


More information about the llvm-commits mailing list