Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1093644lqt; Fri, 7 Jun 2024 07:53:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCIu0X85AoawnDCMT8vD0D67/e1jUJhq3Be5GJk1yGRR0DguV9TFRzuREPKHI4nZvyZnYNUXdgwC1aP+HZDILnyKXK2qf97SlyLKCRtQ== X-Google-Smtp-Source: AGHT+IEm57qT6dvmI0tnhLLbB0thO6kOHzpgpfNzVV6zDBNW5eq3z1ccc55SZcxJiXSWBKA0A4KU X-Received: by 2002:ac8:7f09:0:b0:440:5434:d59e with SMTP id d75a77b69052e-4405434d643mr2817341cf.26.1717772033139; Fri, 07 Jun 2024 07:53:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717772033; cv=pass; d=google.com; s=arc-20160816; b=C8ygi2O8xX2XFyw/vVgMFWs2AMq95ZFkrkDPGFSr0hUEzH/HShCvyZE0+UcRoyBOzy 5/OP18hbsxBVEp9gGhJXiP9u79Zvzll7h1H21UeTwpAdiKWPA7qqz5W7endFvn1LyvyZ fgjkWTobijPkCDmTplCNvu8LR8kNDk3HlYgRwvamy8aL2ea2FWrb8NbQB3lOy7c4xzJ/ sA+Pbh5ydlRroLLGTlizoRNGQ9KtC6bo3P74Wf4DREb5xYjnaR388ygwlh0f2yUqaOZV axHITUA1KRhaeke3k5Ef4K8tpBnyM+zeLJk6uO3H+rvV5cewS4/4VLKt+2MWpg/5QrMp XuwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3U1JodjDWcmu/GiiBzmBarkUimOwCGInCZ5xa1ty/R8=; fh=ohr9KQigYev+xI9C0K23zEnRBW8P++0Mp5kBDOb2lds=; b=pJP71FycsrpzTt6Z4Sb0BPdZnUzgvZbVreWjAXXd+D2EAGf9rcZexUCIfIm0ooCnsr sZZ+JA66qJ6nIXGmzVkkNhrA5dXT0DNLvUsvM+YzmtzUt3Ylh+JU0mYGYKd9vMcwmT12 kw5eZA8b6iUpwCw6wbLNAc7cgkhafe0BleTZo8+mQYip7zHosNM+eHCIpC7k+ZhY/Ln+ dy4Q1loclV5poFEkSDnywFTYfZFRHpHx3zm9As+92ZLZOh2YfV9xNLbe9ZNI7NSkzDNx 3BJgQFvo9U0TJbsGzLDZvd/vs2vmVD3ieZ204qLmnIiwc7hrLSwFo4N6cJyVTPYZ5/U3 XasA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c5MYrUXi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-44038a6d75asi40371341cf.90.2024.06.07.07.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 07:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c5MYrUXi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206301-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206301-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 016F11C222E5 for ; Fri, 7 Jun 2024 14:53:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4A6019AD68; Fri, 7 Jun 2024 14:43:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c5MYrUXi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B8437196D99; Fri, 7 Jun 2024 14:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717771411; cv=none; b=vB9cucA9Op9Y8lY05RN2u76eZ8frkNuH+bDu86YbperwJDoVBvU7E76/u6QVKsF3re+FxBYZtd4/RkP00KrEx4U5jBF5L1mMtIGj5JiMg83Fu4uuKbOcQhkRq2nTbaE+L+9r8HKPyhE3iIvAfmPLqC8YrC8Hlb93ZOts2yDnazw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717771411; c=relaxed/simple; bh=Aghj0cHV7oDMUlR2GlJobLXB2IWw7s4ne4SMNdsCqFU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sTc4YsMu4fP4KLf8bjxMaBixmvAZG0ESe6g265jygPSo5C1e5lE/9yTLCHYCXctnLclAwKfKJ1WzLK82g0EL+XYROrZbaHu9YsaKCO2BlTqZZof0rPbyi+iF9XIwei4581z28NBZL44wSvHuFtJ6A4Aayy5NZyXZe/q3Lfecg/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c5MYrUXi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FACAC2BBFC; Fri, 7 Jun 2024 14:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717771411; bh=Aghj0cHV7oDMUlR2GlJobLXB2IWw7s4ne4SMNdsCqFU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c5MYrUXijLFyMMTns3Y1RmhtCMDTfGeUkaXeRVBhmPNyZIg2mApXb6ESEBshsy3Sd 64pVbnn+U/RspCFpmpw/179i6UAbJ/W7L40/aKygtpmMWeNhyZJ8UCz2Kj7mAJIlGN 9ul4dSj+UgSu4VFfox9z9wuN9kkN/MF3D+o96rWPTn1bSPTE28b5TcRJByejP20R5K fU3hMmdDy8c86v/V6FZ+jh3eZbuWRJ3Qty4qwQ8CR+w8TotpMLldTaThU1yrvx4CB+ zLsbLYshtAo3I6Vl8VxFlL1gda/ALNpMTbBGgS2KGDQaKtiCaLrieqSUgef/ZGXsry 9uq9G9UadYaiw== Date: Fri, 7 Jun 2024 07:43:29 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Michael Ellerman , Arnd Bergmann , Masahiro Yamada , Nicolas Schier , linux-kbuild@vger.kernel.org, Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc: vdso: fix building with wrong-endian toolchain Message-ID: <20240607144329.GB2483293@thelio-3990X> References: <20240607061629.530301-1-arnd@kernel.org> <87frtoq5yz.fsf@mail.lhotse> <23ddf649-f70b-47b0-90df-af572fd50504@app.fastmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23ddf649-f70b-47b0-90df-af572fd50504@app.fastmail.com> On Fri, Jun 07, 2024 at 04:11:25PM +0200, Arnd Bergmann wrote: > This patch seems to work as well for me, and is a little > more logical, but it's also more invasive and has a > higher regression risk: Commit feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") did something similar for clang for the same reason, so I would say it is worth pursuing this direction. It also avoids including KBUILD_CFLAGS twice when generating .i files. Cheers, Nathan > 8<--------- > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile > index 65261cbe5bfd..9ad4ca318e34 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -62,14 +62,14 @@ KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o > endif > > ifdef CONFIG_CPU_LITTLE_ENDIAN > -KBUILD_CFLAGS += -mlittle-endian > +KBUILD_CPPFLAGS += -mlittle-endian > KBUILD_LDFLAGS += -EL > LDEMULATION := lppc > GNUTARGET := powerpcle > MULTIPLEWORD := -mno-multiple > KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) > else > -KBUILD_CFLAGS += $(call cc-option,-mbig-endian) > +KBUILD_CPPFLAGS += $(call cc-option,-mbig-endian) > KBUILD_LDFLAGS += -EB > LDEMULATION := ppc > GNUTARGET := powerpc > @@ -95,7 +95,7 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) > aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian > > ifeq ($(HAS_BIARCH),y) > -KBUILD_CFLAGS += -m$(BITS) > +KBUILD_CPPFLAGS += -m$(BITS) > KBUILD_AFLAGS += -m$(BITS) > KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) > endif > @@ -176,7 +176,6 @@ KBUILD_CPPFLAGS += -I $(srctree)/arch/powerpc $(asinstr) > KBUILD_AFLAGS += $(AFLAGS-y) > KBUILD_CFLAGS += $(call cc-option,-msoft-float) > KBUILD_CFLAGS += $(CFLAGS-y) > -CPP = $(CC) -E $(KBUILD_CFLAGS) > > CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ > ifdef CONFIG_CPU_BIG_ENDIAN > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile > index 1b93655c2857..3516e71926e5 100644 > --- a/arch/powerpc/kernel/vdso/Makefile > +++ b/arch/powerpc/kernel/vdso/Makefile > @@ -59,7 +59,7 @@ 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) > > # Filter flags that clang will warn are unused for linking > -ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CFLAGS)) > +ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) > > CC32FLAGS := -m32 > LD32FLAGS := -Wl,-soname=linux-vdso32.so.1 > --------->8 > > Arnd