The Go testsuite's go.sum file ends in Couldn't determine version of /var/gcc/regression/master/11.4-gcc-64/build/gcc/gccgo
on Solaris. It turns out this happens because gccgo -v is confused: [...] gcc version 15.0.0 20240531 (experimental) [master a0d60660f2aae2d79685f73d568facb2397582d8] (GCC) COMPILER_PATH=./:/usr/ccs/bin/ LIBRARY_PATH=./:/lib/amd64/:/usr/lib/amd64/:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-g1' '-B' './' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a.' ./collect2 -V -M ./libgcc-unwind.map -Qy /usr/lib/amd64/crt1.o ./crtp.o /usr/lib/amd64/crti.o /usr/lib/amd64/values-Xa.o /usr/lib/amd64/values-xpg6.o ./crtbegin.o -L. -L/lib/amd64 -L/usr/lib/amd64 -t -lgcc_s -lgcc -lc -lgcc_s -lgcc ./crtend.o /usr/lib/amd64/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.3297 Undefined first referenced symbol in file main /usr/lib/amd64/crt1.o ld: fatal: symbol referencing errors collect2: error: ld returned 1 exit status trying to invoke the linker without adding any object file. This only happens when Solaris ld is in use. gccgo passes -t to the linker in that case, but does it unconditionally, even with -v. When configured to use GNU ld, gccgo -v is fine instead. This patch avoids this by restricting the -t to actually linking. Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (ld and gld). Ok for trunk? I believe this has to go via gofrontend, though. Raine -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2024-06-05 Rainer Orth <r...@cebitec.uni-bielefeld.de> gcc/go: * gospec.cc (lang_specific_driver) [TARGET_SOLARIS !USE_GLD]: Only add -t if linking.
# HG changeset patch # Parent 361d219108e4be29bd4c59bb6cb74e460a0e9126 go: Fix gccgo -v on Solaris with ld diff --git a/gcc/go/gospec.cc b/gcc/go/gospec.cc --- a/gcc/go/gospec.cc +++ b/gcc/go/gospec.cc @@ -443,8 +443,11 @@ lang_specific_driver (struct cl_decoded_ using the GNU linker, the Solaris linker needs an option to not warn about this. Everything works without this option, but you get unsightly warnings at link time. */ - generate_option (OPT_Wl_, "-t", 1, CL_DRIVER, &new_decoded_options[j]); - j++; + if (library > 0) + { + generate_option (OPT_Wl_, "-t", 1, CL_DRIVER, &new_decoded_options[j]); + j++; + } #endif *in_decoded_options_count = j;