This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Different linking behavior between g++ 4.5.2 and 4.6.1
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, gcc-help at gcc dot gnu dot org, Carlo Pinciroli <ilpincy at gmail dot com>, Ian Lance Taylor <iant at google dot com>, doko at ubuntu dot com
- Date: Wed, 16 Nov 2011 00:26:17 +0000
- Subject: Re: Different linking behavior between g++ 4.5.2 and 4.6.1
- References: <CAESRpQBrBSPq7o7UjMeH3gYadT7ojd9BAOY5ow5skpG1bx3AkA@mail.gmail.com>
On 16 November 2011 00:01, Manuel López-Ibáñez wrote:
>
> Perhaps we should add a new entry to the FAQ at the wiki about this.
Good idea.
> I could add it myself, but I am not sure how to summarize the problem
> and, in particular, it doesn't seem to me that "just use
> --no-as-needed" is the correct answer.
It probably isn't. There are two parts to the change, one is to use
--as-needed by default, the other is to use
--no-copy-dt-needed-entries (the option formerly known as
--no-add-needed) by default.
I suspect for most people's uses --as-needed is ok if they don't link
to libraries that aren't referenced by the rest of their program.
People might have problems with --no-copy-dt-needed-entries more
often, but that's easily solved by adding the missing libraries
explicitly to the link command (I first encountered that issue when
using the gold linker, which doesn't even support the option.)
I could try to write something for the FAQ if Andrew and/or Ian would
cast an eye over it to check I've got the facts right, I don't think I
understand the issue completely myself.