puzzling ld behavior, failing to find symbols from .so after adding more .o file
Michael Tokarev
mjt@tls.msk.ru
Sat Mar 26 15:19:21 GMT 2022
26.03.2022 18:06, Michael Tokarev wrote:
..
>>> /usr/bin/ld: ./bin/default/../../source3/lib/dbwrap/dbwrap_ctdb.c:1639: undefined reference to `tdb_null'
>>> /usr/bin/ld: source3/lib/dbwrap/dbwrap_ctdb.c.45.o: relocation R_X86_64_PC32 against undefined hidden symbol `tdb_null' can not be used when making a
>>> shared object
>
> Someone on the IRC told me this:
>
> <trofi> R_X86_64_PC32 is is a relocation required to be local to the module. Note it's not GOT-relative.
> <trofi> you need to check how tdb_null is declared when it's compiled
>
> I don't know what is a relocation required to be local or
> what is GOT-relative. But I do know there are several
> different possibilities for libtdb compilation.
I think I got it sorted out.
in the new version the tdb.h file (which declares tdb_null
and other stuff) added _PUBLIC_ attribute before all symbols,
which is by default evaluates to attribute(visibility(default)).
But when compiling samba, _PUBLIC_ is defined to
attribute(visibility(hidden)) before including tdb.h.
And things goes the wrong way from here...
It is interesting still why ld behaves this way, but the
mystery is now solved.
Thanks,
/mjt
More information about the Binutils
mailing list