[PATCH] D75342: [obj2yaml] - Teach tool to dump program headers.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 05:23:17 PDT 2020


grimar added inline comments.


================
Comment at: llvm/test/tools/obj2yaml/program-headers.yaml:23-32
+# SEGMENT-MAPPING-NEXT:   00     .hash .gnu.hash .dynsym .dynstr
+# SEGMENT-MAPPING-NEXT:   01     .foo .zed
+# SEGMENT-MAPPING-NEXT:   02     .foo .baz
+# SEGMENT-MAPPING-NEXT:   03     .dynamic .dynamic.tail
+# SEGMENT-MAPPING-NEXT:   04     .dynamic
+# SEGMENT-MAPPING-NEXT:   05     .dynamic
+# SEGMENT-MAPPING-NEXT:   06{{ *$}}
----------------
jhenderson wrote:
> jhenderson wrote:
> > You need {{$}} at the end of all of these lines, since there could be more segments after the last one in each of them.
> On second thoughts, using --match-full-lines might be just as good. I don't mind either way.
I've kept `{{$}}` (have no preference here, `{{$}}` looks fine to me).


================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:174-175
+                        const typename ELFT::Phdr &Phdr) {
+  if (Sec.Type == ELF::SHT_NULL)
+    return false;
+  return SHdr.sh_offset >= Phdr.p_offset &&
----------------
jhenderson wrote:
> Do we need this special case? Do you have a test case that illustrates it?
I think we should ignore either all `SHT_NULL` sections or just the one with section index == 0.
When we don't, the first test case in `program-headers.yaml` includes it in the first segment and prints it:

```
 - Type: PT_LOAD
   Flags: [ PF_R ]
   Sections:
    - Section: ''
    - Section: .hash
    - Section: .gnu.hash
    - Section: .dynsym
    - Section: .dynstr
```




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

https://reviews.llvm.org/D75342





More information about the llvm-commits mailing list