The compiling of ppe42-gcc with gcc 12 now proceeds until another error in a different part. Although this is not the same as the original thread (trying to patch older gcc), this will work until it doesn't.
And it doesn't. After compiling gcc, the build attempts to use it to build libgcc. The following is the error message from configure:
Checking multilib configuration for libgcc...
Configuring stage 1 in powerpc64le-unknown-linux-gnu/libgcc
configure: creating cache ./config.cache
checking build system type... powerpc64le-unknown-linux-gnu
checking host system type... powerpc64le-unknown-linux-gnu
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking for powerpc64le-unknown-linux-gnu-ar... ar
checking for powerpc64le-unknown-linux-gnu-lipo... lipo
checking for powerpc64le-unknown-linux-gnu-nm... /root/raptor/ppe42-gcc/host-powerpc64le-unknown-linux-gnu/gcc/nm
checking for powerpc64le-unknown-linux-gnu-ranlib... ranlib
checking for powerpc64le-unknown-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for powerpc64le-unknown-linux-gnu-gcc... /root/raptor/ppe42-gcc/host-powerpc64le-unknown-linux-gnu/gcc/xgcc -B/root/raptor/ppe42-gcc/host-powerpc64le-unknown-linux-gnu/gcc/ -B/usr/local/powerpc64le-unknown-linux-gnu/bin/ -B/usr/local/powerpc64le-unknown-linux-gnu/lib/ -isystem /usr/local/powerpc64le-unknown-linux-gnu/include -isystem /usr/local/powerpc64le-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/root/raptor/ppe42-gcc/powerpc64le-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
I dug into the config.log and created a file with the test code, then ran it manually with -v
/* confdefs.h */
#define PACKAGE_NAME "GNU C Runtime Library"
#define PACKAGE_TARNAME "libgcc"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "GNU C Runtime Library 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL "
http://www.gnu.org/software/libgcc/"
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
...
GNU C (GCC) version 4.9.2 (powerpc64le-unknown-linux-gnu)
compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version 4.2.0, MPC version 1.3.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 29fbe43bf124570f80365dc213e4e677
conftest.c:1:0: internal compiler error: in i, at ira.c:503
/* confdefs.h */
^
unrecognized DWARF version in .debug_info at 6
conftest.c:1:0: internal compiler error: Segmentation fault
unrecognized DWARF version in .debug_info at 6
xgcc: internal compiler error: Segmentation fault (program cc1)
unrecognized DWARF version in .debug_info at 6
Segmentation fault
The code in question
for (n = 0, i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (temp_hard_regset, i))
ira_non_ordered_class_hard_regs[cl][n++] = i;
ira_assert (ira_class_hard_regs_num[cl] == n);
The assertion fails. I dug into FIRST_PSEUDO_REGISTER and found in this particular build it comes from gcc/config/rs6000/rs6000.h
933: #define FIRST_PSEUDO_REGISTER 149
Adding some debugging code to gcc/ira.c
for (n = 0, i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (temp_hard_regset, i)) {
fprintf(stdout, "i = %d, cl = %d, n = %d\n", i, cl, n);
ira_non_ordered_class_hard_regs[cl][n++] = i;
}
fprintf(stdout, "after cl = %d, ira_class_hard_regs_num[cl] = %d, n = %d\n", cl, ira_class_hard_regs_num[cl], n);
ira_assert (ira_class_hard_regs_num[cl] == n);
}
results in
FIRST_PSEUDO_REGISTER = 149, LIM_REG_CLASSES = 23
before cl = 22, ira_class_hard_regs_num[cl] = 48, n = 48
i = 0, cl = 22, n = 0
i = 3, cl = 22, n = 1
...
i = 72, cl = 22, n = 51
i = 74, cl = 22, n = 52
i = 75, cl = 22, n = 53
after cl = 22, ira_class_hard_regs_num[cl] = 48, n = 54
host-powerpc64le-unknown-linux-gnu/gcc/conftest.c:1:0: internal compiler error: in setup_class_hard_regs, at ira.c:509
/* confdefs.h */
What appears to have happened is that an earlier setting of ira_class_hard_regs_num has been altered and a check has failed. Not all registers have TEST_HARD_REG_BIT set so some are skipped, and it appears that some do have the bit skipped but this is unexpected.
From reading the documentation in ira.c, I strongly suspect I need to set some additional flags during the build process, but I can not find instructions on this. Anyone have suggestions?
tim