public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking against libgcc.a on GNU/Linux
@ 2019-03-13  9:36 Florian Weimer
  2019-03-13 17:46 ` Joseph Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2019-03-13  9:36 UTC (permalink / raw)
  To: gcc

Would it be possible to turn libgcc_s.so into a linker script that links
against libgcc.a and libgcc_s.so.1, and teach g++ not to link against
libgcc.a explicitly anymore?

I'm suggesting this because libtool uses -nostdlib when linking shared
objects in C++ mode, and does not link against -lgcc, only -lgcc_s.
This causes subtle problems if GCC generates code that actually needs
libgcc.a, particularly if the main program uses the same symbols and
gets the hidden definitions from libgcc.a.

As far as I can tell, previous attempts to dissuade libtool from using
-nostdlib have failed.  It is also difficult to change libtool as it is
deployed in package sources.  It seems to me that the GCC workaround
could be rolled out quite seamlessly.

Thanks,
Florian

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

* Re: Linking against libgcc.a on GNU/Linux
  2019-03-13  9:36 Linking against libgcc.a on GNU/Linux Florian Weimer
@ 2019-03-13 17:46 ` Joseph Myers
  2019-03-14  9:51   ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Myers @ 2019-03-13 17:46 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc

On Wed, 13 Mar 2019, Florian Weimer wrote:

> Would it be possible to turn libgcc_s.so into a linker script that links
> against libgcc.a and libgcc_s.so.1, and teach g++ not to link against
> libgcc.a explicitly anymore?

It is already a linker script on platforms using t-slibgcc-libgcc in 
libgcc/config.host.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: Linking against libgcc.a on GNU/Linux
  2019-03-13 17:46 ` Joseph Myers
@ 2019-03-14  9:51   ` Florian Weimer
  2019-03-14 11:56     ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2019-03-14  9:51 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc

* Joseph Myers:

> On Wed, 13 Mar 2019, Florian Weimer wrote:
>
>> Would it be possible to turn libgcc_s.so into a linker script that links
>> against libgcc.a and libgcc_s.so.1, and teach g++ not to link against
>> libgcc.a explicitly anymore?
>
> It is already a linker script on platforms using t-slibgcc-libgcc in 
> libgcc/config.host.

Hmm.  I assume this means that x86-64 and i386 should use this approach,
but they currently do not (GCC 8/9 in Fedora):

  <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88805#c5>

Thanks,
Florian

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

* Re: Linking against libgcc.a on GNU/Linux
  2019-03-14  9:51   ` Florian Weimer
@ 2019-03-14 11:56     ` Florian Weimer
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2019-03-14 11:56 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc

* Florian Weimer:

> * Joseph Myers:
>
>> On Wed, 13 Mar 2019, Florian Weimer wrote:
>>
>>> Would it be possible to turn libgcc_s.so into a linker script that links
>>> against libgcc.a and libgcc_s.so.1, and teach g++ not to link against
>>> libgcc.a explicitly anymore?
>>
>> It is already a linker script on platforms using t-slibgcc-libgcc in 
>> libgcc/config.host.
>
> Hmm.  I assume this means that x86-64 and i386 should use this approach,
> but they currently do not (GCC 8/9 in Fedora):
>
>   <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88805#c5>

Never mind, Jakub identified this as a downstream bug.

Thanks,
Florian

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

end of thread, other threads:[~2019-03-14 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-13  9:36 Linking against libgcc.a on GNU/Linux Florian Weimer
2019-03-13 17:46 ` Joseph Myers
2019-03-14  9:51   ` Florian Weimer
2019-03-14 11:56     ` Florian Weimer

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