This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Changing SONAME of existing binary .so library
- From: Ian Lance Taylor <iant at google dot com>
- To: "Filipe Brandenburger" <filbranden at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 16 Dec 2008 07:18:28 -0800
- Subject: Re: Changing SONAME of existing binary .so library
- References: <e814db780812141735n7786dba1k78bd61da7eb48cfe@mail.gmail.com>
"Filipe Brandenburger" <filbranden@gmail.com> writes:
> Is there any way to change the library using "objcopy" or any other
> tool to accomplish this task of changing the SONAME? What would be the
> appropriate command syntax to do that?
objcopy does not support that.
In general it is difficult to change this sort of thing in a fully
linked shared library. In a linked binary you can not move any code
or data. Adding a new DT_SONAME tag would require adding or modifying
the .dynamic section and the .dynstr section. Making them larger is
difficult because there won't be any space, so if data needs to be
added they need to be moved elsewhere in the executable image. This
then requires adding a new PT_LOAD segment to bring them into memory.
There probably isn't room for a new segment, so you also need to move
the segment table. All in all, it's possible, but it's a lot of
bookkeeping, and as far as I know nobody has ever implemented it.
Ian