This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use --push-state --as-needed and --pop-state instead of --as-needed and --no-as-needed for libgcc
- From: Matthias Klose <doko at ubuntu dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 11 Apr 2018 18:07:17 +0200
- Subject: Re: [PATCH] Use --push-state --as-needed and --pop-state instead of --as-needed and --no-as-needed for libgcc
- References: <20180411103108.GP8577@tucnak>
On 11.04.2018 12:31, Jakub Jelinek wrote:
> Hi!
>
> As discussed, using --as-needed and --no-as-needed is dangerous, because
> it results in --no-as-needed even for libraries after -lgcc_s, even when the
> default is --as-needed or --as-needed has been specified earlier on the
> command line.
>
> If the linker supports --push-state/--pop-state, we should IMHO use it.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for stage1?
>
> Or is this something we want in GCC8 too?
this is problematic for binutils versions with --push-state/--pop-state support
in the BFD linker but not in gold, and then using -fuse-ld=gold. So maybe the
version check for the BFD linker should only succeed for the first binutils
version which also has -push-state/--pop-state support in gold.
The BFD linker is only able to save exactly one state, and nested --push-state
calls override the state (binutils PR23043). Otoh, there is not much linked
after libgcc, so maybe this is not an issue.
Matthias