patchelf icon indicating copy to clipboard operation
patchelf copied to clipboard

Dynamically linked uClibc MIPS binaries are not recognized, missing section headers?

Open jschwartzenberg opened this issue 1 year ago • 0 comments

Describe the bug

I am trying to patch binaries that show the following when ran through file:

ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, no section header

But patchelf shows me:

patchelf: no section headers. The input file is probably a statically linked, self-decompressing binary

Steps To Reproduce

Example binary: curl.gz Running file or patchelf against it will give the messages as shown above.

Expected behavior

I am hoping that there is still a way to change the loader and the libraries that it's looking for.

patchelf --version output

I tested with the version from my distro and the latest Git:

$ patchelf --version
patchelf 0.14.3
$ ./src/patchelf --version
patchelf 0.18.0

Additional context

These binaries are coming from this firmware, that I extracted with binwalk -e: https://www.devolo.nl/fileadmin/Web-Content/DE/products/hnw/magic-2-wifi/firmware/delos_magic-2-wifi-v1_6.0.1_2023-09-06.bin

I managed to successfully patch and reuse binaries for the ARM version of this device on modern OpenWRT, but trying to do the same with the MIPS version, I'm running into the problem that the binaries are not recognized.

Many thanks in advance for any help or advice!!

jschwartzenberg avatar Nov 03 '24 21:11 jschwartzenberg