Index: lib/Target/X86/X86Subtarget.cpp =================================================================== --- lib/Target/X86/X86Subtarget.cpp +++ lib/Target/X86/X86Subtarget.cpp @@ -150,6 +150,7 @@ // target. if (isTargetELF() && is64Bit() && F && F->hasFnAttribute(Attribute::NonLazyBind) && + !GV->hasLocalLinkage() && GV->hasDefaultVisibility() && GV->isDeclarationForLinker()) return X86II::MO_GOTPCREL; Index: test/CodeGen/X86/no-plt.ll =================================================================== --- test/CodeGen/X86/no-plt.ll +++ test/CodeGen/X86/no-plt.ll @@ -6,12 +6,14 @@ define i32 @main() #0 { ; X64: callq *_Z3foov@GOTPCREL(%rip) ; X64: callq _Z3barv +; X64: callq _Z3bazv entry: %retval = alloca i32, align 4 store i32 0, i32* %retval, align 4 %call1 = call i32 @_Z3foov() %call2 = call i32 @_Z3barv() + %call3 = call i32 @_Z3bazv() ret i32 0 } @@ -20,4 +22,9 @@ declare i32 @_Z3barv() #2 +; Function Attrs: nonlazybind +declare hidden i32 @_Z3bazv() #3 + + attributes #1 = { nonlazybind } +attributes #3 = { nonlazybind }