[ELF] - Read 16 bits for R_386_16/R_386_PC16 relocations instead of 32.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 8 Dec 2016 13:50:28 +0000 (13:50 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 8 Dec 2016 13:50:28 +0000 (13:50 +0000)
Looks it was theoretically incorrect if the section is at the very end of the file as
reading 32 bits would pass the end of file

llvm-svn: 289046

lld/ELF/Target.cpp

index 9f743d4..285dac7 100644 (file)
@@ -439,12 +439,13 @@ uint64_t X86TargetInfo::getImplicitAddend(const uint8_t *Buf,
   default:
     return 0;
   case R_386_16:
+  case R_386_PC16:
+    return read16le(Buf);
   case R_386_32:
   case R_386_GOT32:
   case R_386_GOT32X:
   case R_386_GOTOFF:
   case R_386_GOTPC:
-  case R_386_PC16:
   case R_386_PC32:
   case R_386_PLT32:
   case R_386_TLS_LE: