efi_loader: correctly apply relocations from the .reloc section
authorIvan Gorinov <ivan.gorinov@intel.com>
Wed, 2 May 2018 23:36:02 +0000 (16:36 -0700)
committerAlexander Graf <agraf@suse.de>
Sun, 3 Jun 2018 13:27:20 +0000 (15:27 +0200)
commite2dc4229ad009df13b131fcc16516e79c14276b7
tree883424068e4d09aeba252773c304057c340ed6c0
parent040b2583c3a87c83606b3df64ea653ccaf3aea62
efi_loader: correctly apply relocations from the .reloc section

Instead of difference between preferred and actual image base, the
actual base is added to the fields specified in the .reloc section.

Use ImageBase from PE optional header to compute the delta,
exit early if the image is loaded at the preferred address.

Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_image_loader.c