[PATCH] D65087: [yaml2elf] - Treat the SHT_NULL section as kind of regular section.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 07:22:35 PDT 2019
MaskRay added a comment.
> [yaml2elf] - Treat the SHT_NULL section as kind of regular section.
Suggest referring to this section with `SHN_UNDEF`. Because a section of type `SHT_NULL` may exist in a different place.
> Thought SHT_NULL section which is placed at index 0 is still kind of exception.
Though the SHT_NULL section with section number 0 is an exception. (Though other reviewers may have better recommendation:)
================
Comment at: tools/yaml2obj/yaml2elf.cpp:199
+ llvm::make_unique<ELFYAML::Section>(
+ ELFYAML::Section::SectionKind::RawContent, true /*IsImplicit*/));
+
----------------
`/*IsImplicit=*/true` may be a more popular choice (clang-format uses that form if you place a space in between).
================
Comment at: tools/yaml2obj/yaml2elf.cpp:328
- for (size_t I = 1; I < Doc.Sections.size() + 1; ++I) {
+ for (size_t I = 1; I < Doc.Sections.size(); ++I) {
Elf_Shdr &SHeader = SHeaders[I];
----------------
You can circumvent the violation of https://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop by assigning Doc.Sections.size() to a variable above (it is also used above)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65087/new/
https://reviews.llvm.org/D65087
More information about the llvm-commits
mailing list