1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[MC] Don't resolve relocations referencing STB_LOCAL STT_GNU_IFUNC

This commit is contained in:
Fangrui Song 2020-01-13 23:35:57 -08:00
parent 8fb73cb820
commit 2f4e86624d
2 changed files with 9 additions and 2 deletions

View File

@ -1514,7 +1514,8 @@ bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const auto &SymA = cast<MCSymbolELF>(SA);
if (IsPCRel) {
assert(!InSet);
if (SymA.getBinding() != ELF::STB_LOCAL)
if (SymA.getBinding() != ELF::STB_LOCAL ||
SymA.getType() == ELF::STT_GNU_IFUNC)
return false;
}
return MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,

View File

@ -9,6 +9,7 @@
# RELOC-NEXT: 0xA R_X86_64_PLT32 weak 0xFFFFFFFFFFFFFFFC
# RELOC-NEXT: 0x19 R_X86_64_PLT32 global 0xFFFFFFFFFFFFFFFC
# RELOC-NEXT: 0x1E R_X86_64_PLT32 weak 0xFFFFFFFFFFFFFFFC
# RELOC-NEXT: 0x23 R_X86_64_PLT32 ifunc 0xFFFFFFFFFFFFFFFC
# RELOC-NEXT: }
# CHECK: 0: jmp
@ -19,14 +20,17 @@
# CHECK-NEXT: 13: callq
# CHECK-NEXT: 18: callq
# CHECK-NEXT: 1d: callq
# CHECK-NEXT: 22: retq
# CHECK-NEXT: 22: callq
# CHECK-NEXT: 27: retq
.globl global
.weak weak
.type ifunc,@gnu_indirect_function
global:
weak:
local:
.set var,global
ifunc:
jmp var
jmp local
jmp global
@ -36,4 +40,6 @@ local:
call local
call global
call weak
call ifunc
ret