Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp894644rwl; Fri, 24 Mar 2023 03:35:34 -0700 (PDT) X-Google-Smtp-Source: AKy350YlzjZZnvS2kMnoaAB8bIdgYUi/hpQ6GXFJ+vTK42BoHNCMJ9h8sT3lx3rSw3rkxDzrS7dS X-Received: by 2002:aa7:dc05:0:b0:501:fd71:7e20 with SMTP id b5-20020aa7dc05000000b00501fd717e20mr2195376edu.3.1679654134020; Fri, 24 Mar 2023 03:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679654134; cv=none; d=google.com; s=arc-20160816; b=KWY/C2bBwR6gR5TQRaYilSLTdh58NeI/G5mQj4gzLO3oqXByvyVvG8HeSwsHUD95KU s+K/OUsV535N2l7eGv3JtyYY4fAGD6yqog4JpoYRHkE+ECFNI91wwkJiX9DhZ+C54S+1 Ia+dOYYA1ydq/zErFNtPZSMpT/v+aLzOL1Dovd2Vx3T+fORSg97a7xoS66LxDCA035Ei WVgN79MBC4CHSsd+3/eSZGlRgjdhtX3Y+8k/8wlkhSWo9jylxK8i32ix1PJ0cXmlLayR h4t5wDvjtTC+ADifBHTZtvKODWUmdGfJPnHM5ensVFmFeJVslG6wJLPDw3pTSsyMVp8i bSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=GNCTjccBjrAeE/d8QHY6FwL3fGHkS41dPwqTke52BJ4=; b=MLCACDHIsKQ7dnQp6eMoAmAXW2HoRHAWlGiSbwM/XHz9weAfHQ7C9iN+/LCSWrFRBI 3F9Zax743PWvFXkuG3U681wJgZYxM7kmp3Mmh7N6U+4j3oHVB/uYTVZpoNMlZAwoHk3M u195ly42kUI1UDDdhukuIfjdvygMN5xtJOnwax8bXQotRTQ2JnzkaXMuc3iOEE9p6HGm 071JYxSzZcc8pZoO4mV1Spp8BmW9Pv8fVxjDuATlb1J7RzCqk7e1INWxpEHFA9uRylz+ 5dzAvE94eZsAxK26xgpnnyIh6wD5Spei4U7fc1oFWsYhxegTo4DVNVQNpXz5JLFxGyHh HkPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a50eac4000000b00501c984361fsi13270556edp.427.2023.03.24.03.35.10; Fri, 24 Mar 2023 03:35:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbjCXKei (ORCPT + 99 others); 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 X-Spam-Status: No, score=-0.7 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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