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