[PATCH] D95199: [ELF] Write output sections in PT_LOAD segment order

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 7 11:16:39 PST 2021


MaskRay added a comment.

The change to partition-synthetic-sections.s is not ideal. Originally the sections have non-decreasing offsets. With the change, `.part.end` (NOBITS) is the first to be assigned an offset 0x3150. In the next iteration, sh_offset(part1) is 0x4000 (was: 0x3000), wasting one page.

The change to implicit-program-header.test is not ideal, either. You can use the existing assembly, or add a `.bar` and change PT_NOTE to PT_LOAD. In both cases GNU ld places `.foo` before `.text`. The current behavior is similar. With this patch, `.foo` will be assigned an offset from the next page.

In the presence of PHDRS, I think the new behavior is pretty much desired. It remains uncertain for me whether making it the behavior in the absence of PHDRS is the right choice. It gives my a feeling to address specific corner case while regressing normal case behaviors and greatly increasing complexity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95199



More information about the llvm-commits mailing list