PECOFF: Fix base relocation for ImageBase.
authorRui Ueyama <ruiu@google.com>
Fri, 20 Feb 2015 03:35:59 +0000 (03:35 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 20 Feb 2015 03:35:59 +0000 (03:35 +0000)
commit11f42aa2854bf27a7eb38e3fbfe1fe0f5a24a24a
tree843036343eb477d73efd4705e76ec69ee8673b95
parentad6eb127c9e4c48cfdff1f47e5efe83255b15565
PECOFF: Fix base relocation for ImageBase.

This is yet another edge case of base relocation for symbols. Absolute
symbols are in general not target of base relocation because absolute
atom is a way to point to a specific memory location. In r229816, I
removed entries for absolute atoms from the base relocation table
(so that they won't be fixed by the loader).

However, there was one exception -- ImageBase. ImageBase points to the
start address of the current image in memory. That needs to be fixed up
at load time. This patch is to treat the symbol in a special manner.

llvm-svn: 229961
lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
lld/test/pecoff/Inputs/basereloc.obj.yaml
lld/test/pecoff/base-reloc.test