This is the mail archive of the binutils@sources.redhat.com 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]

redefining dynamic symbols??? -- why I want to.


> On Wed, Jul 17, 2002 at 05:49:52AM -0700, Jorge Luis Williams wrote:
>> > You'd need to examine the existing code in objcopy that does
>> > --redefine-sym and switch symbol table reading and writing to use
>> > the dynamic symbol table.
>> >
>>
>> I thought about doing this, however I was under the understanding that
>> this wouldn't work because I would also need to recompute the .hash
>> section
>
> Ouch.  I didn't think of that.  You'll find you need to copy/write
> quite a lot of code to do what you want.  Much easier to recompile
> whatever applications/shared libs you're trying to tweak.
>

Damn -- I'm trying to avoid translating and recompiling c code. Let me
explain what I'm trying to do -- maybe there's a fancy ld flag that will
work.

I  have three libraries lib_b, lib_c, lib_c_copy. lib_c and lib_c_copy
both define the same dynamic symbols. In fact they are true copies --
generated from the same code.


exe_a is dynamicly linked to lib_c and lib_b
lib_b is dynamicly linked to lib_c_copy



It seems that when I run exe_a both exe_a and lib_b use the same copy of
lib_c which causes some problems for what I'm trying to do.   I've tried
linker flag -Bsymbolic which I understood would prevent this from
happening, but this doesn't seem to work.


Another technique is statically linking exe_a to lib_c and lib_b to
lib_c_copy. This works under linux -- however it's not enough to fool the
dynamic linker/loader under solaris as here we still use the same copy of
lib_c.

My next attempt was to change the dynamic symbols in lib_b and lib_c_copy
so that they don't match those in lib_c -- we could do this after compile
time as part of the build, however as you just stated this seems to be
more difficult than it's worth.

Regenerating the code for lib_c so that it changes all the dynamic symbols
would not only complacate the code but also significantly increase compile
time (we have more than one library which we need to copy).

Basically, I'm all out of ideas -- any other suggestions??


Thanx,

jOrGe W.




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