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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 064D4C433F5 for ; Fri, 7 Jan 2022 13:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=9R4fUk7R7bvAN7u7nWIldVHW9d0oKrRO7hZixttNmjI=; b=oyFpumT+q9HVjn yG+Bfv4qeDXvKQXj+y8M+MrhXN4ttHi8/wREMnjJJ2mzWxVRicyTwEX1BbcRGbMUy4tm8ahlnjlzf j7k3pMRXXj7ZOtZRdc7Wxr1xYWWiHbZr1tPMlruadXFwIVWGoApyR9E+GCT9nKucIm2uXjRA66StX A0K5aCLqv5OvmF8JZ5iLBht0oZG8zg6IDk1oCBhyLLB/ESTIyH5uzqYlzCH6rPOIh59sqarDKICJb vMeer0ufiQP4qMzLZIagdxCUNFpWaApRWXS93/djqM55oLiIpF0ipou8Q8TZnGjCzSlZLFriMrkYD 1fkE8mvHZqKiZPzWg+oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5pd5-00432I-MG; Fri, 07 Jan 2022 13:50:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5pd0-00430L-Ev for linux-arm-kernel@lists.infradead.org; Fri, 07 Jan 2022 13:49:59 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA4CC13A1; Fri, 7 Jan 2022 05:49:57 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.7.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F4363F774; Fri, 7 Jan 2022 05:49:56 -0800 (PST) Date: Fri, 7 Jan 2022 13:49:54 +0000 From: Mark Rutland To: Andre Przywara Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: Re: [boot-wrapper PATCH v2 1/9] Makefile: Avoid .got section creation Message-ID: References: <20211222181607.1203191-1-andre.przywara@arm.com> <20211222181607.1203191-2-andre.przywara@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211222181607.1203191-2-andre.przywara@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220107_054958_586517_FCC43992 X-CRM114-Status: GOOD ( 20.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 22, 2021 at 06:15:59PM +0000, Andre Przywara wrote: > At the moment we build the boot-wrapper with the default toolchain > settings, which has issues if that is a toolchain targeted to Linux > userland, for instance. Since boot-wrapper is rather simple, we get away > with this, *mostly*, but there is at least one case where this breaks: > Many distributions enable PIE builds by default when building GCC, so by > just calling "gcc" we build the .o files for PIE (although we don't link > them accordingly, since we use "ld" directly). > When we moved the PSCI code from assembly to C, we also introduced > global variables, which a PIE enabled GCC will put into a .got section > (global offset table), to be able to easily relocate them at runtime > (if needed). This section happens to be outside of the memory region > we reserve, so can (and will be) overwritten by Linux at some point. > Doing PSCI calls afterwards does not end well then. "memtest=1" is one > way to trigger this. > > To avoid the (in our case pointless) creation of the GOT, we specify > -fno-pic and -fno-pie, to override any potential toolchain default. > > This fixes boot-wrapper builds on many distro compilers, for instance > as provided by Ubuntu and Arch Linux. > > Signed-off-by: Andre Przywara Thanks; applied. Mark. > --- > Makefile.am | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Makefile.am b/Makefile.am > index d0a68df..3e970a3 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -126,6 +126,7 @@ CPPFLAGS += $(INITRD_FLAGS) > CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ > CFLAGS += -Wall -fomit-frame-pointer > CFLAGS += -ffunction-sections -fdata-sections > +CFLAGS += -fno-pic -fno-pie > LDFLAGS += --gc-sections > > OBJ := $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ)) > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel