From bde752e10f1536a10392e82aa0a24032f3c19923 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 24 Aug 2016 19:02:29 +0000 Subject: [PATCH] Use isTargetMachO instead of isTargetDarwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279655 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMSubtarget.cpp | 2 +- test/CodeGen/ARM/macho-extern-hidden.ll | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/ARM/macho-extern-hidden.ll diff --git a/lib/Target/ARM/ARMSubtarget.cpp b/lib/Target/ARM/ARMSubtarget.cpp index b6e2b3aee17..469d340d122 100644 --- a/lib/Target/ARM/ARMSubtarget.cpp +++ b/lib/Target/ARM/ARMSubtarget.cpp @@ -282,7 +282,7 @@ bool ARMSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const { // 32 bit macho has no relocation for a-b if a is undefined, even if b is in // the section that is being relocated. This means we have to use o load even // for GVs that are known to be local to the dso. - if (isTargetDarwin() && TM.isPositionIndependent() && + if (isTargetMachO() && TM.isPositionIndependent() && (GV->isDeclarationForLinker() || GV->hasCommonLinkage())) return true; diff --git a/test/CodeGen/ARM/macho-extern-hidden.ll b/test/CodeGen/ARM/macho-extern-hidden.ll new file mode 100644 index 00000000000..6a45f008bf3 --- /dev/null +++ b/test/CodeGen/ARM/macho-extern-hidden.ll @@ -0,0 +1,10 @@ +; RUN: llc < %s -mtriple=thumbv7em-apple-unknown-macho | FileCheck %s + +; CHECK: movw r0, :lower16:(L_bar$non_lazy_ptr-(LPC0_0+4)) +; CHECK: movt r0, :upper16:(L_bar$non_lazy_ptr-(LPC0_0+4)) + +@bar = external hidden global i32 +define i32 @foo() { + %tmp = load i32, i32* @bar, align 4 + ret i32 %tmp +} -- 2.11.0