[PATCH] D102312: [llvm-dwp] Skip type unit debug info sections

Kim-Anh Tran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 23:08:45 PDT 2021


kimanh marked 2 inline comments as done.
kimanh added inline comments.


================
Comment at: llvm/tools/llvm-dwp/llvm-dwp.cpp:779-781
+    if (CurInfoSection.size() != 1)
+      return make_error<DWPError>("expected exactly one occurrence of a debug "
+                                  "info section in a .dwp file");
----------------
dblaikie wrote:
> kimanh wrote:
> > dblaikie wrote:
> > > Test coverage?
> > I tried to add a *.s test for this case but I'm not entirely sure how to create one properly. If I add multiple .debug_info sections, after running llvm-mc there will only be one. 
> > 
> > Is there a  way to create a test with multiple .debug_info sections but one index than actually writing the byte code?
> I think the way this happens with GCC is that it produces a single .o file that has the usual comdat groups for type units - then it runs objcopy to split out the .dwo sections, and objcopy doesn't propagate the comdat groups but it does keep the separate sections.
> 
> Probably the easiest thing to do might be to have an input file use a comdat group? (try compiling without Split DWARF and check the assembly - you'll see the .debug_info section directive for the type unit will have something like `.section        .debug_types.dwo,"G", at progbits,wt.b0cf918beae249c9,comdat` - so maybe you can do something like that - the consumer (llvm-dwp) won't care that it happens to be in a section group, I shouldn't think - also, maybe use an obvious made-up value for the hash (like 0xFDFDFDFDFD or whatever))
Thanks for the guidance, that worked! I have added a test in the latest revision.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102312



More information about the llvm-commits mailing list