[PATCH] D85867: [ELF] Assign file offsets of non-SHF_ALLOC after SHF_ALLOC and set sh_addr=0 to non-SHF_ALLOC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 08:26:36 PDT 2020


MaskRay marked an inline comment as done.
MaskRay added a comment.

> Just to check I understand.
>
> In D85100 <https://reviews.llvm.org/D85100> we moved non SHF_ALLOC orphans after all other SHF_ALLOC sections so that they didn't affect address assignment of SHF_ALLOC sections. Now we don't move the SHF_ALLOC section positions but instead we do not move the location counter, and also move their file offset after all SHF_ALLOC sections so that they have no affect on addresses of SHF_ALLOC sections and cannot be part of a PT_LOAD section.

Yes



================
Comment at: lld/test/ELF/linkerscript/sections-nonalloc.s:21-23
+# CHECK-NEXT:  [ 7] .symtab   SYMTAB   0000000000000000 001028 000030 18      9
+# CHECK-NEXT:  [ 8] .shstrtab STRTAB   0000000000000000 001058 00004d 00      0
+# CHECK-NEXT:  [ 9] .strtab   STRTAB   0000000000000000 0010a5 000008 00      0
----------------
jhenderson wrote:
> Just to confirm - these three sections appear here in the section header table (before data2 and .text), because they are being placed near the other non-alloc sections, due to orphan section handling, I presume?
Yes.In GNU ld, the three sections are special: they can't be matched by output section descriptions.

Other than orphan section placement, our approach assigning section addresses is identical to GNU ld after this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85867



More information about the llvm-commits mailing list