Skip to content

linker path missing from ldd.fakechroot output on mips64el, ppc64el and s390x #111

@josch

Description

@josch

On some architectures (like mips64el, ppc64el and s390x), the output of objdump -p does not include the linker itself and thus the output of ldd.fakechroot which relies on objdump -p is wrong. For example on amd64, running ldd /bin/true yields:

linux-vdso.so.1 (0x00007fff8abbd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1be9968000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1be9b8b000)

And running ldd.fakechroot /bin/true yields:

linux-vdso.so.1 (0x0000000000000000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000000000000000)
/lib64/ld-linux-x86-64.so.2 (0x0000000000000000)

This is the expected output. The last line is the absolute path to the linker. On some architectures, this does not work. Here is what ldd /bin/true shows on ppc64el:

linux-vdso64.so.1 (0x00007fffa08d0000)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x00007fffa0630000)
/lib64/ld64.so.2 (0x00007fffa08f0000)

And this is what ldd.fakechroot /bin/true prints:

linux-vdso.so.1 (0x0000000000000000)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x0000000000000000)
ld64.so.2 => /lib/powerpc64le-linux-gnu/ld64.so.2 (0x0000000000000000)

Notice that the line saying /lib64/ld64.so.2 is missing. This breaks software like mkinitramfs which relies on the ldd output to determine which libraries to copy into the initramfs. With the linker missing, no binary from the created initramfs can be executed.

To fix this, I suggest adding the linker path recorded in the .interp section of the ELF format. This can be obtained by running objdump -sj .interp /bin/true which, for example on ppc64el prints:

/bin/true:     file format elf64-powerpcle

Contents of section .interp:
 0238 2f6c6962 36342f6c 6436342e 736f2e32  /lib64/ld64.so.2
 0248 00                                   

The field contains the correct linker path /lib64/ld64.so.2.

I added a commit fixing ldd.fakechroot to #104.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions