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.

llvm-svn: 251342
This commit is contained in:
Peter Collingbourne 2015-10-26 20:46:44 +00:00
parent 0b7b424253
commit 9e870daa98
2 changed files with 2 additions and 2 deletions

View File

@ -2940,7 +2940,7 @@ bool ARMFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV, unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV,
unsigned Align, MVT VT) { unsigned Align, MVT VT) {
bool UseGOT_PREL = bool UseGOT_PREL =
!(GV->hasHiddenVisibility() || GV->isStrongDefinitionForLinker()); !(GV->hasHiddenVisibility() || GV->hasLocalLinkage());
LLVMContext *Context = &MF->getFunction()->getContext(); LLVMContext *Context = &MF->getFunction()->getContext();
unsigned ARMPCLabelIndex = AFI->createPICLabelUId(); unsigned ARMPCLabelIndex = AFI->createPICLabelUId();

View File

@ -2637,7 +2637,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal(); const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
bool UseGOT_PREL = bool UseGOT_PREL =
!(GV->hasHiddenVisibility() || GV->isStrongDefinitionForLinker()); !(GV->hasHiddenVisibility() || GV->hasLocalLinkage());
MachineFunction &MF = DAG.getMachineFunction(); MachineFunction &MF = DAG.getMachineFunction();
ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>(); ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();