[PATCH] D39625: Attribute nonlazybind should not affect calls to functions with hidden visibility
Sriraman Tallam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 16:38:01 PDT 2017
tmsriram created this revision.
Attribute nonlazybind should not affect calls to functions with hidden visibility.
https://reviews.llvm.org/D39065 skips the PLT for calls to external functions marked with "nonlazybind" attribute. However, this should not affect functions with hidden visibility or local linkage. This patch fixes that.
https://reviews.llvm.org/D39625
Files:
lib/Target/X86/X86Subtarget.cpp
test/CodeGen/X86/no-plt.ll
Index: test/CodeGen/X86/no-plt.ll
===================================================================
--- test/CodeGen/X86/no-plt.ll
+++ test/CodeGen/X86/no-plt.ll
@@ -6,18 +6,25 @@
define i32 @main() #0 {
; X64: callq *_Z3foov at 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
}
; Function Attrs: nonlazybind
declare i32 @_Z3foov() #1
declare i32 @_Z3barv() #2
+; Function Attrs: nonlazybind
+declare hidden i32 @_Z3bazv() #3
+
+
attributes #1 = { nonlazybind }
+attributes #3 = { nonlazybind }
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39625.121565.patch
Type: text/x-patch
Size: 1149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171103/3f9e2dd4/attachment.bin>
More information about the llvm-commits
mailing list