public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Different linking behavior between g++ 4.5.2 and 4.6.1
@ 2011-11-16  1:00 Manuel López-Ibáñez
  2011-11-16  1:26 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel López-Ibáñez @ 2011-11-16  1:00 UTC (permalink / raw)
  To: Andrew Pinski
  Cc: gcc-help, Carlo Pinciroli, Jonathan Wakely, Ian Lance Taylor, doko

Hi Andrew and Jonathan (cc: Ian and Matthias since they discussed this
issue recently),

Perhaps we should add a new entry to the FAQ at the wiki about this.
We have seen a few questions already in gcc-help, and it seems it is
going to be a frequent issue with the most recent major distros:

http://gcc.gnu.org/ml/gcc-help/2011-11/msg00132.html
https://lists.ubuntu.com/archives/ubuntu-devel/2010-November/031991.html
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition
http://wiki.debian.org/ToolChain/DSOLinking#Onlylinkwithneededlibraries
http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking

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.

http://gcc.gnu.org/wiki/FAQ

Cheers,

Manuel.

On -10/01/37 20:59, Carlo Pinciroli wrote:
> Thank you very much Andrew, your suggestion indeed solved the problem.
> And thanks also for your fast answer! :-)
>
> Cheers,
> Carlo
>
> On Tue, Nov 15, 2011 at 6:49 PM, Andrew Pinski<pinskia@gmail.com>  wrote:
>> On Tue, Nov 15, 2011 at 9:34 AM, Carlo Pinciroli<ilpincy@gmail.com>  wrote:
>>>
>>> Dear forum,
>>>
>>> I have a problem with linking of a program I have wrote. Instead of giving
>>> you the entire program, which is pretty large, I have prepared a basic
>>> example that you can find attached to this message. The example uses CMake
>>> to compile.
>>>
>>> I have three files:
>>
>> Sounds like --as-needed is the default with the linker you are using.
>> That is GCC is not the issue but rather the defaults with the distros
>> you are using are different.
>>
>> Thanks,
>> Andrew Pinski
>>
>
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Different linking behavior between g++ 4.5.2 and 4.6.1
  2011-11-16  1:00 Different linking behavior between g++ 4.5.2 and 4.6.1 Manuel López-Ibáñez
@ 2011-11-16  1:26 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2011-11-16  1:26 UTC (permalink / raw)
  To: Manuel López-Ibáñez
  Cc: Andrew Pinski, gcc-help, Carlo Pinciroli, Ian Lance Taylor, doko

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-16  0:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16  1:00 Different linking behavior between g++ 4.5.2 and 4.6.1 Manuel López-Ibáñez
2011-11-16  1:26 ` Jonathan Wakely

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).