From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0EEEC5518A for ; Wed, 22 Apr 2020 07:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E2762070B for ; Wed, 22 Apr 2020 07:59:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="PuUhW6L3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbgDVH7H (ORCPT ); Wed, 22 Apr 2020 03:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725786AbgDVH7G (ORCPT ); Wed, 22 Apr 2020 03:59:06 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F085EC03C1A6 for ; Wed, 22 Apr 2020 00:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=y8zwg/4nYCbTWpF0JCDU3rnEy9NBEw0BuwpBupWprWA=; b=PuUhW6L30ovlK0ErliYvZNjvE pmENsbjXK4bGEascDh/yz5T/4KfMUs3bzS5LVIOKqCkdNAJvN5JlffNTUX/PnZszHT4wyaByLW5MW YeJkVlGAftAguunBzmeal1yit+Oifw7Pb+ntH3JZ2oU/zS1M1FrIn5RDMtQcz8GCmrFZOW/25OHnD LuJ4CuTTIrD9K2zHAXL0Gs5na12PDkZa4fi+6qH7vVt56cT5GdgN3ErdGzIJ0rSIjzXqtKPGpbepw x0lO+PCJVGxnqaAB4p7Gp+4Fe9BAJlMB0TrAE2iF4L7/OakxIiPKg7V63N4O/Flxrv1N2GFQeU/Jy YtZb/+3hQ==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:42000) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jRAHX-0006mq-VF; Wed, 22 Apr 2020 08:58:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jRAHW-0007ya-6v; Wed, 22 Apr 2020 08:58:54 +0100 Date: Wed, 22 Apr 2020 08:58:54 +0100 From: Russell King - ARM Linux admin To: Geert Uytterhoeven Cc: Masahiro Yamada , Kees Cook , Ard Biesheuvel , Linux ARM , Linux Kernel Mailing List Subject: Re: [PATCH v4] ARM: decompressor: simplify libfdt builds Message-ID: <20200422075854.GK25745@shell.armlinux.org.uk> References: <20200419191958.208600-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 09:44:38AM +0200, Geert Uytterhoeven wrote: > Hi Yamada-san, Kees, Russell, > > -CC RMK's patch system > +CC lakml > > On Sun, Apr 19, 2020 at 9:26 PM Masahiro Yamada wrote: > > Copying source files during the build time may not end up with > > as clean code as expected. > > > > lib/fdt*.c simply wrap scripts/dtc/libfdt/fdt*.c, and it works > > nicely. Let's follow this approach for the arm decompressor, too. > > > > Add four wrappers, arch/arm/boot/compressed/fdt*.c and remove > > the Makefile messes. Another nice thing is we no longer need to > > maintain the own libfdt_env.h because the decompressor can include > > . > > > > There is a subtle problem when generated files are turned into > > check-in files. > > > > When you are doing a rebuild of an existing object tree with O= > > option, there exists stale "shipped" copies that the old Makefile > > implementation created. The build system ends up with compiling the > > stale generated files because Make searches for prerequisites in the > > current directory, i.e. $(objtree) first, and then the directory > > listed in VPATH, i.e. $(srctree). > > > > To mend this issue, I added the following code: > > > > ifdef building_out_of_srctree > > $(shell rm -f $(addprefix $(obj)/, fdt_rw.c fdt_ro.c fdt_wip.c fdt.c)) > > endif > > > > This will need to stay for a while because "git bisect" crossing this > > commit, otherwise, would result in a build error. > > > > Signed-off-by: Masahiro Yamada > > This is now commit 365a6327cd643eed ("ARM: 8968/1: decompressor: > simplify libfdt builds") in arm/for-next. > > In light of reworking "[PATCH v5] ARM: boot: Obtain start of physical > memory from DTB"[1] on top of this, which would conditionally add > another source file to libfdt_objs, I have a few questions. > > > --- a/arch/arm/boot/compressed/Makefile > > +++ b/arch/arm/boot/compressed/Makefile > > @@ -76,29 +76,31 @@ compress-$(CONFIG_KERNEL_LZMA) = lzma > > compress-$(CONFIG_KERNEL_XZ) = xzkern > > compress-$(CONFIG_KERNEL_LZ4) = lz4 > > > > -# Borrowed libfdt files for the ATAG compatibility mode > > - > > -libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c > > -libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h > > - > > -libfdt_objs := $(addsuffix .o, $(basename $(libfdt))) > > +ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) > > +libfdt_objs = fdt_rw.o fdt_ro.o fdt_wip.o fdt.o atags_to_fdt.o > > > > I guess the code below can be moved out of the ifeq block, as it doesn't > really do anything if CONFIG_ARM_ATAG_DTB_COMPAT=n, and $(libfdt_objs) > becomes empty? > If not, I think I'll have to add a new Kconfig symbol ARM_BOOT_LIBFDT, > to be selected by ARM_ATAG_DTB_COMPAT and USE_OF. > > > -$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% > > - $(call cmd,shipped) > > +OBJS += $(libfdt_objs) > > > > -$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ > > - $(addprefix $(obj)/,$(libfdt_hdrs)) > > +# -fstack-protector-strong triggers protection checks in this code, > > +# but it is being used too early to link to meaningful stack_chk logic. > > +nossp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector > > +$(foreach o, $(libfdt_objs), \ > > + $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt $(nossp-flags-y))) > > Is there a real reason this is only applied to a subset of the C object > files, and not to all of them? Or have we been lucky so far, by not > triggering the issue in decompressed.c, misc.c, and string.c (yet)? I don't remember the details. See commit 7f66cd3f5420, which came from Kees which introduced this. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2C10C5518A for ; Wed, 22 Apr 2020 07:59:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B5333206D4 for ; Wed, 22 Apr 2020 07:59:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hAF3fLzB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="PuUhW6L3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5333206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XKCCQZvbnhEw+j7TpiSDUF3/jxFCeRKVRuPEpDr7wFk=; b=hAF3fLzBwG3lej eE46UbdxOmN3EBXepgho30aTKtGGHL6b6ThHXvL3gL9o936sMOr0dS5yFpBJ8NzbH4U6d6pHTLdru JSH5521FcLWFvRtVTpvJiXkYs6bF9TijB11TwFoFxGtVj+L2XJbrCzVTDlMM4I9FPoDIqHZzp/Iha KPXhYbQZkboANtZ3XjLr1vhDLnFHBu8JT3ZiOsv/wQQMF7OdpG6H4tY/USvg1oH0GIQCLqGUdM72F UCPOoXbreq3jF1defHEWaGz7k1M270M8auyPw72CrT+8y0S5cj8Vz+gFovhRGFsQgjKK2a6aQ3wt0 pVlWmBdFOEgOToJNzdCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRAHm-0007Hm-7S; Wed, 22 Apr 2020 07:59:10 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRAHi-0007Fr-AE for linux-arm-kernel@lists.infradead.org; Wed, 22 Apr 2020 07:59:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=y8zwg/4nYCbTWpF0JCDU3rnEy9NBEw0BuwpBupWprWA=; b=PuUhW6L30ovlK0ErliYvZNjvE pmENsbjXK4bGEascDh/yz5T/4KfMUs3bzS5LVIOKqCkdNAJvN5JlffNTUX/PnZszHT4wyaByLW5MW YeJkVlGAftAguunBzmeal1yit+Oifw7Pb+ntH3JZ2oU/zS1M1FrIn5RDMtQcz8GCmrFZOW/25OHnD LuJ4CuTTIrD9K2zHAXL0Gs5na12PDkZa4fi+6qH7vVt56cT5GdgN3ErdGzIJ0rSIjzXqtKPGpbepw x0lO+PCJVGxnqaAB4p7Gp+4Fe9BAJlMB0TrAE2iF4L7/OakxIiPKg7V63N4O/Flxrv1N2GFQeU/Jy YtZb/+3hQ==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:42000) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jRAHX-0006mq-VF; Wed, 22 Apr 2020 08:58:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jRAHW-0007ya-6v; Wed, 22 Apr 2020 08:58:54 +0100 Date: Wed, 22 Apr 2020 08:58:54 +0100 From: Russell King - ARM Linux admin To: Geert Uytterhoeven Subject: Re: [PATCH v4] ARM: decompressor: simplify libfdt builds Message-ID: <20200422075854.GK25745@shell.armlinux.org.uk> References: <20200419191958.208600-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200422_005906_363771_5AD77D05 X-CRM114-Status: GOOD ( 24.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux Kernel Mailing List , Masahiro Yamada , Kees Cook , Linux ARM , Ard Biesheuvel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 22, 2020 at 09:44:38AM +0200, Geert Uytterhoeven wrote: > Hi Yamada-san, Kees, Russell, > > -CC RMK's patch system > +CC lakml > > On Sun, Apr 19, 2020 at 9:26 PM Masahiro Yamada wrote: > > Copying source files during the build time may not end up with > > as clean code as expected. > > > > lib/fdt*.c simply wrap scripts/dtc/libfdt/fdt*.c, and it works > > nicely. Let's follow this approach for the arm decompressor, too. > > > > Add four wrappers, arch/arm/boot/compressed/fdt*.c and remove > > the Makefile messes. Another nice thing is we no longer need to > > maintain the own libfdt_env.h because the decompressor can include > > . > > > > There is a subtle problem when generated files are turned into > > check-in files. > > > > When you are doing a rebuild of an existing object tree with O= > > option, there exists stale "shipped" copies that the old Makefile > > implementation created. The build system ends up with compiling the > > stale generated files because Make searches for prerequisites in the > > current directory, i.e. $(objtree) first, and then the directory > > listed in VPATH, i.e. $(srctree). > > > > To mend this issue, I added the following code: > > > > ifdef building_out_of_srctree > > $(shell rm -f $(addprefix $(obj)/, fdt_rw.c fdt_ro.c fdt_wip.c fdt.c)) > > endif > > > > This will need to stay for a while because "git bisect" crossing this > > commit, otherwise, would result in a build error. > > > > Signed-off-by: Masahiro Yamada > > This is now commit 365a6327cd643eed ("ARM: 8968/1: decompressor: > simplify libfdt builds") in arm/for-next. > > In light of reworking "[PATCH v5] ARM: boot: Obtain start of physical > memory from DTB"[1] on top of this, which would conditionally add > another source file to libfdt_objs, I have a few questions. > > > --- a/arch/arm/boot/compressed/Makefile > > +++ b/arch/arm/boot/compressed/Makefile > > @@ -76,29 +76,31 @@ compress-$(CONFIG_KERNEL_LZMA) = lzma > > compress-$(CONFIG_KERNEL_XZ) = xzkern > > compress-$(CONFIG_KERNEL_LZ4) = lz4 > > > > -# Borrowed libfdt files for the ATAG compatibility mode > > - > > -libfdt := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c > > -libfdt_hdrs := fdt.h libfdt.h libfdt_internal.h > > - > > -libfdt_objs := $(addsuffix .o, $(basename $(libfdt))) > > +ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) > > +libfdt_objs = fdt_rw.o fdt_ro.o fdt_wip.o fdt.o atags_to_fdt.o > > > > I guess the code below can be moved out of the ifeq block, as it doesn't > really do anything if CONFIG_ARM_ATAG_DTB_COMPAT=n, and $(libfdt_objs) > becomes empty? > If not, I think I'll have to add a new Kconfig symbol ARM_BOOT_LIBFDT, > to be selected by ARM_ATAG_DTB_COMPAT and USE_OF. > > > -$(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/% > > - $(call cmd,shipped) > > +OBJS += $(libfdt_objs) > > > > -$(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ > > - $(addprefix $(obj)/,$(libfdt_hdrs)) > > +# -fstack-protector-strong triggers protection checks in this code, > > +# but it is being used too early to link to meaningful stack_chk logic. > > +nossp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector > > +$(foreach o, $(libfdt_objs), \ > > + $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt $(nossp-flags-y))) > > Is there a real reason this is only applied to a subset of the C object > files, and not to all of them? Or have we been lucky so far, by not > triggering the issue in decompressed.c, misc.c, and string.c (yet)? I don't remember the details. See commit 7f66cd3f5420, which came from Kees which introduced this. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel