public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Andrew Pinski <pinskia@gmail.com>
Cc: binutils <binutils@sourceware.org>
Subject: Re: puzzling ld behavior, failing to find symbols from .so after adding more .o file
Date: Sat, 26 Mar 2022 18:19:21 +0300	[thread overview]
Message-ID: <7f94bd18-ff3e-d3de-d3a6-1568a0b3709c@msgid.tls.msk.ru> (raw)
In-Reply-To: <c5077107-ad8d-2f91-0908-35bc686b0e03@msgid.tls.msk.ru>

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

  reply	other threads:[~2022-03-26 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 20:15 Michael Tokarev
2022-03-25 22:43 ` Andrew Bell
2022-03-26 14:56   ` Michael Tokarev
2022-03-26  0:25 ` Andrew Pinski
2022-03-26 15:06   ` Michael Tokarev
2022-03-26 15:19     ` Michael Tokarev [this message]
2022-03-30  1:50       ` Alan Modra
2022-03-26 15:19 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f94bd18-ff3e-d3de-d3a6-1568a0b3709c@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=binutils@sourceware.org \
    --cc=pinskia@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).