public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Dan Kegel <dank@kegel.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: Spurious undefined reference error?
Date: Thu, 20 Dec 2012 23:19:00 -0000	[thread overview]
Message-ID: <CAPF-yOavcV2xu74ey7PTB60=8Rycodi2Y2fXs44NgmCHMKXezg@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOr3nBTKJniT5JUYbYyMMCWpoHnDY9863CG84oQ8mv0Uww@mail.gmail.com>

On Thu, Dec 20, 2012 at 12:00 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> The problem was not present on ubuntu 10.04
>
> I think Ubuntu changed linker command-line options passed from GCC
> driver.  Please compare the linker command-line options

On ubuntu 12.04, the extra options
  --no-add-needed --as-needed
appear on the collect2 commandline.

Adding  -Wl,--no-add-needed -Wl,--as-needed  to the g++ commandline on
ubuntu 10.04 replicates the link failure on the previously working
system.
Adding -Wl,--no-as-needed  on ubuntu 12.04 works around the problem.

On 10.04,  'readelf -d /opt/foo/bar/lib/libxxx3.so | grep NEEDED' showed
 0x0000000000000001 (NEEDED)             Shared library: [libxxx6++.so.2]
On 12.04, it didn't.

Adding the needed dependency in the Makefile for libxxx3
caused the NEEDED flag to appear, but that didn't seem solve the
linking problem,
even though from the doc for --as-needed, I would have thought it would.
( see thread http://sourceware.org/ml/binutils/2009-01/msg00413.html )

I'd kind of like to not need to pass --no-as-needed.  I suppose the
next step is a small test case.

  reply	other threads:[~2012-12-20 23:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20 19:22 Dan Kegel
2012-12-20 19:48 ` Dan Kegel
2012-12-20 20:00   ` H.J. Lu
2012-12-20 23:19     ` Dan Kegel [this message]
2013-01-08  6:10       ` Alan Modra

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='CAPF-yOavcV2xu74ey7PTB60=8Rycodi2Y2fXs44NgmCHMKXezg@mail.gmail.com' \
    --to=dank@kegel.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@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).