GCC: Fix linking mixed C and C++ binaries with GCC 16+

As of GCC 16, `gcc` implies `gcc_s_asneeded` but `g++` implies `gcc_s`.
When linking mixed C and C++ binaries, avoid listing one if the other is
already implied by the linker language.

Fixes: #27796
1 file changed