[PATCH] D78005: [yaml2obj] - Reimplement how tool calculates memory sizes of segments.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 04:47:21 PDT 2020


grimar added inline comments.


================
Comment at: llvm/test/tools/yaml2obj/ELF/program-header-nobits.yaml:16
+# COMMON-NEXT:   [ 1] .nobits1   NOBITS   0000000200000000 000158 000010
+# COMMON-NEXT:   [ 2] .progbits1 PROGBITS 0000000200000010 000158 000001
+# COMMON-NEXT:   [ 3] .progbits2 PROGBITS 0000000200000020 000160 000010
----------------
grimar wrote:
> jhenderson wrote:
> > I was initially concerned that .progbits1 and .nobits1 share the same file offset. In such a case, the loader would not allocate the bytes for .nobits1 in the right place for any segment where it wasn't the only section in it. However, this is yaml2obj, not the linker, so it's probably fine to leave as-is, if there's some way of adding padding between the two sections without changing the address of .progbits1.
> >  if there's some way of adding padding between the two sections without changing the address of .progbits1.
> The best way I know is D78927.
So, I'd hold this patch a bit and update this and the place below after landing the D78927.


================
Comment at: llvm/test/tools/yaml2obj/ELF/program-header-nobits.yaml:26-27
+## This segment includes sections 1 to 6.
+# NOOFFSET-NEXT: LOAD 0x000000 0x0000000200000000 0x0000000200000000 0x000200 0x000500
+# OFFSET-NEXT:   LOAD 0x000158 0x0000000200000000 0x0000000200000000 0x0000a8 0x0003a8
+## This segment includes sections 1 to 5.
----------------
jhenderson wrote:
> Something's not right here. Why is the memory size 0x500/0x3a8?
> 
> The highest end address of any section in the segment is 0x2000003b0, according to the section dump above, which would mean a size of 0x508/0x3b0 depending on which offset is used as the start point.
> 
> This might be because you've specified section addresses which conflict with the program header address, causing confusion - the program header with Offset 0 can't have the same VAddr as its first section, since the first section doesn't start at offset 0.
I've adjusted the VAddr.


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

https://reviews.llvm.org/D78005





More information about the llvm-commits mailing list