[PATCH] D60785: [ELF] Align file offset for .bss if first section in a PT_LOAD

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 06:00:56 PDT 2019


jrtc27 marked 2 inline comments as done.
jrtc27 added inline comments.


================
Comment at: lld/ELF/Writer.cpp:2221
+  if (!OS->PtLoad) {
+    // File offsets are not significant for .bss sections when not the first
+    // section in a PT_LOAD. By convention, we keep section offsets
----------------
MaskRay wrote:
> `when not the first section in a PT_LOAD` -> `not in a PT_LOAD`?
`not in a PT_LOAD` is encompassed by that, and this means it also covers the case below that has a reference to this comment.


================
Comment at: lld/test/ELF/basic-ppc64.s:166
 // CHECK-NEXT:    Address: 0x30000
-// CHECK-NEXT:    Offset: 0x20060
+// CHECK-NEXT:    Offset: 0x30000
 // CHECK-NEXT:    Size: 0
----------------
Technically, in this case, we could not align the section in the file, since the entire PT_LOAD it gets put into is empty and thus omitted, but that's complexity for optimising a rare edge-case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60785





More information about the llvm-commits mailing list