diff options
author | Fangrui Song <maskray@google.com> | 2019-12-17 21:35:02 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-12-20 11:32:02 -0800 |
commit | e8054f0933701a885a42e4a240f050402d7930e0 (patch) | |
tree | e6cb34e2d0bc9bd0f8e5456525e08b49f13a37c4 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | de2378b4f3c4c88eae412a30a8bfaec82f54d1b7 (diff) | |
download | bcm5719-llvm-e8054f0933701a885a42e4a240f050402d7930e0.tar.gz bcm5719-llvm-e8054f0933701a885a42e4a240f050402d7930e0.zip |
[PPC32] Emit R_PPC_PLTREL24 for calls to dso_local ifunc
static void *ifunc(void) __attribute__((ifunc("resolver")));
void foo() { ifunc(); }
The relocation produced by the ifunc() call:
1. gcc -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
2. gcc -msecure-plt -PIE => R_PPC_PLTREL24 r_addend=0x8000
3. clang -msecure-plt -fPIC => R_PPC_PLTREL24 r_addend=0x8000
4. clang -msecure-plt -fPIE => R_PPC_REL24
4 is incorrect. The R_PPC_REL24 needs a call stub due to ifunc. If this
relocation is mixed with other R_PPC_PLTREL24(r_addend=0x8000) in a
function, both GNU ld and lld (after D71621 fix) may produce a wrong
result.
This patch fixes 4 to use R_PPC_PLTREL24, which matches GCC.
Both GNU ld and lld (after D71621) will be happy.
Reviewed By: sfertile
Differential Revision: https://reviews.llvm.org/D71649
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
0 files changed, 0 insertions, 0 deletions