[all-commits] [llvm/llvm-project] 31f0e2: [ARM] Use GOT indirection for weak symbols in PIC ...

dong jianqiang via All-commits all-commits at lists.llvm.org
Thu Jun 4 04:42:54 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 31f0e25074627bd081130f81ba6ffcb0ede1aaab
      https://github.com/llvm/llvm-project/commit/31f0e25074627bd081130f81ba6ffcb0ede1aaab
  Author: dong jianqiang <dongjianqiang2 at huawei.com>
  Date:   2026-06-04 (Thu, 04 Jun 2026)

  Changed paths:
    M llvm/lib/Target/ARM/ARMFastISel.cpp
    M llvm/lib/Target/ARM/ARMISelLowering.cpp
    M llvm/lib/Target/ARM/ARMSubtarget.cpp
    M llvm/lib/Target/ARM/ARMTargetMachine.h
    M llvm/test/CodeGen/ARM/elf-preemption.ll
    A llvm/test/CodeGen/ARM/weak-hidden-pic.ll

  Log Message:
  -----------
  [ARM] Use GOT indirection for weak symbols in PIC mode  (#198577)

On ARM ELF PIC, weak dso_local symbols were incorrectly accessed via
PC-relative constant pool entries (e.g. .long xxx-(.LPC+8)). The
assembler eagerly resolves this expression when both the symbol and
label are in the same section, preventing the linker from overriding a
weak definition with a strong one from another object file.

Fix #183916 by treating weak symbols as indirect (requiring GOT) on ELF
PIC, matching GCC's behavior. This affects:
- isGVIndirectSymbol (ARMTargetMachine) — Darwin, GlobalISel, stack
prot.
- isGVInGOT (ARMSubtarget)
- LowerGlobalAddressELF (SelectionDAG path)
- ARMLowerPICELF (FastISel path)

Assisted-by: Claude Opus 4.7 <noreply at anthropic.com>



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