[PATCH, MIPS] Fix typo in N64 PLT stub

Maxim Kuvyrkov maxim@codesourcery.com
Sat Nov 12 05:28:00 GMT 2011


Richard,

The following patch fixes a typo in N64 PLT stub.  The register move that saves return address for dynamic resolver to return to currently uses a 32-bit instruction, which truncates upper bits of the return address.

Now, I imagine you would ask why is there a 64-bit address in the PLT resolver that only works with 32-bit symbols (aka -msym32).  The answer is that the 64-bit return address leaks to the PLT0 from a shared library, which kernel is free to map anywhere it pleases.  The most common case is for C library to call atexit callbacks from a C++ application.

The -msym32 restriction applies only to symbols in executables, as those do have PLTs.  Symbols in shared libraries cannot have PLTs, and, simultaneously, they can't be guaranteed to be mapped to lower 32-bits of address space.

The patch was tested on GCC and GLIBC testsuites on MIPS64 target with no regressions between "-mabi=64" and "-mabi=64 -mplt -msym32" runs.

OK to apply?

Thank you,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-mips-64bit-plt.patch
Type: application/octet-stream
Size: 1431 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20111112/697a95bb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-mips-64bit-plt.ChangeLog
Type: application/octet-stream
Size: 120 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20111112/697a95bb/attachment-0001.obj>


More information about the Binutils mailing list