[PATCH] D80203: [ObjectYAML][DWARF] Add DWARF entry in ELFYAML.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 28 03:13:02 PDT 2020
grimar added a comment.
It looks good, have a last suggestion.
I've tested that all tests in `debug-str.yaml` pass with it, except `--docnum=9`, which is fixed to produce the desired (I believe) output.
================
Comment at: llvm/lib/ObjectYAML/ELFEmitter.cpp:828
+ else
+ reportError("section '" + Name +
+ "' can only be initialized via the 'DWARF' entry or a "
----------------
I think you can change this to be unreachable.
If you do the following:
```
template <class ELFT>
bool ELFState<ELFT>::initImplicitHeader(ContiguousBlobAccumulator &CBA,
Elf_Shdr &Header, StringRef SecName,
ELFYAML::Section *YAMLSec) {
// Check if the header was already initialized.
if (Header.sh_offset)
return false;
if (SecName.startswith(".debug_")) {
// If we have, for example, a SHT_DYNAMIC section with the name ".debug_*",
// we treat it as dynamic section.
if (YAMLSec && !isa<ELFYAML::RawContentSection>(YAMLSec))
return false;
initDWARFSectionHeader(Header, SecName, CBA, YAMLSec);
return true;
}
...
```
(the comment could be better, I think, but shows the idea).
================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-str.yaml:197
+
+# TYPE-ERROR: yaml2obj: error: section '.debug_str' can only be initialized via the 'DWARF' entry or a section's 'Content' or 'Size' fields
+
----------------
This should produce the `SHT_DYNAMIC` section with the name `.debug_str`, I think. See my suggestion above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80203/new/
https://reviews.llvm.org/D80203
More information about the llvm-commits
mailing list