From 624894b4d2e29559e7521cfd2f1946f9de1802e1 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <peter@pcc.me.uk>
Date: Mon, 26 Oct 2015 20:46:44 +0000
Subject: [PATCH] ARM/ELF: Restore original (pre-r251322) logic for deciding
 whether to use GOT.

Unbreaks linking with gold, which cannot resolve direct relocations referring
to global symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251342 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/Target/ARM/ARMFastISel.cpp     | 2 +-
 lib/Target/ARM/ARMISelLowering.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index a2093ebb85d..175107450fc 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -2940,7 +2940,7 @@ bool ARMFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
 unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV,
                                      unsigned Align, MVT VT) {
   bool UseGOT_PREL =
-      !(GV->hasHiddenVisibility() || GV->isStrongDefinitionForLinker());
+      !(GV->hasHiddenVisibility() || GV->hasLocalLinkage());
 
   LLVMContext *Context = &MF->getFunction()->getContext();
   unsigned ARMPCLabelIndex = AFI->createPICLabelUId();
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 36f8886ea0e..49f8918b8dd 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -2637,7 +2637,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
   const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
   if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
     bool UseGOT_PREL =
-        !(GV->hasHiddenVisibility() || GV->isStrongDefinitionForLinker());
+        !(GV->hasHiddenVisibility() || GV->hasLocalLinkage());
 
     MachineFunction &MF = DAG.getMachineFunction();
     ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
-- 
2.40.0