[all-commits] [llvm/llvm-project] b2559f: [ELF] .eh_frame: remove config->wordsize padding

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jul 31 23:35:57 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b2559f2f5ca950e917253b156bfd08ede5577cd5
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-07-31 (Sun, 31 Jul 2022)

  Changed paths:
    M lld/ELF/SyntheticSections.cpp
    M lld/test/ELF/eh-frame-hdr-icf-fde.s
    M lld/test/ELF/eh-frame-hdr.s
    M lld/test/ELF/eh-frame-merge.s
    M lld/test/ELF/eh-frame-multiple-cie.s
    M lld/test/ELF/eh-frame-negative-pcrel-sdata2.s
    M lld/test/ELF/eh-frame-negative-pcrel-sdata4.s
    M lld/test/ELF/eh-frame-negative-pcrel-sdata8.s
    M lld/test/ELF/eh-frame-padding-no-rosegment.s
    M lld/test/ELF/eh-frame-value-format7.s
    M lld/test/ELF/gdb-index-gc-sections.s
    M lld/test/ELF/map-file.s
    M lld/test/ELF/partition-synthetic-sections.s

  Log Message:
  [ELF] .eh_frame: remove config->wordsize padding

Linux Standard Base Core Specification says that CIE/FDE is padded to an
addressing unit size boundary, but in practice GNU assembler/LLVM integrated
assembler pad FDE/CIE to 4 and the last FDE to 8 on 64-bit systems.

In addition, GNU ld doesn't pad to 8, so let's drop excess padding, too.
If the assembler provides aligned pieces, the output will be aligned.

Noticed .eh_frame size reduction for 3 executables: 0.3% (chrome), 4.7% (clang),
7.6% (an internal program).

More information about the All-commits mailing list