[PATCH, cross prelink] 0001-Pull-ld.so-s-name-from-PT_INTERP-to-avoid-the-runtim.patch
Mark Hatle
mark.hatle@windriver.com
Tue Apr 10 20:23:00 GMT 2012
On 4/10/12 2:56 PM, Maxim Kuvyrkov wrote:
> On 11/04/2012, at 7:46 AM, Mark Hatle wrote:
>
>> On 4/10/12 2:27 PM, Maxim Kuvyrkov wrote:
>>> Mark,
>>>
>>> This patch makes rtld emulator in cross prelink use ld.so's name as it is encoded in PT_INTERP header.
>>>
>>> Currently, rtld emulator returns "lib/ld.so.1" for runtime linker's name, but the linker actually expects "/lib/ld.so.1" -- that one slash at the beginning causes prelink checks done by the runtime linker to fail and not use prelink information.
>>>
>>> The runtime linker sets up a map for itself under the name stored in PT_INTERP header of the executable, and this patch makes rtld emulator follow the suit.
>>>
>>> I have tested this patch using a different version of rtld emulator (the one that CodeSourcery / Mentor maintains), but the function in question is the same in both, so this patch is also relevant for Yocto's prelink.
>>>
>>> Any comments? Please merge at your leisure.
>>
>> prelinker currently checks that the ld.so name matches what it's expecting for any given arch in the PL_ARCH structure. Does this change any of that behavior? Or does it simply change the internal prelink-rtld behavior so that it the prelink-rtld acts as if it's name is the PT_INTERP element?
>
> It is the latter. Only behavior of prelink-rtld is change to the effect that it outputs "/lib/ld.so.1 -> /lib/ld.so.1 ..." as executable's dependency.
>
> Forgot to mention: the dependency on ld.so.1 [usually] comes from libdl.so, which is, probably, why this bug wasn't noticed before.
Thanks, I think I understand what is going on now. I'll look into getting this
merged into the cross prelinker later today or tomorrow.
--Mark
> --
> Maxim Kuvyrkov
> CodeSourcery / Mentor Graphics
>
More information about the Prelink
mailing list