From patchwork Wed Oct 9 08:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 1994646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XNmb61ll2z1xsc for ; Wed, 9 Oct 2024 19:41:52 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6F723858D37 for ; Wed, 9 Oct 2024 08:41:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id C5B9C385DDEB for ; Wed, 9 Oct 2024 08:41:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5B9C385DDEB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C5B9C385DDEB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728463291; cv=none; b=V3jqleG+euOkWR9aZqDQss5Rosalj9vbBkGQPG+EPvUQor5XWyQnFFBHayHtmb6UieyDDlhZzK73jrYqnhrYPUJl1ffGfCB7Ko8jCMYIsf9U6Ic6sn+peui16yN1ZJZnZvkyQUkGunsjYRz4MNfdOt0uPTx7DGdIxIgu69JKNdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728463291; c=relaxed/simple; bh=cTsJPDWVCuNLKb0ydyMfdn5y7yY/w1Vu9ObuzHjCakI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=woitefzu6ot3gifDGk/nzaT4ZIGtONXoyh9EBIF7lJATcVZ/rvh+Ij2boX+jvDsalLeVZPckBEoG2u4sISwitQ/+SWnbMTSnmhQfMugsG7LrXsETreoLet9wxxugwV44FA3A9VqDk9rt2dQ0OkYWWVDYaK7XZI4goMQ+RRTAqBg= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: gcc-patches@gcc.gnu.org Cc: Sam James Subject: [PATCH] config: add -Werror=lto-type-mismatch,odr to bootstrap-lto* Date: Wed, 9 Oct 2024 09:40:02 +0100 Message-ID: <185b07e7f79c7519b89c0bfd3df8097582cf0c2c.1728463202.git.sam@gentoo.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org 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). 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(-) base-commit: 9df0772d50d8f8a75389d319949632e5d111cc6c 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/