https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84017
Bug ID: 84017 Summary: [6/7/8 regression] Bootstrap failure on Solaris 10/x86 with gas/ld Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: ro at gcc dot gnu.org CC: segher at gcc dot gnu.org Target Milestone: --- Host: i386-pc-solaris2.10 Target: i386-pc-solaris2.10 Build: i386-pc-solaris2.10 Starting back in the GCC 6 days, Solaris 10/x86 bootstrap started to FAIL in a very weird way compiling libgo: /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' func CompareAndSwapInt32(addr *int32, old, new int32) (swapped bool) ^ /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' /vol/gcc/src/hg/trunk/local/libgo/go/sync/atomic/doc.go:74:64: error: use of undefined type 'bool' go1: internal compiler error: in register_builtin_type, at go/gofrontend/export.cc:483 0x8242a31 Export::register_builtin_type(Gogo*, char const*, Builtin_code) /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/export.cc:483 0x8242b7f Export::register_builtin_types(Gogo*) /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/export.cc:470 0x827c0f6 Gogo::do_exports() /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/gogo.cc:4485 0x8279a41 go_parse_input_files(char const**, unsigned int, bool, bool) /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/go.cc:118 0x8274f92 go_langhook_parse_file /vol/gcc/src/hg/trunk/local/gcc/go/go-lang.c:312 The error is obviously completely bogus. A reghunt identified this patch as the culprit: The first bad revision is: changeset: 22378:b810ecbf30be user: segher@138bc75d-0d04-0410-961f-82ee72b054a4 date: Thu May 07 15:51:01 2015 +0000 summary: PR middle-end/192 PR middle-end/192 PR middle-end/54303 * varasm.c (function_mergeable_rodata_prefix): New function. (mergeable_string_section): Use it. (mergeable_constant_section): Use it. gcc/testsuite/ * gcc.dg/fdata-sections-2.c: New file. The error vanishes if go1 is rebuilt with -g3 -O0. It also only happens when using the gas/ld combo, no problem with as/ld (or gas/gld). At the same time, many warnings appear during the build like this one: ld: warning: relocation warning: R_386_GOTOFF: file /var/gcc/regression/trunk/10-gcc-gas/build/prev-i386-pc-solaris2.10/libstdc++-v3/src/.libs/libstdc++.a(wlocale-inst.o): section [213].rel.gnu.linkonce.t._ZNSt17moneypunct_bynameIwLb0EEC2EPKcj: symbol .LC72: relocation against discarded COMDAT section [136].gnu.linkonce.r._ZSt16__convert_from_vRKPiPciPKcz.str1.1: symbol not found, relocation ignored Indeed full support for .gnu.linkonce sections (a non-standard gld extension) only appeared in Solaris 11. I've successfully been using this patch diff --git a/gcc/varasm.c b/gcc/varasm.c --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -789,7 +789,7 @@ static const char * function_mergeable_rodata_prefix (void) { section *s = targetm.asm_out.function_rodata_section (current_function_decl); - if (SECTION_STYLE (s) == SECTION_NAMED) + if (SECTION_STYLE (s) == SECTION_NAMED && HAVE_COMDAT_GROUP) return s->named.name; else return targetm.asm_out.mergeable_rodata_prefix; to avoid the issue, which effectively restores to the situation before the patch: HAVE_COMDAT_GROUP is 0 on Solaris 10, and 1 on Solaris 11+. However, it cannot be right since it is only needed with gas/ld, not with as/ld. I long meant to investigate further, but neglected to do so,keeping the patch above local. When I recently reverted it to check, however, I ran into another (and much earlier) failure: /vol/gcc/src/hg/trunk/local/gcc/pretty-print.c:2128: test_pp_format: FAIL: ASSERT_STREQ (expected, pp_formatted_text (&pp)) expected="-27 12345678" actual=" 12345678" cc1: internal compiler error: in fail_formatted, at selftest.c:62 0x900c345 selftest::fail_formatted(selftest::location const&, char const*, ...) /vol/gcc/src/hg/trunk/local/gcc/selftest.c:62 0x900c3ab selftest::assert_streq(selftest::location const&, char const*, char const*, char const*, char const*) /vol/gcc/src/hg/trunk/local/gcc/selftest.c:85 0x901ccc6 assert_pp_format_va /vol/gcc/src/hg/trunk/local/gcc/pretty-print.c:2039 0x901cd7f assert_pp_format /vol/gcc/src/hg/trunk/local/gcc/pretty-print.c:2052 0x901cfec test_pp_format /vol/gcc/src/hg/trunk/local/gcc/pretty-print.c:2128 0x901d8d8 selftest::pretty_print_c_tests() /vol/gcc/src/hg/trunk/local/gcc/pretty-print.c:2202 0x8fb9df6 selftest::run_tests() /vol/gcc/src/hg/trunk/local/gcc/selftest-run-tests.c:66 0x8776ef7 toplev::run_self_tests() /vol/gcc/src/hg/trunk/local/gcc/toplev.c:2145 I don't yet understand what's going on here, but finally wanted to get this into the system. Rainer