From patchwork Mon Sep 2 19:17:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13787671 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 642E4CD13CF for ; Mon, 2 Sep 2024 19:17:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0497E8D010B; Mon, 2 Sep 2024 15:17:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0039E8D00EF; Mon, 2 Sep 2024 15:17:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB4D08D010B; Mon, 2 Sep 2024 15:17:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BB7F48D00EF for ; Mon, 2 Sep 2024 15:17:49 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7A01C1406A3 for ; Mon, 2 Sep 2024 19:17:49 +0000 (UTC) X-FDA: 82520757858.14.E9DB125 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf22.hostedemail.com (Postfix) with ESMTP id 472E9C0015 for ; Mon, 2 Sep 2024 19:17:47 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725304591; a=rsa-sha256; cv=none; b=2GutmigNN6MNxOawvexCaMPUIzN+F7J79fCEEagkljOiAW/ReJk33Ww8WhrZCVoWI4d1ZA 0Nc5aqD9UzbNYjtZ7y/IEJ5uSMAvFDFowJESyy/H852OuFhDB0p5xu7xzK/PRF4kd813bV 4zQwmotrIGD6mIn7KOEOM+VWYREWC5A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf22.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725304591; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DytUxfbmplaMrRHhl3qFQ+Z19NOu/EOZY8HpIR/7NxA=; b=im7Zjtc4gJPZAmZLMOGhtJmlQ4LjskZ91tROOEyjXxmVBhzfss4szVMOVQVvLfFzKvkOoh jdLS8YkmS2fUbyD9NiUTMOQfQtuNlqtIr4f82kSNjq09SavCDnwwb+Zhq7KXDg6xH7KLv+ RYkKiXoYw+HvDUXKPYOwmTwImOXh2hM= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WyJRd3X2sz9sSN; Mon, 2 Sep 2024 21:17:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e6nsoT8P5hdh; Mon, 2 Sep 2024 21:17:33 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WyJRd2fdTz9sS7; Mon, 2 Sep 2024 21:17:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4B5518B773; Mon, 2 Sep 2024 21:17:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id hfPTGw2zbvQ8; Mon, 2 Sep 2024 21:17:33 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.234.167]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4D4838B770; Mon, 2 Sep 2024 21:17:32 +0200 (CEST) From: Christophe Leroy To: Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Shuah Khan , "Jason A . Donenfeld" Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Adhemerval Zanella , Xi Ruoyao Subject: [PATCH v5 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build Date: Mon, 2 Sep 2024 21:17:20 +0200 Message-ID: <915d012b5d19ceea4daae70b1d9e20019223ea19.1725304404.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725304638; l=4208; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=8uyRGNGCCgVJfGMmDTrx0v5vR/iTZQuTWlNxnOkFWq8=; b=osqIoo0JSy/xlAhsLIcV9tBSh3GYquOHfc16I8SPSsx7J/+1fY18BmUgRE+k55JDahIugxCk5 GQretRwJRNDBzEsxE+tsonofNq/p1qXhKsVndOzPur5o808j0jux/Mf X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 472E9C0015 X-Stat-Signature: d4zao8jfznpnno738yidk68eatp39ggf X-Rspam-User: X-HE-Tag: 1725304667-636843 X-HE-Meta: U2FsdGVkX18JqYoaEkl5hHdxvT/Piu0wBdIeuCgGtZkrZYRNxwcmIfTvUrq2X6K3BRGrA/9B5IQqw7f1+rxoY/JNHDzSlkDx5tDEdeETXQxqVt5V4Ub94aaOKjFFcDc5Cj+d/oom1WZrzFITdhmpgQFlhpOR5h+l3bOr1/DzVrrnKJF3FFLIF2NKXM2t0+eeMY3vJFu2fGWhE6zoEimWVihZN99u1/9bIkgMGMjyifyJhvbN4h5IRlgpNW4lCsehzqc6kCA72CWS9e2nbN2O0kSPTdD1hpKNtPWGG7u3glZpm3h0p7+7DOTTRb04LDE2y8GLcPyHrE7L1sX18sj4BY1+KZIsXGF+0W0Oq8XOwCN8hqLNzIC6vCYNcIs9V03IB4wIUKVVKM66oJfGhxSeq85F+0SkmmDIku/322owvgo+Q0A18dgA7VCi5CaU/7VvXxyGzm5frp6/Q91gf2OWuvmZl9YU4L5mdDbXnPOc9fglKfyWFGVwoWgQHKlX/YThrO/j4JTCUhStA4vme/7KcdCqCBU6VjyRCuJ6bW3/I/UFXZgCkC/eSvXdPwEcRuXZYH8dG9eCcuAkpjAci5NLATxJI8DjAIh5ZWA2Q4IWjNe5TCAJxRDNJgtB03XpyuviCv05rciziDtY4zBlhvjbYGG7cRqA8Ol8qZdyxbbx+9tm39gOrhsTuFk/TOVEK+iHV14XkHv2PDYQbweTUZSCNrOTcRNoU/0weky6Ndyga1vpe9OKr1+vVT0+ZWy2IojW6uAlvUzOaC27L3Ex2abiDqYeGkk8z6RnPmqtJsaSgooxJrHrlR8qt/U3Gg6LS3Mv8h2hTM+4NVvCXiRHPF+hcsIx5kCupFrx9g7FtkD/qX7z8AtFevAj991IGGUmGc45Lj9B6MehDCp41J2kkZPoqu2Ehhg5ysISG/2dLnKB4LGay6juwMMvnM1Ow4xuDI/8AYbhHZ15airdExBKPll +oQIlUA4 W8XMumxCmjYfezXUa0B9EFJ3s2AOH619yfcCl1a5VYLIsRDJL5KlN/Jy0O/DxnnIkD4iciRhL691WtPfr1Zd92H/s11uTsib9pxbF6f/u4Cqu9P0mNKexDnrI5cagC4xrpS/G X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In order to avoid two much duplication when we add new VDSO functionnalities in C like getrandom, refactor common CFLAGS. Signed-off-by: Christophe Leroy --- v3: Also refactor removed flags --- arch/powerpc/kernel/vdso/Makefile | 32 +++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index c07a425b8f78..67fe79d26fae 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -10,28 +10,11 @@ obj-vdso64 = sigtramp64-64.o gettimeofday-64.o datapage-64.o cacheflush-64.o not ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday-32.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-32.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-32.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-32.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday-32.o = $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_vgettimeofday-32.o += -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc - # This flag is supported by clang for 64-bit but not 32-bit so it will cause - # an unused command line flag warning for this file. - ifdef CONFIG_CC_IS_CLANG - CFLAGS_REMOVE_vgettimeofday-32.o += -fno-stack-clash-protection - endif - CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-64.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-64.o += $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-64.o += -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-64.o += -ffreestanding -fasynchronous-unwind-tables - CFLAGS_REMOVE_vgettimeofday-64.o = $(CC_FLAGS_FTRACE) # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That used to be true # by accident when the VDSO was hand-written asm code, but may not be now that the VDSO is # compiler generated. To avoid breaking Go tell GCC not to use r30. Impact on code # generation is minimal, it will just use r29 instead. - CFLAGS_vgettimeofday-64.o += $(call cc-option, -ffixed-r30) + CFLAGS_vgettimeofday-64.o += -include $(c-gettimeofday-y) $(call cc-option, -ffixed-r30) endif # Build rules @@ -49,6 +32,11 @@ targets += $(obj-vdso64) vdso64.so.dbg vgettimeofday-64.o obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) ccflags-y := -fno-common -fno-builtin +ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) +ccflags-y += $(call cc-option, -fno-stack-protector) +ccflags-y += -DDISABLE_BRANCH_PROFILING +ccflags-y += -ffreestanding -fasynchronous-unwind-tables +ccflags-remove-y := $(CC_FLAGS_FTRACE) ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS) ldflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld) ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) @@ -57,6 +45,12 @@ ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WAR ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS)) CC32FLAGS := -m32 +CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc + # This flag is supported by clang for 64-bit but not 32-bit so it will cause + # an unused command line flag warning for this file. +ifdef CONFIG_CC_IS_CLANG +CC32FLAGSREMOVE += -fno-stack-clash-protection +endif LD32FLAGS := -Wl,-soname=linux-vdso32.so.1 AS32FLAGS := -D__VDSO32__ @@ -105,7 +99,7 @@ quiet_cmd_vdso32ld_and_check = VDSO32L $@ quiet_cmd_vdso32as = VDSO32A $@ cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -o $@ $< quiet_cmd_vdso32cc = VDSO32C $@ - cmd_vdso32cc = $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< + cmd_vdso32cc = $(VDSOCC) $(filter-out $(CC32FLAGSREMOVE), $(c_flags)) $(CC32FLAGS) -c -o $@ $< quiet_cmd_vdso64ld_and_check = VDSO64L $@ cmd_vdso64ld_and_check = $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)