[llvm-branch-commits] [ELF] Place .lbss/.lrodata/.ldata after .bss (PR #81224)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 9 10:36:56 PST 2024
================
@@ -988,10 +991,10 @@ static unsigned getSectionRank(OutputSection &osec) {
osec.relro = true;
else
rank |= RF_NOT_RELRO;
- // Place .ldata and .lbss after .bss. Making .bss closer to .text alleviates
- // relocation overflow pressure.
+ // Place .lbss/.lrodata/.ldata after .bss. .bss/.lbss being adjacent reuses
+ // the NOBITS size optimization.
if (osec.flags & SHF_X86_64_LARGE && config->emachine == EM_X86_64)
- rank |= RF_LARGE;
+ rank |= osec.type == SHT_NOBITS ? 1 : RF_LARGE;
----------------
MaskRay wrote:
I think we can treat `RF_*` as defining larger regions and integer immediates as a mechanism to pick a subregion within a larger region. The immediate use here is similar to `.interp/SHT_NOTE` and target-specific tunings (`.sdata`, `.got`, etc).
https://github.com/llvm/llvm-project/pull/81224
More information about the llvm-branch-commits
mailing list