[ipxe-devel] Unrecognised relocation type R_X86_64_32S in util/elf2efi64

Michael Brown mcb30 at ipxe.org
Thu Feb 12 13:41:43 UTC 2015


On 12/02/15 11:45, Jan Kundrát wrote:
> I'm actually on "Hardened Gentoo" which does patch its GCC, but I did
> take care to switch to a vanilla GCC as well, and the end result was the
> same. If I use unmodified GCC as provided by Gentoo and after a `git
> clean -dxf` in my src/, I still get these relocations, and the command
> invoking GCC remains the same. Am I cleaning stuff thoroughly enough?

I _think_ that a non-hardened gcc will not recognise "-nopie" and so 
would not cause iPXE to apply the workaround.  I may be wrong about this.

I don't have a Gentoo system on which to test.  Could you try applying 
the attached patch (which moves the workaround to i386-only) and see if 
this fixes your problem?

If it does work, could you also try "make everything" and then verify 
that you can run

   ./bin-i386-linux-tests.linux

and

   ./bin-x86_64-linux/tests.linux

>> I'm fairly sure there's no way to generate an equivalent PE relocation
>> for R_X86_64_32S, since UEFI allows objects to be loaded anywhere
>> within the 64-bit address space.
>
> I don't understand the object formats nor the amd64 ABI, but I am a bit
> surprised that R_X86_64_32 is supported, then. Is that a direct result
> of zero-extension vs. sign-extension?

It probably shouldn't be.  A quick check shows that the only instance of 
R_X86_64_32 in my build occurs in gdbstub_test.S, which is 
32-bit-specific code which shouldn't really be in the 64-bit build 
anyway and won't get linked in to any practical UEFI build.

The corresponding code in wimboot _does_ support R_X86_64_32 (and 
R_X86_64_32S) and does encounter instances of R_X86_64_32, but that's 
because of the way that wimboot (ab)uses the toolchain to build a 
combined 32/64-bit binary.

I've pushed a fix to iPXE which will cause build failures if the 
toolchain generates R_X86_64_32 records:

   http://git.ipxe.org/ipxe.git/commitdiff/907cffb

Thanks,

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipxe-gentoo-pie.patch
Type: text/x-patch
Size: 1664 bytes
Desc: not available
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20150212/b12dd77e/attachment.bin>


More information about the ipxe-devel mailing list