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=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 A62F8C433E0 for ; Thu, 11 Jun 2020 19:44:08 +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 7D85120792 for ; Thu, 11 Jun 2020 19:44:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MTuP4pAM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D85120792 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=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:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZzqTSgTmI8uFrrzSPL+KgNV4RytmRiBrBrO6LaQIAm0=; b=MTuP4pAMj793Dv +NLl31SvMxTxqCbX0+p09LD2xclL22WHxM/WQUVOvSecrCwY+gD+5h/63xwVh1rpObuVS4S0uz/Ev X3r+E6Td+GfpZgHIZhQC/FlWKjIoN/BhW0D7MfsKi06Q9aqwsEuYpO+VX+uGcosmRkE1wTrO/OkSH wb6vha8iE0C3eK8raFH3XQmHwZaMkPgA4NksktQCd/CdNGeJ82/s+LtUMzLKbpkSOm0EB3ujIUjul McYBc2a2CbfbCgrWeCfFZDv3L2YebjbuzxieTyoeqrdiXk8Y12hRax7BoIXBNMGLoJjMUMmlNPO96 Pj+1XvKl05ww1b3DAxCw==; 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 1jjT7P-00042P-Ik; Thu, 11 Jun 2020 19:44:07 +0000 Received: from relay10.mail.gandi.net ([217.70.178.230]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjT7N-00041z-7y for linux-riscv@lists.infradead.org; Thu, 11 Jun 2020 19:44:06 +0000 Received: from [192.168.1.11] (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id B3F6E240004; Thu, 11 Jun 2020 19:43:56 +0000 (UTC) From: Alex Ghiti Subject: Re: [PATCH v5 2/4] riscv: Introduce CONFIG_RELOCATABLE To: Jerome Forissier , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Zong Li , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org References: <20200607075949.665-1-alex@ghiti.fr> <20200607075949.665-3-alex@ghiti.fr> Message-ID: <43ef1623-2186-aa07-cfa5-d618aa4f09c0@ghiti.fr> Date: Thu, 11 Jun 2020 15:43:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200611_124405_417865_B4639B12 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Hi Jerome, Le 6/10/20 à 10:10 AM, Jerome Forissier a écrit : > On 6/7/20 9:59 AM, Alexandre Ghiti wrote: > [...] > >> +config RELOCATABLE >> + bool >> + depends on MMU >> + help >> + This builds a kernel as a Position Independent Executable (PIE), >> + which retains all relocation metadata required to relocate the >> + kernel binary at runtime to a different virtual address than the >> + address it was linked at. >> + Since RISCV uses the RELA relocation format, this requires a >> + relocation pass at runtime even if the kernel is loaded at the >> + same address it was linked at. > Is this true? I thought that the GNU linker would write the "proper" > values by default, contrary to the LLVM linker (ld.lld) which would need > a special flag: --apply-dynamic-relocs (by default the relocated places > are set to zero). At least, it is my experience with Aarch64 on a > different project. So, sorry if I'm talking nonsense here -- I have not > looked at the details. > > It seems that you're right, at least for aarch64 since they specifically specify the --no-apply-dynamic-relocs option. I retried to boot without relocating at runtime, and it fails on riscv. Can this be arch specific ? Thanks, Alex