.so dynamic library mangling tool

Steve Harvey sgh-Ja3L+HSX0kI at public.gmane.org
Sun Dec 5 07:35:54 UTC 2004


On Sat, Dec 04, 2004 at 10:12:46PM -0500, Sergey Kuznetsov wrote:
> The issue was not the library itself ( the library at the right place, 
> at /lib directory )
> but with the .so file itself.
> that file is a optional part of the Asterisk PBX program, and it's G.729 
> codec library,
> and specifically for GLIB 2.3 X86_64 platform under Gentoo.
> The error Asterisk gives me is:
> 
> [codec_g729a.so]Dec  4 19:34:04 WARNING[16384]: loader.c:248 
> ast_load_resource: /usr/lib/asterisk/modules/codec_g729a.so: undefined 
> symbol: gzread
> Dec  4 19:34:04 WARNING[16384]: loader.c:429 load_modules: Loading 
> module codec_g729a.so failed!
> 
> The ldd saying about codec_g729a.so is:
> # ldd codec_g729a.so
>        libc.so.6 => /lib/libc.so.6 (0x0000002a9567d000)
>        /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 
> (0x000000552aaaa000)
> 
> The nm -D codec_g729a.so saying is:
>                 U gzclose
>                 U gzdopen
>                 U gzread
> 
> The nm -D /lib/libz.so saying is:
> 00000000000035f0 T gzclose
> 00000000000026a0 T gzdopen
> 0000000000002ab0 T gzread
> 
> The objdump -x codec_g729a.so saying is:
> Dynamic Section:
>  NEEDED      libc.so.6
>  INIT        0x35c0
> 
> As you can see here is the NEEDED libz.so is absent. And this is I am 
> trying to fix. Thats why I need such tool who can mangle the any 
> library's header I want.
> 
  I assume that setting the LD_PRELOAD environment variable is not an 
option in your situation.

  I don't know of any single tool that will do that.  Perhaps you might
be able to carve the library up with objcopy and re-build it using ld
and a specially crafted linker script in order to get both NEEDED 
entries.

  If you have write perms on /usr/local/lib, I might try building a 
customized libc to which the libz modules have been added, making it 
reachable via /usr/local/lib/libZ.so.6 (making sure that libZ is unique
in your system).  Ensure that its internal SONAME is "libZ.so.6" (vi
makes a good binary editor), run ldconfig, then use a patched 
codec_g729a.so with the "libc.so.6" string in the file suitably altered.

-- 
Steve Harvey
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list