On Mon, Oct 28, 2024 at 12:22 PM Sam James <s...@gentoo.org> wrote: > > Sam James <s...@gentoo.org> writes: > > > Sam James <s...@gentoo.org> writes: > > > >> Add -Werror=lto-type-mismatch,odr to bootstrap-lto* configurations to > >> help stop LTO breakage/correctness issues sneaking in. > >> > >> We discussed -Werror=strict-aliasing but it runs early and doesn't > >> give better diagnostics with LTO so left it out. > >> > >> config/ChangeLog: > >> PR rust/108087 > >> PR ada/115917 > >> PR modula2/114529 > >> PR modula2/116181 > >> PR other/116182 > >> > >> * bootstrap-lto-lean.mk: Pass -Werror=lto-type-mismatch,odr. > >> * bootstrap-lto-noplugin.mk: Ditto. > >> * bootstrap-lto.mk: Ditto. > >> --- > >> OK once PR117038 is fixed? (It snuck in yesterday). > > > > ... which is now fixed. > > > > Ping.
I think we want to arrange for this to not be active when release checking is enabled - specific target configurations we do not test may otherwise result in failed builds for releases. Tieing to --enable-werror somehow would be OK I guess. Richard. > >> > >> Bootstrapped all languages on x86_64-pc-linux-gnu. > >> > >> config/bootstrap-lto-lean.mk | 8 +++++--- > >> config/bootstrap-lto-noplugin.mk | 10 +++++----- > >> config/bootstrap-lto.mk | 10 +++++----- > >> 3 files changed, 15 insertions(+), 13 deletions(-) > >> > >> diff --git a/config/bootstrap-lto-lean.mk b/config/bootstrap-lto-lean.mk > >> index 42cb3394c70b..f176390ba21a 100644 > >> --- a/config/bootstrap-lto-lean.mk > >> +++ b/config/bootstrap-lto-lean.mk > >> @@ -1,10 +1,12 @@ > >> # This option enables LTO for stage4 and LTO for generators in stage3 > >> with profiledbootstrap. > >> # Otherwise, LTO is used in only stage3. > >> > >> -STAGE3_CFLAGS += -flto=jobserver > >> + > >> +STAGE2_CFLAGS += -flto=jobserver -Werror=lto-type-mismatch -Werror=odr > >> +STAGE3_CFLAGS += -flto=jobserver -Werror=lto-type-mismatch -Werror=odr > >> override STAGEtrain_CFLAGS := $(filter-out > >> -flto=jobserver,$(STAGEtrain_CFLAGS)) > >> -STAGEtrain_GENERATOR_CFLAGS += -flto=jobserver > >> -STAGEfeedback_CFLAGS += -flto=jobserver > >> +STAGEtrain_GENERATOR_CFLAGS += -flto=jobserver -Werror=lto-type-mismatch > >> -Werror=odr > >> +STAGEfeedback_CFLAGS += -flto=jobserver -Werror=lto-type-mismatch > >> -Werror=odr > >> > >> # assumes the host supports the linker plugin > >> LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) > >> -B$$r/$(HOST_SUBDIR)/prev-gcc/ > >> diff --git a/config/bootstrap-lto-noplugin.mk > >> b/config/bootstrap-lto-noplugin.mk > >> index 0f50708e49d1..660ca60dbd3d 100644 > >> --- a/config/bootstrap-lto-noplugin.mk > >> +++ b/config/bootstrap-lto-noplugin.mk > >> @@ -1,9 +1,9 @@ > >> # This option enables LTO for stage2 and stage3 on > >> # hosts without linker plugin support. > >> > >> -STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects > >> -STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects > >> -STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 > >> +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> do-compare = /bin/true > >> diff --git a/config/bootstrap-lto.mk b/config/bootstrap-lto.mk > >> index 1ddb1d870bab..9f76c03f8a68 100644 > >> --- a/config/bootstrap-lto.mk > >> +++ b/config/bootstrap-lto.mk > >> @@ -1,10 +1,10 @@ > >> # This option enables LTO for stage2 and stage3 in slim mode > >> > >> -STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 > >> +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> +STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 > >> -Werror=lto-type-mismatch -Werror=odr > >> > >> # assumes the host supports the linker plugin > >> LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) > >> -B$$r/$(HOST_SUBDIR)/prev-gcc/ > >> > >> base-commit: 9df0772d50d8f8a75389d319949632e5d111cc6c