[PATCH] D117439: [ELF] Update .relr.dyn once in the absence of SECTIONS commands

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 01:55:49 PST 2022


peter.smith added a comment.

Will have to have a think to see if I can spot any problems.

> If an output section does not have internal . = ALIGN(x);, the spacing among its input sections remain unchanged after script->assignAddresses is called for the first time.

Are you referring to an individual InputSection or an InputSectionDescription as one might have in a LinkerScript? In the presence of thunks you can have situations like:
// First call to assignAddresses, for brevity the first column is outSecOff. The second section has been overaligned to a cache-line size boundary which isn't unheard of at -O3.

  0x0 section1 align 4 size 4
  // 12 bytes padding
  0x10 section2 align 16 size 4

// Case add a single range extension thunk in the middle, no change in overall size

  0x0 section1 align 4 size 4
  0x4 thunk align 4 size 8
  // 4 bytes padding
  0x10 section2 align 16 size 4

// Case add two range extension thunks in the middle, cross an alignment boundary.

  0x0 section1 align 4 size 4
  0x4 thunk align 4 size 8
  0xc thunk align 4 size 8
  // 12 bytes padding
  0x20 section2 align 16 size 4

It is true that we won't see a range extension thunk in the middle of a .relr.dyn section, so this may not be important. It would certainly be true that the input sections in executable output sections might change address due to range-extension thunks. This is not hugely likely in AArch64 though as it would need > 128 MiB of code to trigger.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117439



More information about the llvm-commits mailing list