tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __strong_alias

David Laight <> wrote:

> To see what is happening in your test program too at the namelists
> from the program and shared library, and then look at the relocation
> entries (objdump -R) to see what is actually referenced by the call
> foo().

objdump -R reports nothing about foo, either in, nor in test
(whether linked with -ltest or not)

nm reports it, thought:

$ nm|grep foo
00000444 T foo
00000430 T libtest_foo

$ nm  test|grep foo
080487a0 W foo
080487a0 T main_foo

objdump -d shows it does not tries to go through PLT:
 8048819:       e8 a2 ff ff ff          call   80487c0 <main_foo>

I modified my test to get closer to weak/strong alias usage around libc: has __strong_alias(foo, libstrong_foo); has __weak_alias(foo, libweak_foo);
test is linked with -lweak, dlopen() and calls foo().

libweak_foo is invoked. This time objdump -R tells us:

$ objdump -R test|grep foo
080499d0 R_386_JUMP_SLOT   foo

And objdump -d:
 80487f5:       e8 02 fd ff ff          call   80484fc <foo@plt>

This time I get the PLT right, but strong_foo() is still not called.
Does that means that dlopen() never causes strong aliases to override
weak aliases?

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index