[all-commits] [llvm/llvm-project] cd01e6: [ELF] Add target-specific relocation scanning for ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Mar 3 22:23:16 PST 2026


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

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp
    M lld/ELF/InputSection.cpp
    M lld/ELF/Relocations.cpp
    M lld/ELF/Relocations.h

  Log Message:
  -----------
  [ELF] Add target-specific relocation scanning for LoongArch (#182236)

Implement LoongArch::scanSectionImpl, following the pattern established
for x86, PPC64, SystemZ, AArch64. This merges the getRelExpr and TLS
handling for SHF_ALLOC sections into the target-specific scanner,
enabling devirtualization and eliminating abstraction overhead.

- Inline relocation classification into scanSectionImpl with a switch
  on relocation type, replacing the generic rs.scan() path.
- Use processR_PC/processR_PLT_PC for common PC-relative and PLT
  relocations.
- Inline TLS handling: IE->LE optimization for _PC_ variants only (not
  _PCADD_ or absolute), TLSDESC->IE/LE for non-extreme code model,
  GD/LD flag setting without going through generic handleTlsRelocation.
- Remove adjustTlsExpr by inlining its logic into scanSectionImpl.
- Remove LoongArch-specific code from Relocations.cpp:
  handleTlsRelocation, execOptimizeInLoongArch, and the sort condition.
- Simplify getRelExpr to only handle relocations needed by
  relocateNonAlloc, scanEhSection, and the extreme code model fallback
  in relocateAlloc.



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