[ELF] - X86_64: Use white list for relocations checked by isPicRel.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 4 Apr 2018 15:21:21 +0000 (15:21 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 4 Apr 2018 15:21:21 +0000 (15:21 +0000)
isPicRel is used to check if we want to create the dynamic relocations.
Not all of the dynamic relocations we create are passing through this
check, but those that are, probably better be whitelisted.

Differential revision: https://reviews.llvm.org/D45252

llvm-svn: 329203

lld/ELF/Arch/X86_64.cpp

index 879fe31..3804ade 100644 (file)
@@ -156,9 +156,8 @@ void X86_64<ELFT>::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
 }
 
 template <class ELFT> bool X86_64<ELFT>::isPicRel(RelType Type) const {
-  return Type != R_X86_64_8 && Type != R_X86_64_PC8 && Type != R_X86_64_16 &&
-         Type != R_X86_64_PC16 && Type != R_X86_64_32 &&
-         Type != R_X86_64_PC32 && Type != R_X86_64_TPOFF32;
+  return Type == R_X86_64_64 || Type == R_X86_64_PC64 ||
+         Type == R_X86_64_SIZE32 || Type == R_X86_64_SIZE64;
 }
 
 template <class ELFT>