[PATCH] D78628: [obj2yaml] - Program headers: simplify the computation of p_filesz.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 01:02:22 PDT 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml:33
 # CHECK:    Offset: 0x2004
-# CHECK:    FileSize: 4
+# CHECK:    FileSize: 5
 # CHECK:    MemSize: 6
----------------
MaskRay wrote:
> Why is this changed?
This patch fixes a bug I beliece: it's 

```
  # Program header with 2 SHT_NOBITS sections.
  - Type:     0x6abcdef0
    Offset:   0x2004
    Sections:
      - Section: .data
      - Section: .nobits1
      - Section: .nobits2
```

The layout is:

```
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     0   0  0
  [ 1] .text             PROGBITS        0000000000000000 001000 000004 00     0   0 4096
  [ 2] .rodata           PROGBITS        0000000000000000 002000 000004 00     0   0 4096
  [ 3] .data             PROGBITS        0000000000000000 002004 000004 00     0   0  0
  [ 4] .nobits1          NOBITS          0000000000000000 002008 000001 00     0   0  0
  [ 5] .nobits2          NOBITS          0000000000000000 002009 000001 00     0   0  0
  [ 6] .strtab           STRTAB          0000000000000000 002008 000001 00     0   0  1
  [ 7] .shstrtab         STRTAB          0000000000000000 002009 000039 00     0   0  1
```

`0x2009 - 0x2004 == 0x5`, not `0x4`


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

https://reviews.llvm.org/D78628





More information about the llvm-commits mailing list