Re: Help with linker options

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

 



On 10/31/2016 06:01 PM, Sven C. Dack wrote:
On 31/10/16 17:16, Nikolaus Dunn wrote:
...
Both libA and libB have the symbol:
_ZNSt15basic_stringbufIcSt11char_traitsIcE18tracking_allocatorIcEE8overflowEi

How do I get libA to use its own version of that symbol? I thought
that was what -Bsymbolic-functions was supposed to do.

Thanks,
Nik

I don't think you can have the same symbol twice in a symbol table. -Bsymbolic only protects against symbol overwriting by the executable, but you still have the issue of having multiple definitions for the same symbol. You will have to use "-z muldefs" if you don't already use it, which however will only allow for multiple definitions, but the linker will then pick the first definition it finds and discards all the others. So I'm not sure if this is possible at all.

You could try to undefine the symbol with "-u name" and thereby avoid it from being entered into the global symbol table. Or undefine the symbol for each libA and liB just before you link against them.


Thank you for your response. I think the issue I'm having is because although I've statically linked against libstdc++, there are vtables with the same name in more than one library. I suspect the application is picking the first vtable that matches the class name and using that. If so, is this behavior customizable?

If library A defines a class Foo and library B defines a class Foo and the two are used in the same application, would it be possible to force any code in library A that instantiates instances of Foo to use library A's definition of the vtable and any code in library B that does the same to use its definition of the vtable for Foo?

Is this possible?

I can't find much information on how the vtables themselves are loaded in an application and how the value for vptr is established.

Thanks,

Nik




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux