Re: gcc 16 bootstrap, stage 2 and 3 differ

Thomas Klausner <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Sat, Aug 15, 2026 at 10:22:40AM +0100, RVP wrote:
> On Thu, 13 Aug 2026, Thomas Klausner wrote:
> 
> > I have a problem when packaging gcc 16.1.0 for pkgsrc.  Using the same
> > flags and patches that work for gcc 15.3.0, I see a problem late in
> > the build when the stage2 and stage3 files are compared:
> > 
> > Comparing stages 2 and 3
> > warning: gcc/cobol/parse.o differs
> > Bootstrap comparison failure!
> > gcc/build/genoutput.o differs
> > gcc/build/gensupport.o differs
> > gcc/build/genrecog.o differs
> > gcc/build/genmatch.o differs
> > ... and many more ...
> > 
> 
> No real insight here except to ask, are the same command lines being passed
> to both the stage2 and stage3 compilers?

Not sure.

> > For now, the package (lang/gcc16) is using the --disable-bootstrap
> > workaround.
> > 
> 
> You could compare only the code bits (ie. omit the debug section comparisons
> which're added by as(1)from binutils  anyway). The build instructions suggest
> ‘bootstrap-debug’:
> 
> https://gcc.gnu.org/install/build.html

I tried this.

Index: Makefile.common
===================================================================
RCS file: /cvsroot/pkgsrc/lang/gcc16/Makefile.common,v
retrieving revision 1.1
diff -u -r1.1 Makefile.common
--- Makefile.common     10 Aug 2026 21:41:34 -0000      1.1
+++ Makefile.common     16 Aug 2026 18:34:19 -0000
@@ -89,14 +89,18 @@
 MAKE_ENV.NetBSD+=      ac_cv_func_uselocale=no
 MAKE_ENV.SunOS+=       ac_cv_func_mkostemp=no

-.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly" \
-    || ${OPSYS} == "NetBSD"
-# GCC 16.1.0's stage2/stage3 bootstrap comparison currently fails on
-# NetBSD/x86_64, so disable it. Revisit on updates.
-# https://gcc.gnu.org/pipermail/gcc-help/2026-August/145120.html
+.if !empty(PKGSRC_COMPILER:Mclang) || ${OPSYS} == "DragonFly"
 CONFIGURE_ARGS+=       --disable-bootstrap
 .endif

+.if ${OPSYS} == "NetBSD"
+# GCC 16.1.0's stage2/stage3 bootstrap comparison currently fails
+# on NetBSD/x86_64 because of mismatches in debug information, so
+# disable it. Revisit on updates.
+# https://gcc.gnu.org/pipermail/gcc-help/2026-August/145120.html
+CONFIGURE_ARGS+=       --with-build-config=bootstrap-debug
+.endif
+
 .if ${MACHINE_PLATFORM:MNetBSD-*-i386} || ${MACHINE_PLATFORM:MLinux-*-i386}
 CONFIGURE_ARGS+=       --with-arch=i486 --with-tune=i486
 .endif

it failed again, and now I have much bigger diffs with objdump --dwarf=loc:

2c2,42447
< work/build/stage2-gcc/cp/class.o:     file format elf64-x86-64
---
> work/build/stage3-gcc/cp/class.o:     file format elf64-x86-64
>
> Contents of the .debug_loclists section:
>
> Table at Offset 0
>   Length:          0x1fcf7
>   DWARF version:   5
>   Address size:    8
>   Segment size:    0
>   Offset entries:  0
>
...

i.e. stage3 has a .debug_loclists section, but stage2 doesn't.

This looks more and more like an upstream bug, doesn't it?
Especially since gcc 15 doesn't have this problem.
 Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.