On 9/28/26 1:05 AM, Tamar Christina wrote:
LTO bootstrap currently fails due to MPFR and GMP failing stage2 vs stage3
comparison:

   mpfr/src/urandom.o differs
   mpfr/src/urandomb.o differs
   mpfr/src/vasprintf.o differs
   mpfr/src/yn.o differs
   mpfr/src/zeta.o differs
   mpfr/src/zeta_ui.o differs

of pretty much every object file for mpfr and mpc.

This is because in Makefile.tpl +579 we have

STAGE1_TFLAGS += -fno-checking
STAGE2_CFLAGS += -fno-checking
STAGE2_TFLAGS += -fno-checking
STAGE3_CFLAGS += -fchecking=1
STAGE3_TFLAGS += -fchecking=1

But with a LTO bootstrap the options leak into the LTO metadata due to the
headers ending up with the checking flags inside them.

   stage2-gmp/gmp.h:2334  #define __GMP_CC " ... -fno-checking"
   stage3-gmp/gmp.h:2334  #define __GMP_CC " ... -fchecking=1"

during an LTO bootstrap we call compare-lto which strips the options from
.gnu.lto_.opts but they're also present in .gnu.lto_.decls.*.

So we get a miscompare due to -fchecking differences.

Since MPFR and GMP are C programs just prevent -fno-checking and -fchecking=1
from getting passed to them.

This patch adds a little autogen macro and Scheme function to strip out these
flags only for mpfr and gmp.

Bootstrapped Regtested on aarch64-none-linux-gnu,
arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
-m32, -m64

with:

  - default bootstrap
  - profiledbootstrap
  - LTO bootstrap
  - LTO+O3
  - bootstrap lto locality
  - boostrap LTO lean

Ok for master?

Thanks,
Tamar

ChangeLog:

        PR bootstrap/127376
        * Makefile.in: Renegerate.
        * Makefile.tpl: Strip checking flags for mpfr and gmp.
Seems sensible.  So if it's working, it's OK for the trunk.

jeff

Reply via email to