[all-commits] [llvm/llvm-project] f599bf: [ELF] Guard relocation section handling behind cop...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Mar 24 21:59:26 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f599bfcd273a502aebb392b901e39240a0074710
      https://github.com/llvm/llvm-project/commit/f599bfcd273a502aebb392b901e39240a0074710
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-03-25 (Wed, 25 Mar 2026)

  Changed paths:
    M lld/ELF/LinkerScript.cpp

  Log Message:
  -----------
  [ELF] Guard relocation section handling behind copyRelocs in addOrphanSections. NFC (#188409)

In addOrphanSections, getRelocatedSection() only returns non-null for -r
or --emit-relocs links. Guard code blocks with `copyRelocs` to skip
unnecessary dyn_cast + getRelocatedSection calls per section in the
common case. Hoist copyRelocs and relocatable to local variables so the
compiler does not reload them through ctx on every loop iteration.

"Assign sections" decreases by 1ms.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list