Open antocuni opened 7 years ago
I ran into a similar issue today but with libnsl.so
- first reported this in the context of linuxdeployqt
, see this issue. Happens on both Fedora 25 and CentOS 7.3.
Not sure if it can help you but the following snippet could resolve your issue:
import lief
libm = lief.parse("libm-2.12.so")
libm[lief.ELF.DYNAMIC_TAGS.SONAME].name = "xxx"
libm.write("libm_updated.so")
readelf -d ./libm_updated.so
Dynamic section at offset 0x83df8 contains 24 entries:
Étiquettes Type Nom/Valeur
0x0000000000000001 (NEEDED) Bibliothèque partagée: [libc.so.6]
0x000000000000000e (SONAME) Bibliothèque soname: [xxx]
0x000000000000000c (INIT) 0x4d88
0x000000000000000d (FINI) 0x453d8
0x0000000000000004 (HASH) 0x82c68
0x000000006ffffef5 (GNU_HASH) 0x1280
0x0000000000000005 (STRTAB) 0x493000
0x0000000000000006 (SYMTAB) 0x2228
0x000000000000000a (STRSZ) 1911 (octets)
0x000000000000000b (SYMENT) 24 (octets)
0x0000000000000003 (PLTGOT) 0x283fe8
0x0000000000000002 (PLTRELSZ) 264 (octets)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x4c80
0x0000000000000007 (RELA) 0x4bd8
0x0000000000000008 (RELASZ) 168 (octets)
0x0000000000000009 (RELAENT) 24 (octets)
0x000000006ffffffc (VERDEF) 0x4b48
0x000000006ffffffd (VERDEFNUM) 3
0x000000006ffffffe (VERNEED) 0x4ba8
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x48b2
0x000000006ffffff9 (RELACOUNT) 1
0x0000000000000000 (NULL) 0x0
Sorry for the Shameless plug of LIEF
Link to file seems dead, so here's a cpy of file in question I grabbed from a centos-6 docker image: http://ix.io/DFU
Can reproduce (with patchelf 0.9), FWIW.
Still a bug in master.
Still a bug in master.
If I try to run patchelf on the libm.so which is shipped with centos6, I get a corrupted file: (for convenience, you can find the file also here: http://antocuni.eu/misc/libm-2.12.so)
Moreover, the sections also appear to be corrupted: note the names of some of the sections (like
e.ABI-tag
instead ofnote.ABI-tag
,la.dyn
instead ofrela.dyn
, etc):For context, I got this problem when I tried to build a python wheel on a centos 6 docker image.