diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index c0d051fcefe..8a02ca4b75d 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -251,7 +251,9 @@ static bool isDisp8(int Value) { } bool Emitter::gvNeedsLazyPtr(const GlobalValue *GV) { - return !Is64BitMode && + // For Darwin, simulate the linktime GOT by using the same lazy-pointer + // mechanism as 32-bit mode. + return (!Is64BitMode || TM.getSubtarget().isTargetDarwin()) && TM.getSubtarget().GVRequiresExtraLoad(GV, TM, false); }