A weak symbol will yield "Missing ELF symbol" in gdb. In my case, I linked a binary A
against a shared lib B
, in which A
references weak symbol g_var
which defined in B
. The unexpected behavior is: the linker auto removed B
from the linking libs.
My solution was to add -Wl,--no-as-needed
to link options.