From patchwork Sun May 21 09:36:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13249340 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2807C7EE29 for ; Sun, 21 May 2023 09:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ftDI6uDkHR7mX1O0kuDJIx8OrXrburveViQ6Qicb6os=; b=BFY83OUTveKtP3 Q2d3HLTVMJnHS87t1gkz01PnVfiXjr+RkXTrKw+urHB1cJU8ZTLwfphXqHJkXOlzrC3Vu7fGIrksn +7+1ZpgLfIJELBldS74ltucm0NMED1KW/4pJ/44f5po8OXRc+IdxDWGT6mz40H+lfZWatJLntw0K/ m/a6tcgIP4WzW1gMw4XV9+PgvM2wagENdhyu/+1gakObfyQVx0TIqgy0wD/t+YKdIFEJt/afYm6T3 +l8O+iV96jBsV9AJXpsOAFNaEib3EcWRuI9dqRjK8qm/P2xI+l29Zpk/poBUHITEQmD/xjkCg5ym4 1shR1gW9vDMDJ57mohDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q0fUv-003VeE-3A; Sun, 21 May 2023 09:37:05 +0000 Received: from todd.t-8ch.de ([159.69.126.157]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q0fUn-003VZw-0k for linux-riscv@lists.infradead.org; Sun, 21 May 2023 09:37:01 +0000 From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1684661803; bh=IRUupTWokl6bSvN/Qk4Ov6+kUGTwoo0KFMWwChixIDM=; h=From:Subject:Date:To:Cc:From; b=cqxlSIQDXcaATq4ZkEomg3mY2IIrtqss61smptg9yb0lL1E7hdITHmKOiQkYwWMPr dSUmlXT3YXWXIAj6wIKV373n/HOdFYkU8neAUuRNG4U2Y55s6Mf3AQV4YgSKua8BCn gEy2ZeaIjLoDyfdEpiNxt0KJb6Awa7KExEknuKus= Subject: [PATCH 0/7] tools/nolibc: autodetect stackprotector availability from compiler Date: Sun, 21 May 2023 11:36:28 +0200 Message-Id: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIABzmaWQC/x2NQQrCMBAAv1L27EIbraJfkR4268YuxqRsUhFK/ 27wOHOY2aCIqRS4dRuYfLRoTg2GQwc8U3oK6qMxuN4d+9ENmHJUz0hrzW+qylgq8QsXy1W4ZkN /CpdA/ipnN0LLeCqC3ijx3EJpjbHJxSTo9/+9T/v+A6RUit+HAAAA 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_We?= =?utf-8?q?i=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1684661802; l=1743; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IRUupTWokl6bSvN/Qk4Ov6+kUGTwoo0KFMWwChixIDM=; b=+KCHXIX7ZFxeWvKYgiPiXSHck8c9OJAqiZ1m8d98eL9+rckJEWvb6uDCavW+0/kuvJ7Fdte+g m1VE13Y0y6WDZ5dPNcWR/VP/9J98CEzoH+Wt4RH1E7OYcJxR3RLRXIu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230521_023657_774014_1C451AF2 X-CRM114-Status: UNSURE ( 5.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org As suggested by Willy it is possible to detect the availability of stackprotector via preprocessor defines. Make use of that to simplify the code and interface of nolibc. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (7): tools/nolibc: fix typo pint -> point tools/nolibc: x86_64: disable stack protector for _start tools/nolibc: ensure stack protector guard is never zero tools/nolibc: add test for __stack_chk_guard initialization tools/nolibc: reformat list of headers to be installed tools/nolibc: add autodetection for stackprotector support tools/nolibc: simplify stackprotector compiler flags tools/include/nolibc/Makefile | 19 +++++++++++++++++-- tools/include/nolibc/arch-aarch64.h | 6 +++--- tools/include/nolibc/arch-arm.h | 6 +++--- tools/include/nolibc/arch-i386.h | 6 +++--- tools/include/nolibc/arch-loongarch.h | 6 +++--- tools/include/nolibc/arch-mips.h | 6 +++--- tools/include/nolibc/arch-riscv.h | 6 +++--- tools/include/nolibc/arch-x86_64.h | 8 ++++---- tools/include/nolibc/arch.h | 2 +- tools/include/nolibc/compiler.h | 15 +++++++++++++++ tools/include/nolibc/stackprotector.h | 15 ++++++--------- tools/testing/selftests/nolibc/Makefile | 13 ++----------- tools/testing/selftests/nolibc/nolibc-test.c | 10 +++++++++- 13 files changed, 72 insertions(+), 46 deletions(-) --- base-commit: 606343b7478c319cb30291a39ecbceddb42229d6 change-id: 20230521-nolibc-automatic-stack-protector-b4f7fab9e625 Best regards,