[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
Tue May 16 13:26:52 PDT 2023


MaskRay added a comment.

In D150510#4342261 <https://reviews.llvm.org/D150510#4342261>, @jyknight wrote:

> So, I also had a version I was going to send for review, but I'm too slow, and it's now conflicted with intermediary cleanups.
>
> So I've pushed it here instead for now: https://github.com/llvm/llvm-project/compare/main...jyknight:llvm-project:lld-largefile-2 (starting with a revert of your cleanup, just in order to not need to deal with merge conflicts at this point...).

Thanks!

> The main points I think are important are:
>
> - Also supports code sections marked large (they are placed at the end, after RW data).
> - Splits segments at NOBITS->BITS boundaries, so that a new segment is started between .bss and .ldata (assuming there is .bss).

I have thought about this, but after close look at GNU ld's layout, it shares the missing optimization with us... So I think not implementing this is fine.
Then, we can just not start a new RW `PT_LOAD`...

> 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).

(I think objcopy/strip traditionally has some issues with bss including a bug which only happens with lld's layout.)

GCC/GNU ld don't create `.ltext`, so I omit it... Perhaps you may kindly send a patch to place `.ltext`, after Clang gets support for `.ltext` and `.ltext.*`...


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