breakage of -Bsymbolic-functions as LDFLAGS
sistpoty at ubuntu.com
Fri May 16 22:24:22 BST 2008
first off all, I'm by far no expert on ELF and shared objects. What I write
here is mainly based on trial-and-error and on recent observations. I'd be
highly interested that more experienced people will correct me.
So what does -Bsymbolic-functions:
Let's assume you have a library, which defines the following:
without -Bsymbolic-functions, you can redefine dispatch_write_hello in a
program (or a shared library depending on this library). At run-time, the new
function will be called.
e.g. a progam like this:
main(int argc, char **argv)
this will result in:
With -Bsymbolic-functions, all calls inside the library will be resolved at
compile time, in case they are defined there. Hence the overridden
dispatch_write_hello will never be called. The output will be:
So my assumption is, that if you want to look for different behaviours for
LDFLAGS, you just need to look out for duplicate symbols. To do this, I've
written a very rough script at . (this is far from complete).
Also, I've found that this behaviour is valid for weak symbols as well.
In a c-program, I believe that weak symbols are mainly used for excactly this
purpose (unlike c++, where these are the result of inline implementations
inside header files). So you might also want to grep for "weak" to check if
there's s.th. like
#pragma weak foobar
or a definition of foobar with
To conclude, my assumption is that if (a worked over version) of  won't
find any duplicate symbols and you do find functions defined as weak symbols,
it's done on purpose.
OTOH, you if should find duplicate symbols with  and there are no weak
definitions, it is likely to be a bug. Of course, if a duplicate symbol is
found, you should always look at the corresponding function in the source
code to be sure.
In the hope, that this will help to identify whether -Bsymbolic-functions
results in a bug found if it fails, or will fail due to software design on
purpose (and also, that someone more experienced will enlighten me, what
assumptions here are wrong),
: corresponding bug: https://bugs.launchpad.net/ubuntu/+bug/230460
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20080516/eb61006d/attachment.pgp
More information about the ubuntu-devel