]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Disallow R_X86_64_32 relocations
authorMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2015 13:35:11 +0000 (13:35 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 12 Feb 2015 13:39:25 +0000 (13:39 +0000)
UEFI binaries may be relocated to any location within the 64-bit
address space.  We compile as position-independent code with hidden
visibility, which should force all relocation records to be either
PC-relative (in which case no PE relocations are required) or full
64-bit relocations.  There should be no R_X86_64_32 relocation
records, since that would imply an invalid assumption that code could
not be relocated above 4GB.

Remove support for R_X86_64_32 relocation records from util/elf2efi.c,
so that any such records result in a build failure rather than a
potential runtime failure.

Reported-by: Jan Kundrát <jkt@kde.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/elf2efi.c

index 45d539574e3be734958f7af38ab1c6334c692e7f..1e7a99b79c07cf694bf65d8de9fcc73f9e23093a 100644 (file)
@@ -481,8 +481,7 @@ static void process_reloc ( bfd *bfd __attribute__ (( unused )),
        } else if ( strcmp ( howto->name, "R_X86_64_64" ) == 0 ) {
                /* Generate an 8-byte PE relocation */
                generate_pe_reloc ( pe_reltab, offset, 8 );
-       } else if ( ( strcmp ( howto->name, "R_386_32" ) == 0 ) ||
-                   ( strcmp ( howto->name, "R_X86_64_32" ) == 0 ) ) {
+       } else if ( strcmp ( howto->name, "R_386_32" ) == 0 ) {
                /* Generate a 4-byte PE relocation */
                generate_pe_reloc ( pe_reltab, offset, 4 );
        } else if ( strcmp ( howto->name, "R_386_16" ) == 0 ) {