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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 13:01:49 PDT 2023


aeubanks added a comment.

> 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?



================
Comment at: lld/ELF/Writer.cpp:895
       rank |= RF_RODATA;
+    // Among PROGBITS sections, place .rodata closer to .text.
+    if (!(osec.flags & SHF_X86_64_LARGE && config->emachine == EM_X86_64))
----------------
MaskRay wrote:
> peter.smith wrote:
> > Do you mean .lrodata in the comment above?
> I mean `.rodata` is closer to `.text`. We have `.dynsym ... .lrodata .rodata`, but the comment can probably rewritten in a clearer way.
Yeah I think this comment is confusing, something like `Place large sections further from .text` is clearer


================
Comment at: lld/test/ELF/x86-64-section-layout.s:24
+# CHECK-NEXT:  .ldata    PROGBITS        0000000000203307 000307 000002 00 WAl  0   0  1
+# CHECK-NEXT:  .ldata2   PROGBITS        0000000000203309 000309 000001 00 WAl  0   0  1
+# CHECK-NEXT:  .lbss     NOBITS          000000000020330a 00030a 000002 00 WAl  0   0  1
----------------
shouldn't this be merged with `.ldata` according to the change in `LinkerScript.cpp`?


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