patchelf icon indicating copy to clipboard operation
patchelf copied to clipboard

patchelf: cannot find section '.dynamic'. The input file is most likely statically linked

Open yonghui-zhao opened this issue 2 years ago • 2 comments

Describe the bug

readelf -S ld-2.17.so | grep dynamic

[17] .dynamic DYNAMIC 0000000000221e00 00021e00

readelf -S ld-linux-x86-64.so.2 | grep dynamic

[17] .dynamic DYNAMIC 0000000000221e00 00021e00

patchelf --set-rpath :/lib64/:../lib64/xxxxx/:/opt/xxxxx/lib64/xxxx ld-2.17.so

readelf -S ld-linux-x86-64.so.2 | grep dynamic

readelf: Error: no .dynamic section in the dynamic segment

patchelf --set-rpath :/lib64/:../lib64/xxxxxx/:/opt/xxxxx/lib64/xxxxxld-linux-x86-64.so.2

patchelf: cannot find section '.dynamic'. The input file is most likely statically linked

#patchelf --version patchelf 0.12

yonghui-zhao avatar Feb 22 '23 07:02 yonghui-zhao

I cannot reproduce this with glibc 2.35-224 ($ cp /nix/store/lqz6hmd86viw83f9qll2ip87jhb7p1ah-glibc-2.35-224/lib/ld-linux-x86-64.so.2 /tmp/foo.so)

./src/patchelf --set-rpath foo /tmp/foo.so

on git commit 8d3188daa7fbefb93e8d967d2967ca45934c30aa

But also what are you trying to achieve here? You cannot set an RPATH on your linker since your linker will not read itself for this information and also has no dependencies. Instead you need to patch other libraries or executables to have this information

Mic92 avatar Feb 22 '23 08:02 Mic92

Cannot find section .dynamic #143 is same problom

yonghui-zhao avatar Feb 22 '23 12:02 yonghui-zhao