[llvm] [ARM] Use GOT indirection for weak symbols in PIC mode (PR #198577)

dong jianqiang via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 08:52:14 PDT 2026


================
@@ -3033,7 +3033,8 @@ bool ARMFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
 }
 
 Register ARMFastISel::ARMLowerPICELF(const GlobalValue *GV, MVT VT) {
-  bool UseGOT_PREL = !GV->isDSOLocal();
+  // Weak symbols need GOT indirection even when hidden/DSO-local.
+  bool UseGOT_PREL = !GV->isDSOLocal() || GV->isWeakForLinker();
----------------
dongjianqiang2 wrote:

Good catch, thanks. Added a -O0 -fast-isel-abort=2 RUN line to weak-hidden-pic.ll — it will fail without the fix.  

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


More information about the llvm-commits mailing list