This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Changing SONAME of existing binary .so library


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]