[ELF] - Implemented R_386_16 and R_386PC16 relocations
authorGeorge Rimar <grimar@accesssoftek.com>
Sat, 3 Dec 2016 07:30:30 +0000 (07:30 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Sat, 3 Dec 2016 07:30:30 +0000 (07:30 +0000)
commit1b3d34a2989d16859615a604de00ddbfb17e64c0
tree6ebb8032310c08af641a02d50d40d077fb83ea36
parent40c28c7f9a0aac9795cff04e5f7e36108d8c00c1
[ELF] - Implemented R_386_16 and R_386PC16 relocations

A program or object file using R_386_8, R_386_16, R_386_PC16 or R_386_PC8
relocations is not conformant to latest ABI. The R_386_16, and R_386_8
relocations truncate the computed value to 16 - bits and 8 - bits
respectively. R_386_PC16 and R_386_16 are used by some
applications, for example by FreeBSD loaders.

Previously we did not take addend in account for these relocation,
counting it as 0, what is wrong and was a reason of hangs.

This patch needed for example for FreeBSD pmbr (protective mbr).

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

llvm-svn: 288581
lld/ELF/Target.cpp
lld/test/ELF/i386-pc16.test [new file with mode: 0644]