From nobody Mon Feb 9 17:58:55 2026 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B70311DAC64; Mon, 2 Sep 2024 12:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725278702; cv=none; b=k8GgWFym2EmIsx9+iLPTik98dXH5DcwGvmm2OSDpbkbgMl28X9xkDzRSvxmIXi+dalx4lB2KWwC4uU0k+8qSuDgDZ3S3+ak0m54OZuZ32nhik11+ys9YTEaSosBkA5/I23TL58zMUkKOhW4L5tpZlHFu6nMygZ/T/P7sKxo7LFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725278702; c=relaxed/simple; bh=8uyRGNGCCgVJfGMmDTrx0v5vR/iTZQuTWlNxnOkFWq8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kz4k0BAbEEz+Giuy6tPyF+7fSIF1wsys4/A3agOHfJEIQT8U1tvqSbMFT1obMeAw5hSMhsJS9ngp/NjvzpcRz1nqmhjcOlZFqsCI+a9aTJ9wAMsz6GvVkpDEyzKdyKPFvoVeUURx5PLADf1cpdM3hfaUCKbTWxyKzBjrzPxXm7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu 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: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/M= akefile index c07a425b8f78..67fe79d26fae 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -10,28 +10,11 @@ obj-vdso64 =3D sigtramp64-64.o gettimeofday-64.o datapa= ge-64.o cacheflush-64.o not =20 ifneq ($(c-gettimeofday-y),) CFLAGS_vgettimeofday-32.o +=3D -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-32.o +=3D $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-32.o +=3D $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-32.o +=3D -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-32.o +=3D -ffreestanding -fasynchronous-unwind-tabl= es - CFLAGS_REMOVE_vgettimeofday-32.o =3D $(CC_FLAGS_FTRACE) - CFLAGS_REMOVE_vgettimeofday-32.o +=3D -mcmodel=3Dmedium -mabi=3Delfv1 -m= abi=3Delfv2 -mcall-aixdesc - # This flag is supported by clang for 64-bit but not 32-bit so it will c= ause - # an unused command line flag warning for this file. - ifdef CONFIG_CC_IS_CLANG - CFLAGS_REMOVE_vgettimeofday-32.o +=3D -fno-stack-clash-protection - endif - CFLAGS_vgettimeofday-64.o +=3D -include $(c-gettimeofday-y) - CFLAGS_vgettimeofday-64.o +=3D $(DISABLE_LATENT_ENTROPY_PLUGIN) - CFLAGS_vgettimeofday-64.o +=3D $(call cc-option, -fno-stack-protector) - CFLAGS_vgettimeofday-64.o +=3D -DDISABLE_BRANCH_PROFILING - CFLAGS_vgettimeofday-64.o +=3D -ffreestanding -fasynchronous-unwind-tabl= es - CFLAGS_REMOVE_vgettimeofday-64.o =3D $(CC_FLAGS_FTRACE) # Go prior to 1.16.x assumes r30 is not clobbered by any VDSO code. That u= sed 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 +=3D $(call cc-option, -ffixed-r30) + CFLAGS_vgettimeofday-64.o +=3D -include $(c-gettimeofday-y) $(call cc-op= tion, -ffixed-r30) endif =20 # Build rules @@ -49,6 +32,11 @@ targets +=3D $(obj-vdso64) vdso64.so.dbg vgettimeofday-6= 4.o obj-vdso64 :=3D $(addprefix $(obj)/, $(obj-vdso64)) =20 ccflags-y :=3D -fno-common -fno-builtin +ccflags-y +=3D $(DISABLE_LATENT_ENTROPY_PLUGIN) +ccflags-y +=3D $(call cc-option, -fno-stack-protector) +ccflags-y +=3D -DDISABLE_BRANCH_PROFILING +ccflags-y +=3D -ffreestanding -fasynchronous-unwind-tables +ccflags-remove-y :=3D $(CC_FLAGS_FTRACE) ldflags-y :=3D -Wl,--hash-style=3Dboth -nostdlib -shared -z noexecstack $(= CLANG_FLAGS) ldflags-$(CONFIG_LD_IS_LLD) +=3D $(call cc-option,--ld-path=3D$(LD),-fuse-= ld=3Dlld) ldflags-$(CONFIG_LD_ORPHAN_WARN) +=3D -Wl,--orphan-handling=3D$(CONFIG_LD_= ORPHAN_WARN_LEVEL) @@ -57,6 +45,12 @@ ldflags-$(CONFIG_LD_ORPHAN_WARN) +=3D -Wl,--orphan-handl= ing=3D$(CONFIG_LD_ORPHAN_WAR ldflags-y +=3D $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FT= RACE) -Wa$(comma)%, $(KBUILD_CFLAGS)) =20 CC32FLAGS :=3D -m32 +CC32FLAGSREMOVE :=3D -mcmodel=3Dmedium -mabi=3Delfv1 -mabi=3Delfv2 -mcall-= aixdesc + # This flag is supported by clang for 64-bit but not 32-bit so it will c= ause + # an unused command line flag warning for this file. +ifdef CONFIG_CC_IS_CLANG +CC32FLAGSREMOVE +=3D -fno-stack-clash-protection +endif LD32FLAGS :=3D -Wl,-soname=3Dlinux-vdso32.so.1 AS32FLAGS :=3D -D__VDSO32__ =20 @@ -105,7 +99,7 @@ quiet_cmd_vdso32ld_and_check =3D VDSO32L $@ quiet_cmd_vdso32as =3D VDSO32A $@ cmd_vdso32as =3D $(VDSOCC) $(a_flags) $(CC32FLAGS) $(AS32FLAGS) -c -= o $@ $< quiet_cmd_vdso32cc =3D VDSO32C $@ - cmd_vdso32cc =3D $(VDSOCC) $(c_flags) $(CC32FLAGS) -c -o $@ $< + cmd_vdso32cc =3D $(VDSOCC) $(filter-out $(CC32FLAGSREMOVE), $(c_flag= s)) $(CC32FLAGS) -c -o $@ $< =20 quiet_cmd_vdso64ld_and_check =3D VDSO64L $@ cmd_vdso64ld_and_check =3D $(VDSOCC) $(ldflags-y) $(LD64FLAGS) -o $@= -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check) --=20 2.44.0