[PATCH] D150510: [ELF] x86-64: place .lrodata, .lbss, and .ldata away from code sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 13:57:30 PDT 2023


MaskRay added a comment.



In D150510#4362069 <https://reviews.llvm.org/D150510#4362069>, @aeubanks wrote:

>> Splits segments at NOBITS->BITS boundaries, so that a new segment is started between .bss and .ldata (assuming there is .bss).
>
> why is this necessary?

As I noted in the description:

> While GNU ld places .lbss after .bss, the subsequent sections don't reuse the file offset bytes of BSS. We have a similar missing optimization (implementing it would introduce complexity and likely be error-prone).

If we start a new PT_LOAD at NOBITS->BITS boundaries, we can in theory implement such a file size optimization.
`fixSectionAlignments` and `assignFileOffsets` would need some involved code.
I think this is error-prone and may not be a worthwhile change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150510



More information about the llvm-commits mailing list