diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-12-15 00:32:09 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-12-15 00:32:09 +0000 |
commit | 05e285bcc5a0a4c387d8b311d8a0426cccfa5273 (patch) | |
tree | a0d75bdbcfd608269083cd991734a7514746ccac /llvm/lib/Target/X86/X86FastISel.cpp | |
parent | a1eb9432b1d9a2fa09e1a1dbdcc0296515d7ab84 (diff) | |
download | bcm5719-llvm-05e285bcc5a0a4c387d8b311d8a0426cccfa5273.tar.gz bcm5719-llvm-05e285bcc5a0a4c387d8b311d8a0426cccfa5273.zip |
FastISel: support no-PLT PIC calls on ELF x86_64
Add support for properly handling PIC code with no-PLT. This equates to
`-fpic -fno-plt -O0` with the clang frontend. External functions are
marked with nonlazybind, which must then be indirected through the GOT.
This allows code to be built without optimizations in PIC mode without
going through the PLT. Addresses PR35653!
llvm-svn: 320776
Diffstat (limited to 'llvm/lib/Target/X86/X86FastISel.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index cea4dec503d..5dae485f4c9 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -3458,13 +3458,11 @@ bool X86FastISel::fastLowerCall(CallLoweringInfo &CLI) { assert(GV && "Not a direct call"); // See if we need any target-specific flags on the GV operand. unsigned char OpFlags = Subtarget->classifyGlobalFunctionReference(GV); - // Ignore NonLazyBind attribute in FastISel - if (OpFlags == X86II::MO_GOTPCREL) - OpFlags = 0; // This will be a direct call, or an indirect call through memory for // NonLazyBind calls or dllimport calls. - bool NeedLoad = OpFlags == X86II::MO_DLLIMPORT; + bool NeedLoad = + OpFlags == X86II::MO_DLLIMPORT || OpFlags == X86II::MO_GOTPCREL; unsigned CallOpc = NeedLoad ? (Is64Bit ? X86::CALL64m : X86::CALL32m) : (Is64Bit ? X86::CALL64pcrel32 : X86::CALLpcrel32); |