Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp121868rwl; Thu, 23 Mar 2023 13:36:17 -0700 (PDT) X-Google-Smtp-Source: AKy350bIno+c3cWoNP9y7gyINP26g/IWnXSwc9Tmv16FgC452L6wKjOFh0+Vx7n+Do/uBVLAB89f X-Received: by 2002:a05:6402:1841:b0:4fc:782c:dca3 with SMTP id v1-20020a056402184100b004fc782cdca3mr669088edy.28.1679603777272; Thu, 23 Mar 2023 13:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679603777; cv=none; d=google.com; s=arc-20160816; b=N2nzUa6Gbfila+toSPFv+9W3fxQ0TfQGZPxu3xh26jx/yMRg6QXWp7k+T6EkRNDa96 Sss2qltvQ8OOahBXAXaJ/n3oaMI4DpKKQ2SPtN0XkypfKCWjXs5FqNVXYmXbUehD66Qq kvzsllTnmnDj9MfyHQO0+owUwWOBuiaajgFviosuxZ407acOi21NdYwWmCK6CKOaWyM7 J3g7bRnWDkeDrVp9G4DIIWqeccjdmCWBFbxo9Oz/O4o00H5ar8XBQRVIoDEqtOONhT4g tW8SVWoW+GJDBpKX1U5jrwD9tGckVlh4c1mIVTRJXjWEFUqHeVl8O7ok6sswUiVHx990 WBCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+55oTh7z8IE/JgYLIE37w82gPzf2I2OB6Ia2/zSR7Vs=; b=DVXZvmK4aDvcv5I9KB47b9PsM5lvT+SBGO5Ioj9MM/xbiMC5VBSChV4SMAUmuyN0Gr STJup/IWVqBI2OfnaFMlQcFJ4P8NUV4h/MlmuHwVL7fk5t4wuQjEEbc2yFMsSVLVAJC1 X7Xck4MW9f2MJxqXO4CXU6gkcUFyKewdCz54aWn4i38IoXqDBiz/2ouOGekm2SZWr6uc olBwnvigUp07QDLvhN/XdGZRcPCQUmhsM3n0a4JYbeN5vaF9PzoWoqMuves/z0Gq7qAf 0qpQoJL2rozbaiyxvJ7ysjbDcB3BzRLlBIXAhqVH6T/AA/zqq4r7lfQBz/FpJHl0q+gm mUdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IPZIkew3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020aa7c24b000000b005021f0d576csi92372edo.691.2023.03.23.13.35.52; Thu, 23 Mar 2023 13:36:17 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=IPZIkew3; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbjCWUBg (ORCPT + 99 others); Thu, 23 Mar 2023 16:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231589AbjCWUB3 (ORCPT ); Thu, 23 Mar 2023 16:01:29 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A88928D3E for ; Thu, 23 Mar 2023 13:01:27 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id fb38so9093217pfb.7 for ; Thu, 23 Mar 2023 13:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679601687; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+55oTh7z8IE/JgYLIE37w82gPzf2I2OB6Ia2/zSR7Vs=; b=IPZIkew3dFtjmZdaViTjyD0HscLUwPXqPripmrMsr3WTFFmpjru7uOEiW5MdR0VV95 3AkjKWS+SSGR66Z2HcB5pk7YSGalu08/hGwoMnkFnDkE2qoAQbU1GvgUd6upSXxx5s2P WgA85mghqIhhEYMtWiZMDw6eVS30vmwumoj8UFiy4jXPgOQpsvTsmsWOaQLIrepOjNLG 23PQbOvHd/lWhmQ57R9lQXqXoeGABGhKFPHzTLsKICBt+2gzhqsz8P/8SexMqUTFcc6H UOF5X9dx/gsFR66RqsvJo3OswMwtQs/bMnp7PF1XkJIv33y55T3bQzLy+NDa36XNhCpS +QIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679601687; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+55oTh7z8IE/JgYLIE37w82gPzf2I2OB6Ia2/zSR7Vs=; b=OQUZzYbeRHwZzmQXE6XLEYmOc6VvLDTrF6cDj4SN6ZVI2+1ZVEFAtU3ZM+FQrzVfp2 yfWk03qq0zoBHrPJ+ktfNrohE0UGuwo1ZnSDRZx1/KpW+th52naaM3xzYoVQWGqW6N3v RE8aP21JmLDVkCsYZ5gloBTinf1SOO1VXooTir1fKO5Y4ncwiW9dDjb0zdFWnG4vPd5A gu+Bl2jC2fT9jQYSAsqmwXz0MDDRckf4Ps/nPBgpsBMr7nGr0iPMv/4GhiDmw1Cc/TUg F4sMZbjBZJHAW+2NOAMs83PADIDT4AhDZOHugLqDzaSNAALtH6XalgYVuQNKN37lWLGm Qb+A== X-Gm-Message-State: AO0yUKXGd7t4gWb1b5r1RrWGJ3m3uilTTEyIephyLQdxdj5UkU+KWJD4 D5y6RUq0mQ8p7XryShWeOUJXTrcHfXj+gwDG/mT4WA== X-Received: by 2002:a65:484d:0:b0:503:354c:41ad with SMTP id i13-20020a65484d000000b00503354c41admr2238413pgs.11.1679601686525; Thu, 23 Mar 2023 13:01:26 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: Fangrui Song Date: Thu, 23 Mar 2023 13:01:15 -0700 Message-ID: Subject: Re: [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE To: Nick Desaulniers Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Alexandre Ghiti , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-15.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 On Wed, Mar 22, 2023 at 11:26=E2=80=AFAM Nick Desaulniers wrote: > > On Fri, Feb 24, 2023 at 7:58=E2=80=AFAM Bj=C3=B6rn T=C3=B6pel 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 ha= ve > > > 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=3Driscv is worthwhile?) (I had thought about this for my own fun, but the currently only implementation arch/arm64/kernel/head.S uses assembly. Every port needs to write some assembly for the same task, which is a pity. In FreeBSD rtld, glibc, and musl, DT_RELR code is target-independent.) > > > > Don't ask me *why*, but adding --emit-relocs to your linker flags solve= s > > "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/ > -- > Thanks, > ~Nick Desaulniers > --=20 =E5=AE=8B=E6=96=B9=E7=9D=BF