Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2968897rdb; Tue, 12 Sep 2023 19:22:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4FPPw2zQOdhtKjGupphyhWGBQpaBDH/TIiFQtMxGc76GaSmNnRUjTJX8m5/EgxsscO+vX X-Received: by 2002:a05:6a00:2d01:b0:68e:3616:604a with SMTP id fa1-20020a056a002d0100b0068e3616604amr2183564pfb.8.1694571724336; Tue, 12 Sep 2023 19:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694571724; cv=none; d=google.com; s=arc-20160816; b=uXX1awgTbMBCNk3vsjZNBpmMAiE+Z9wpwq1s6krhaGZjlRwJNi02vn1uvcEQzy9rX4 207n7rwniTxrV0GvVw+rVk4MDOW6hNUPcwWMohdwe26G+LhARR/uI0LiO+7BVApq6Dcl d2g/wK2m7CAxLZ0iR6I2VtublPgWsehTwMMURwT+4I9a/+nrpkOH7AoosTTSUKMYgPZS 7JWlrpi/U8zUSxBHe+V9svOd2+lYWFdRAm9eehS7r3IJIxycKba+7YsNXB7aLKc10jeF 6xKyE+K7kxm40otK9tG/iG6aGC2QtQQs2adRRohuEx6HBB8dFue4XL2GoNtlXN3vUV8m MpRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=H500R7KXtKHiSjqNGrh9ix7Bt5gTMBgVSxiIDYkrDUs=; fh=qiMXzIt3Eig3b1IIjMlcCWQEvrXnziP1Rz4o0T68rnQ=; b=tj6HqiKMw1Wuu3x3dzvw11H4rEN8hqHr20nP24Wy7qTf6mB4TAMcNiHTXlH0FCp6er rl/DgcerPorux7/9UWQqbIgpi94Kox7MLhlzhRuQnDGL3VLg5Xmpy5/RxrNjjiH9/gG6 Aff0z2torkzzRafSfSEt53Vm0m9EFTiy1dcao+jPpX7WiPYyzNzyX4eCFzwgw8LKfZvO xiFFMTvUoAXkn3zjv8jTaxYYH9eGSG6D7flgT43/dTtmEN8iDyqpT0YI16d/eaDxbIfl gqik/36N14+2vZbWfX2LliZ8Ejk9B5Vwa1WHLZwM2e+Rx+6jmtrQDSMGRIcJTwUMsL2W ZdMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Xb3/w3uW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id bx8-20020a056a00428800b0068fbd15c04dsi5086802pfb.3.2023.09.12.19.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 19:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Xb3/w3uW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A2DAB821DB24; Tue, 12 Sep 2023 16:34:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbjILXeu (ORCPT + 99 others); Tue, 12 Sep 2023 19:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjILXet (ORCPT ); Tue, 12 Sep 2023 19:34:49 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FD31702 for ; Tue, 12 Sep 2023 16:34:46 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c382f23189so59435ad.0 for ; Tue, 12 Sep 2023 16:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694561685; x=1695166485; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=H500R7KXtKHiSjqNGrh9ix7Bt5gTMBgVSxiIDYkrDUs=; b=Xb3/w3uWRU7MkLKS7YkV95QqQ1GIauD3Sf704dfn7BkJhWfMdSp7MBJgC52038+OWM 6B7ajYjAcpS/DVlZyXtwurKbsyf6tLhOKN5deDPnOHGhDIKhSRMore/2xJ+qK/KKqgxA gE/zQmSCaTwHjQS+0gEQtbbP//O+2gnUlCb42YzJN+HC7WHIsDNavGZ66iEwMHnWd/na y9fnQ+2JhU5lwgB0xOaAbYiQDdApS32s8mVJ8I+Onpmkca/suwqC6B66vQM2hewj76uv BQ+3PQdYn1DNUyRVQMkEVPuzOxB/hPVmIU6HQIgABBqUo3Vi9sN/tU7+v5L4H/pYgDiL 0RTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694561685; x=1695166485; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=H500R7KXtKHiSjqNGrh9ix7Bt5gTMBgVSxiIDYkrDUs=; b=UYpmy6YEOKaV/2R+7pMbMN4wqjYL2iYfPXXTxtPTz8Ze7PcIISj91KTq3I2w2zGFa2 OdJZ/AZil87kphkRNITRn/0tf2v8vSPRnBtx5PhNuft66tGXEhbx3dCzcxTsQWM3qqFS VIVRXpUkhw1M+6/0oYp5WiS3eT8wXOzczQH1Oa/1+Zwf1BN8NgmchyJd9IOSEUkBIAB1 Mvh8O4CHBpS4l8JYkK3NC21IXpdkhHcStozq5WqO6I+M2UrjDMuA/bwodVX3sYhOJzWk QH96C9uZrbHHkk254SzTQsJXzSARvGBvzb/PDFAE9QGijQhnb/p+9IXC321uPgtmR1g+ MtpA== X-Gm-Message-State: AOJu0YybE/rdKhcI4/yFdud6POzeh37OMubP04j1V7Aa0LxXxsLzL7tU a5EGoME3D3N59Kz3Fs/uzuQBFQ== X-Received: by 2002:a17:903:283:b0:1af:90ce:5264 with SMTP id j3-20020a170903028300b001af90ce5264mr41414plr.27.1694561685058; Tue, 12 Sep 2023 16:34:45 -0700 (PDT) Received: from google.com ([2620:15c:2d3:205:94b7:2050:b571:8164]) by smtp.gmail.com with ESMTPSA id t8-20020a170902bc4800b001bf846dd2ebsm9002100plz.303.2023.09.12.16.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 16:34:44 -0700 (PDT) Date: Tue, 12 Sep 2023 16:34:36 -0700 From: Fangrui Song To: Alexandre Ghiti Cc: Nick Desaulniers , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH v9 6/6] riscv: Use --emit-relocs in order to move .rela.dyn in init Message-ID: <20230912233331.zejmknzcm5mwzzcz@google.com> References: <20230329045329.64565-7-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230329045329.64565-7-alexghiti@rivosinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Sep 2023 16:34:52 -0700 (PDT) X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email On 2023-03-29, Alexandre Ghiti wrote: >To circumvent an issue where placing the relocations inside the init >sections produces empty relocations, use --emit-relocs. But to avoid >carrying those relocations in vmlinux, use an intermediate >vmlinux.relocs file which is a copy of vmlinux *before* stripping its >relocations. > >Suggested-by: Bj?rn T?pel >Suggested-by: Nick Desaulniers >Signed-off-by: Alexandre Ghiti >--- > arch/riscv/Makefile | 2 +- > arch/riscv/Makefile.postlink | 13 +++++++++++++ > arch/riscv/boot/Makefile | 7 +++++++ > 3 files changed, 21 insertions(+), 1 deletion(-) > >diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile >index 860b09e409c7..7dc6904a6836 100644 >--- a/arch/riscv/Makefile >+++ b/arch/riscv/Makefile >@@ -8,7 +8,7 @@ > > OBJCOPYFLAGS := -O binary > ifeq ($(CONFIG_RELOCATABLE),y) >- LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro >+ LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro --emit-relocs > KBUILD_CFLAGS += -fPIE > endif > ifeq ($(CONFIG_DYNAMIC_FTRACE),y) >[...] (Not subscribed. b4 am https://lore.kernel.org/all/20230329045329.64565-7-alexghiti@rivosinc.com/ neomutt -f v9_20230329_alexghiti_introduce_64b_relocatable_kernel.mbx) This commit 559d1e45a16dcf1542e430ea3dce9ab625be98d0 introduced --emit-relocs to arch/riscv/. I am concerned that --emit-relocs's relocation-type-changing behavior may not be desired and any new use could become problematic. https://sourceware.org/bugzilla/show_bug.cgi?id=30844 "ld riscv: --emit-relocs does not retain the original relocation type" If either -mno-relax or --no-relax is used, --emit-relocs should be fine.