[llvm] Store sysreg names in-line with their descriptors. (PR #119157)

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 03:08:15 PST 2024


chandlerc wrote:

To give some numbers for context here...

This reduces dynamic relocations by almost 4k on Linux, just over 4% of the non-vtable relocations. It's not as big as some of the previous reductions, but that's the nature of working down the stack...

The PR description says this wastes some space, so I specifically got `bloaty` comparison before and after this change, at least on my Linux system with a `strip`-ed binary from an optimized build:

```
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.4%  +200Ki  +0.4%  +200Ki    .rodata
  [ = ]       0  +135% +1.03Ki    .relro_padding
  +0.0%      +4  +0.0%      +4    .eh_frame
 -12.5%      -4  [ = ]       0    [Unmapped]
  -5.0%     -40  -5.0%     -40    [LOAD #2 [R]]
  -1.4% -90.4Ki  -1.4% -90.4Ki    .rela.dyn
  -2.8%  -115Ki  -2.8%  -115Ki    .data.rel.ro
  -0.0% -5.03Ki  -0.0% -4.00Ki    TOTAL

```

No regression in overall size. The growth in `.rodata` is larger than the reduction in `.data.rel.ro`, reflecting exactly what the description suggests. But the additional reduction in `.rela.dyn` makes up for this. Ultimately, this is a wash for binary size, but more efficient for loading PIE binaries.

It might be nice to use a string table and an offset, but it'd barely be better given the small size of these strings.

https://github.com/llvm/llvm-project/pull/119157


More information about the llvm-commits mailing list