From nobody Mon Feb 9 07:22:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 858AAC77B73 for ; Sun, 21 May 2023 09:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbjEUJhb (ORCPT ); Sun, 21 May 2023 05:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230177AbjEUJhH (ORCPT ); Sun, 21 May 2023 05:37:07 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5F7E6; Sun, 21 May 2023 02:36:49 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1684661804; bh=OtZaR9VeuPmOojjtUgQSBdMGO5O2wKJgryXGtmTqRzI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qhrhQOOMS89DvZWNK5Af0kDzvUeY+vJnHje0Yv/lqShv8qVQxvPu7lLqOxLdaHDbb yg7wwTACqQ699CQiFqiHYVuIpHZfQMKuNwT2AyogjeH4mqTU1vmIvrxFgkdbLkNxF/ nsk2legjwR2ozCkPxi3xQjS0XL+LYgRhmOHn0l14= Date: Sun, 21 May 2023 11:36:35 +0200 Subject: [PATCH 7/7] tools/nolibc: simplify stackprotector compiler flags MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230521-nolibc-automatic-stack-protector-v1-7-dad6c80c51c1@weissschuh.net> References: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> In-Reply-To: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> To: Willy Tarreau , "Paul E. McKenney" , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1684661802; l=1698; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=OtZaR9VeuPmOojjtUgQSBdMGO5O2wKJgryXGtmTqRzI=; b=DomoIsmXsRZwQWk0ScmwjLFDuu1dnN26YCXUzo34GqOdYuAtwSgkUrabKkFdr4rSI27UuPoCc 06iKjlgljDsC3ma9RvH/A7hClYqSQSwPisv/goaAeqLfKemkx+wOWfn X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that nolibc enable stackprotector support automatically when the compiler enables it we only have to get the -fstack-protector flags correct. The cc-options are structured so that -fstack-protector-all is only enabled if -mstack-protector=3Dguard works, as that is the only mode supported by nolibc. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/Makefile | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index bd41102ea299..445c352b1b33 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -76,20 +76,11 @@ else Q=3D@ endif =20 -CFLAGS_STACKPROTECTOR =3D -DNOLIBC_STACKPROTECTOR \ - $(call cc-option,-mstack-protector-guard=3Dglobal) \ - $(call cc-option,-fstack-protector-all) -CFLAGS_STKP_i386 =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_x86_64 =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_x86 =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_arm64 =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_arm =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_mips =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_riscv =3D $(CFLAGS_STACKPROTECTOR) -CFLAGS_STKP_loongarch =3D $(CFLAGS_STACKPROTECTOR) +CFLAGS_STACKPROTECTOR =3D $(call cc-option,-mstack-protector-guard=3Dgloba= l -fstack-protector-all) CFLAGS_s390 =3D -m64 CFLAGS ?=3D -Os -fno-ident -fno-asynchronous-unwind-tables -std=3Dc89 \ $(call cc-option,-fno-stack-protector) \ + $(call cc-option,-mstack-protector-guard=3Dglobal $(call cc-option,-fsta= ck-protector-all)) \ $(CFLAGS_STKP_$(ARCH)) $(CFLAGS_$(ARCH)) LDFLAGS :=3D -s =20 --=20 2.40.1