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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A41BC6FD20 for ; Fri, 24 Mar 2023 10:34:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbjCXKei (ORCPT ); Fri, 24 Mar 2023 06:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCXKeh (ORCPT ); Fri, 24 Mar 2023 06:34:37 -0400 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9350A1AD; Fri, 24 Mar 2023 03:34:36 -0700 (PDT) Received: (Authenticated sender: alex@ghiti.fr) by mail.gandi.net (Postfix) with ESMTPSA id 55EDD100004; Fri, 24 Mar 2023 10:34:27 +0000 (UTC) Message-ID: <877d03e1-b00b-7863-6104-21b42bc63711@ghiti.fr> Date: Fri, 24 Mar 2023 11:34:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE Content-Language: en-US To: Nick Desaulniers , =?UTF-8?B?QmrDtnJuIFTDtnBl?= =?UTF-8?Q?l?= Cc: Alexandre Ghiti , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, nathan@kernel.org, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev References: <20230215143626.453491-1-alexghiti@rivosinc.com> <20230215143626.453491-2-alexghiti@rivosinc.com> <4a6fc7a3-9697-a49b-0941-97f32194b0d7@ghiti.fr> <877cw7dphf.fsf@all.your.base.are.belong.to.us> From: Alexandre Ghiti In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Hi Nick, On 3/22/23 19:25, Nick Desaulniers wrote: > On Fri, Feb 24, 2023 at 7:58 AM Björn Töpel wrote: >> Alexandre Ghiti writes: >> >>> +cc linux-kbuild, llvm, Nathan, Nick >>> >>> On 2/15/23 15:36, Alexandre Ghiti wrote: >>>> From: Alexandre Ghiti >>>> >>> I tried a lot of things, but I struggle to understand, does anyone have >>> any idea? FYI, the same problem happens with LLVM. > Off the top of my head, no idea. > > (Maybe as a follow up to this series, I wonder if pursuing > ARCH_HAS_RELR for ARCH=riscv is worthwhile?) IIUC, the goal for using RELR is to reduce the size of a kernel image: right now, this is not my priority, but I'll add that to my todo list because that may be useful to distros. > >> Don't ask me *why*, but adding --emit-relocs to your linker flags solves >> "the NULL .rela.dyn" both for GCC and LLVM. >> >> The downside is that you end up with a bunch of .rela cruft in your >> vmlinux. > There was a patch just this week to use $(OBJCOPY) to strip these from > vmlinux (for x86). Looks like x86 uses --emit-relocs for KASLR: > https://lore.kernel.org/lkml/20230320121006.4863-1-petr.pavlu@suse.com/ That's nice, that would be an interesting intermediate step until we find the issue here as I believe it is important to have the relocations in the init section to save memory. Thanks for your answer Nick, really appreciated, Alex