From patchwork Mon Sep 2 12:04:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13787163 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 59D68CD342A for ; Mon, 2 Sep 2024 12:05:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2DD18D00C7; Mon, 2 Sep 2024 08:05:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB1F38D0065; Mon, 2 Sep 2024 08:05:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2A598D00C7; Mon, 2 Sep 2024 08:05:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8F5BC8D0065 for ; Mon, 2 Sep 2024 08:05:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4BD8E4057D for ; Mon, 2 Sep 2024 12:05:06 +0000 (UTC) X-FDA: 82519667412.18.6FCDB57 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf21.hostedemail.com (Postfix) with ESMTP id D3BE51C001E for ; Mon, 2 Sep 2024 12:05:03 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf21.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=1725278681; a=rsa-sha256; cv=none; b=zAGp05vwYGxGmj9s4AMXLCMKWxatr17wVzi+UDYktNmAm1edCpCsvKkfM3BnJm73de/AJJ QE9Bj9z0PHN0Oe2ir3b1+HGUz0BRK+SxMneLYcoDEgEgUoQUztzDLYsznWuhOJN4D6GZSg syObrGE9WAQcaNg7QEmoQC1M/6BIk0g= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf21.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=1725278681; 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=vaRnQ5ZB6zfB3Heokf+8CcZy/c4ydR+vqX7dWrax7xMuocL4fOeZPi93+9IwvfcTd5AYQ0 sDVbe77haMev5kqhBNUXDmF/bzepI5NAwFORKC91WTUZm9CGhAgvNUrlpeRaR5oRJWjxhA XjHZqXCwEWDUJMkeJ/KT/Xgm0XHJGqo= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Wy6rK1XYXz9sS7; Mon, 2 Sep 2024 14:04:49 +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 vWRlH_ukOAsW; Mon, 2 Sep 2024 14:04:49 +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 4Wy6rJ3gq4z9sST; Mon, 2 Sep 2024 14:04:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6C5618B76D; Mon, 2 Sep 2024 14:04:48 +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 o8-dVuryggej; Mon, 2 Sep 2024 14:04:48 +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 70CC28B76C; Mon, 2 Sep 2024 14:04:47 +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 v4 3/5] powerpc/vdso: Refactor CFLAGS for CVDSO build Date: Mon, 2 Sep 2024 14:04:40 +0200 Message-ID: <24633ee77bd106e18fb2e9ad8337163b7d947f85.1725278148.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=1725278679; l=4208; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=8uyRGNGCCgVJfGMmDTrx0v5vR/iTZQuTWlNxnOkFWq8=; b=eS83GpJpOm8j+Sc7Nob/z7Cl762msT2fzftS3kELig11iMQYgm64YvTOpdDkZOfK86blIJEzJ A63ui2c0qCfCyORSFyyLNWValmRYNBX3XknO6+HpQqd0HwBrn1wDCUp X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Rspamd-Queue-Id: D3BE51C001E X-Rspamd-Server: rspam01 X-Stat-Signature: fb9yhnh8t6zfhp3g34ohewcn7oe65u59 X-HE-Tag: 1725278703-892410 X-HE-Meta: U2FsdGVkX1+8jD3M5JD17CIAmkm+9qnpl9lqI4TYRZZFv14YZh7gUSQZFmID5QOu8vK9WIHGGexA++U3gU1E3mLyZOUymblng+DNDa8TpejayxTWWTRgNt7sXisRD47HDNTgUymvIbC5nUAzX8WBou9LXVjU4wi9D1UWCuaCe9bJRut1KecN+2wm8SIdhrWSApmj1ZfxcmhCamocpXEVU8J3tT6y5ImA074EftTn58vrz//ybH/XcDBnsx5NkGIXAVGkkANVswkXtk4u6z4KITD/OvPVSTjalzPYJH42aGTT2pOBZI2GHYhy3eo+XR0R3WkqyNW7dkHG8N49iLp82f7t0G6El3gzVkDHflgXK5tuLfo36DP3+1Lylm5iTsozgV3YVrH3++mRfmjwTjvajKvuvBkyxaERXeCXZ41toSzoG4OR8E9ROGzV+rZBte8m92UK53wXzbTVXT+SNWrfSswKeH7qAxEslBETSV0qvawL8jPcvhIbaxQIsnpvRraAYAmZr7sYVo3QiB/pmGeCtziGbiufTQ2/N5/AKUDl3XQ1J9VWFJsvvcWEMUx712LS0Sb310mXL+AMezpCWc/CYpXnSOw5jwSAosnPn2gR1I5SUUKu0cxMFSZj56xA0QSg//z7oPKXDjgPKGTd795a85s+Yyi17tKTXbAYr65tfSiIzUQXly8hGS1wna0SS3kalqkevF+7qXdUGx9pdiJZ9JKfwWk0okFI8ZsQDBq28Q1saqGvRI63h3MuNvDe83Rdmvg6Oxh622knTae7N3LWc2nWhCiZrF3ZwtFL/gmW0ywO4zKjiXjxJ0VPXmODxxWQZbK5EO8S7AUxgZNm9UZ4C5ZwkZ1DYBuq0NJLzww3JB3WuH4iyPJCF4+Tz8oDeVQ98040Xt1zGze7qj7UdhebNMB9JRvXWA2iWZP1/BlmlWL0Xer6faluF+8df+xohzFvoBhnrzm/0S9g7aFlDJg zsP8/F81 NX9Agm/cR09X0tDmrnEyk31jWiu0cIlQrxloa/DM1PHfSzxYhb+znbyqdiNwpYU0KdQHctxhpxqs7MRQ4SrG41gXsUJVRdVwjsYY3KO+EpjOhZzFSK/KKU9KCaR0vWT+Zockl 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)