Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1553085ybg; Thu, 11 Jun 2020 12:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze73FNyV09zymKPL/DNeUZXwcRQksKrYtQlgAYfTi8mwGpescoZuipw5AzLo/1PIDZZ1qz X-Received: by 2002:a17:906:a0f:: with SMTP id w15mr9056378ejf.332.1591905131900; Thu, 11 Jun 2020 12:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591905131; cv=none; d=google.com; s=arc-20160816; b=cjY5jLAulTeW1RUZGF7NHYzujCgXdw2PzJDmGYgDrMtYfwIC7t0E3/1rPFr7nTp3Vf +TtLfxHhQ6Imd7pAhgYY38PzuDLkFC3q48D6v3WAOg1SQr9OmByKGsF57rzkFjcrXfJL lGyqLC4tdYJug+Zyej5vFjVLTL+9jQAyiD1MZEO7xm6sQ5pemqRF2M4zKsWJqTNt8slO ZTpbU6JQJIkkIJZWhJT8RNJWbhgCtCI/4vMXp/Ess1GZZzS5fIEsSEOqKT+839/gFrTp ggDTiYe7/DqM7XqxBp8ob2FYXkKWUw2OsIiNu2LMkghttYFgCJhG9eVemhms+E9XjB3p zTCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=ZzqTSgTmI8uFrrzSPL+KgNV4RytmRiBrBrO6LaQIAm0=; b=fmWdYWgH2czs4O1codYljCSdauo+Z48GqAiX1fYyp/tDfJ9nKTDowpHVRHHEQn7QCw prNfGYUSS0ZIUGuIYlwqPSlMCcpo4JJjfhOa0qmCJt1uM8kUUJ9RfRvbHD8gCB37gvt4 H1+o8HmQEEsGtmamA3JYDsbVB6WWnAd+Up8f3S1n8XjCP9xb0JznegccAVLaH9csbv3f S28JCe9YatZAoSoWJmFz4NwAkRvgU3sVVdiHbd/fZNjs7n3vnbGM/MtexGNcIBOjvX+N YuHI/+HTZtgdQIguIijfuPGtCpQDCU6SynkAEZ15acwyNUCWYRamWvaOIoFK+Q+AQ0yV GNuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha26si2643296ejb.533.2020.06.11.12.51.49; Thu, 11 Jun 2020 12:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbgFKToD (ORCPT + 99 others); Thu, 11 Jun 2020 15:44:03 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:58001 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgFKToD (ORCPT ); Thu, 11 Jun 2020 15:44:03 -0400 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 Cc: Anup Patel 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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