[PATCH] D64913: [yaml2obj] - Add a support for defining null sections in YAMLs.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 22:44:22 PDT 2019


MaskRay added inline comments.


================
Comment at: test/tools/yaml2obj/elf-custom-null-section.yaml:46
+# RUN: yaml2obj --docnum=3 %s -o %t3
+# RUN: llvm-readelf --sections %t3 | FileCheck %s --check-prefix=CASE2
+
----------------
`CASE2` -> a descriptive name. (I'd call it `EXPLICIT-ZERO` but there may be a better name).


================
Comment at: test/tools/yaml2obj/elf-custom-null-section.yaml:76
+# RUN: yaml2obj --docnum=4 %s -o %t4
+# RUN: llvm-readelf --sections %t4 | FileCheck %s --check-prefix=CASE3
+
----------------
jhenderson wrote:
> Similar to above, this is called "CASE3" but is used in two different test cases. Perhaps REDEFINE?
Or
`CASE3` -> `SEC-REF-LINK`
`CASE4` -> `NUMERAL-LINK`


================
Comment at: tools/yaml2obj/yaml2elf.cpp:301
   for (StringRef Name : State.implicitSectionNames())
-    if (State.SN2I.get(Name) > Doc.Sections.size())
+    if (State.SN2I.get(Name) > (Doc.Sections.size() - (DocNullSec ? 1 : 0)))
       ImplicitSections.push_back(Name);
----------------
jhenderson wrote:
> I wonder if it would make sense to treat the null section the same as any other implicit section? What do you think?
How to do that? SHN_UNDEF (of SHT_NULL) is the first section, different from other implicit sections...


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

https://reviews.llvm.org/D64913





More information about the llvm-commits mailing list