From d04cd22ff4b0a54656185fdcde6d24adae4d08e5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 2 Jun 2008 07:52:43 +0000 Subject: [PATCH] Don't use the GOT for symbols that are not externally visible. llvm-svn: 51865 --- llvm/lib/Target/X86/X86Subtarget.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index 23ceb9ba966d..b4c58496961a 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -44,9 +44,12 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, GV->hasCommonLinkage() || (GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode()))); } else if (isTargetELF()) { - // Extra load is needed for all non-statics. - return (!isDirectCall && - (GV->isDeclaration() || !GV->hasInternalLinkage())); + // Extra load is needed for all externally visible. + if (isDirectCall) + return false; + if (GV->hasInternalLinkage() || GV->hasHiddenVisibility()) + return false; + return true; } else if (isTargetCygMing() || isTargetWindows()) { return (GV->hasDLLImportLinkage()); }