[PATCH] D97186: [XCOFF][llvm-dwarfdump] support llvm-dwarfdump for XCOFF DWARF

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 06:17:50 PDT 2021


shchenz marked an inline comment as done.
shchenz added a comment.

> Maybe it would be best to wait on basic XCOFF yaml2obj support to be finished, add DWARF emission support to that, and then use yaml2obj to generate the DWARF output as required?

I totally agree with your suggestions, committing an object directly is not so good.
Due to the limitation of XCOFF yaml2obj support for now in D95505 <https://reviews.llvm.org/D95505> (for example, it only supports 32-bit) and the time when we need `llvm-dwarfdump` in, I firstly added this patch without test and I thought it can be verified together with patch D97184 <https://reviews.llvm.org/D97184>, in that patch, the object is generated from ll. After address @echristo comments, I added these tests based on XCOFF objects.

> Finally, how does this actually add support for llvm-dwarfdump + XCOFF? It's not particularly obvious to me, but I'm not all that familiar about what llvm-dwarfdump requires for this support.

`llvm-dwarfdump` calls `object::createBinary(` to recognize a specific form object, we already added XCOFF support in `object::createBinary()`-> `identify_magic()`, so in this patch, we only need to override some functions called by `DWARFContext` class. `llvm-dwarfdump` calls `DWARFContext` to dump DWARF info.

> I'm very happy to help implement DWARF support for yaml2xcoff (if needed), but I'm a little busy these days. I think I'm able to work on it in the next few months :-)

Thanks for your kindly help. If possible, could you please help to review the XCOFF yam2obj support patch D95505 <https://reviews.llvm.org/D95505>? Thanks @Higuoxing



================
Comment at: llvm/lib/Object/XCOFFObjectFile.cpp:461-472
+  return StringSwitch<StringRef>(Name)
+      .Case("dwinfo", "debug_info")
+      .Case("dwline", "debug_line")
+      .Case("dwpbnms", "debug_pubnames")
+      .Case("dwpbtyp", "debug_pubtypes")
+      .Case("dwarnge", "debug_aranges")
+      .Case("dwabrev", "debug_abbrev")
----------------
jhenderson wrote:
> This list is missing DWARFv5 section names. Does XCOFF not support those sections?
Yes, XCOFF does not support DWARF 5 sections for now.


================
Comment at: llvm/test/tools/llvm-dwarfdump/XCOFF/lit.local.cfg:1-2
+if not 'PowerPC' in config.root.targets:
+    config.unsupported = True
----------------
jhenderson wrote:
> Why do you need this? As far as I can tell, the behaviour under test is target agnostic.
Do you think is it necessary to run these tests on other targets? These are very basic DWARF info tests and I think other targets should already cover these tests by general/their tests?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97186



More information about the llvm-commits mailing list