Bug 99401 - Rebuilding the compiler with itself fails at -O2
Summary: Rebuilding the compiler with itself fails at -O2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 97618 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-05 08:53 UTC by Brecht Sanders
Modified: 2021-04-29 17:21 UTC (History)
3 users (show)

See Also:
Host: i686-w64-mingw32
Target: i686-w64-mingw32
Build: i686-w64-mingw32
Known to work:
Known to fail:
Last reconfirmed: 2021-03-05 00:00:00


Attachments
make output (943 bytes, text/plain)
2021-03-05 08:53 UTC, Brecht Sanders
Details
gcc -v (799 bytes, text/plain)
2021-03-05 10:33 UTC, Brecht Sanders
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brecht Sanders 2021-03-05 08:53:54 UTC
Created attachment 50301 [details]
make output

When building GCC11 (last tested with 11-20210228) for Windows 32-bit with MinGW-w64 the build fails with undefined references to LC0/LC1/LC2/LC3.

My build was done using the following configure command:
../configure --prefix=/R/winlibs32_stage/inst_gcc-11-20210228/share/gcc --build=i686-w64-mingw32 --host=i686-w64-mingw32 --with-pkgversion=MinGW-W64 i686-posix-dwarf, built by Brecht Sanders --with-tune=generic --enable-checking=release --enable-threads=posix --with-dwarf2 --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-serial-configure --disable-bootstrap --enable-host-shared --enable-plugin --disable-default-ssp --disable-rpath --disable-libstdcxx-pch --enable-libstdcxx-time=yes --disable-libstdcxx-debug --disable-version-specific-runtime-libs --with-stabs --disable-symvers --enable-languages=c,c++,lto,objc,obj-c++,d --disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry --disable-multilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-graphite --enable-mingw-wildcard --with-mpc=/d/Prog/winlibs32_stage/custombuilt --with-mpfr=/d/Prog/winlibs32_stage/custombuilt --with-gmp=/d/Prog/winlibs32_stage/custombuilt --with-isl=/d/Prog/winlibs32_stage/custombuilt --enable-install-libiberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-color=auto --with-libiconv --with-system-zlib --with-build-sysroot=/R/winlibs32_stage/gcc-11-20210228/mingw-w64 --enable-large-address-aware CFLAGS=-I/d/Prog/winlibs32_stage/custombuilt/include/libdl-win32

Note that I was able to build the 32-bit compiler once, but I had to disable fortran to work around this error. This is the second iteration where I try to build GCC 11-20210228 with the same version of GCC from the first iteration.

Windows 64-bit builds work fine, so this error is limited to Windows 32-bit.

Any idea what causes this?
Comment 1 Eric Botcazou 2021-03-05 09:19:02 UTC
This looks like an issue with the base compiler, could you post the output of 'gcc -v'?  Could you also avoid forcing -O2 during stage #1, i.e. use the default -O0 or only -O1?
Comment 2 Brecht Sanders 2021-03-05 10:33:36 UTC
Created attachment 50302 [details]
gcc -v
Comment 3 Eric Botcazou 2021-03-05 11:23:17 UTC
> gcc -v

No, what's needed is the output for the *base* compiler, i.e. the compiler you start from, not the compiler you're building.
Comment 4 Eric Botcazou 2021-03-05 12:39:56 UTC
OK, I missed that you're explicitly rebuilding the compiler with itself after having bootstrapped it first...  You're on your own here, no one does that.
Comment 5 Brecht Sanders 2021-03-05 12:44:36 UTC
*** Bug 97618 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Jelinek 2021-03-05 12:51:22 UTC
Anyway, in that case you want to attach here the preprocessed source on which some undefined references to LC* appear and state exact gcc options that were used to compile that, so that others can try to reproduce it e.g. with cross-compilers.
Comment 7 Jakub Jelinek 2021-04-29 13:49:38 UTC
Maybe dup of PR99872 ?
Comment 8 Brecht Sanders 2021-04-29 17:21:53 UTC
Recently released version 11.1.0 does build for Windows 32-bit with MinGW-w64 without issues.