[PATCH] D13481: [X86] Call locally defined function directly for PIE

H.J Lu via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 07:19:25 PDT 2015


hjl.tools added a comment.

This seems to work:

  diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
  index d94e91b..34f88b9 100644
  --- a/lib/Target/X86/X86Subtarget.cpp
  +++ b/lib/Target/X86/X86Subtarget.cpp
  @@ -154,8 +154,8 @@ ClassifyGlobalFunctionReference(const GlobalValue *GV,
     // we don't need to use the PLT - we can directly call it.
     if (isTargetELF() &&
         TM.getRelocationModel() == Reloc::PIC_ &&
  -      !(TM.Options.PositionIndependentExecutable &&
  -        GV->isStrongDefinitionForLinker()) &&
  +      (!TM.Options.PositionIndependentExecutable ||
  +       GV->isDeclarationForLinker()) &&
         GV->hasDefaultVisibility() && !GV->hasLocalLinkage()) {
       return X86II::MO_PLT;
     } else if (isPICStyleStubAny() &&


Repository:
  rL LLVM

http://reviews.llvm.org/D13481





More information about the llvm-commits mailing list