Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3929307rwb; Mon, 5 Sep 2022 22:50:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Jg7XZRxHyEAFpZIakmqSt2jcwkExSpPN4xjJH4ZkTkOYqlPqUqX0X6zgQHouFWN+PV+zY X-Received: by 2002:a05:6a00:24d3:b0:53a:8f28:5054 with SMTP id d19-20020a056a0024d300b0053a8f285054mr33130000pfv.36.1662443454653; Mon, 05 Sep 2022 22:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662443454; cv=none; d=google.com; s=arc-20160816; b=VTJ+3yvgkxUMsIeeN+0nwS+ZUXvkjyzC1GM6a3BWPgnqBvbSNqO/Y6Wxxd8wDqnhS5 2fAU6CUS2nMJFDSGvGPm6XnhDCjKafgwD3j7mVbuS3Yx06pT1nUOedP8BlayGa6k3O7d h9SEFiFcZye+ekTNBxQ437wrS9FxTCiagLbs0iW7HZihLHy8J5zPPWQsNQaxzcCRiMRK UFrr0fS6ZvFA+c8nRoQdSPISEranvOGpYbHfMICG5yYlkuztgbiAVq3kCIVw+xZH6Hne z4Z8M87Jk7gaxfzapcR+lG+E/q07v1qjm8XRh7PLjBvOhICjQpinKO7TIeHO0FzvvlCF vfgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=BxJoQ2X5JhrFeiRMsDTrrArjZvjknA4x07YFlSdQSbk=; b=m9p8n1JhvdeHat/Znuu3k2x+52Wa0bZBX1x+Dqkc01FLRMZU0QG7CmSGv+AEDUtW1I Bph8mRfrawxwthySKaQ6yk8jcwA6472Y7aL7z7W9qkL5tv+1KG7OAbTLe9j2s6O9C5bh O5dPw5gx45Vk9lxgamLNkTMyE9xMqWz+rTjZNWNCh1kRyuu7a37ZrVceKvrouIk0Ovrc WHL9z77a/GaYCsc8KQF/2tZCCSZ1PsjMM3Mujy9yGChjRGFmgJR9UyHBZj0YAQMM09Tw efUGy5aa/JK+ePBFwsIf2WeHX9k1hbKz3A0e1ANPJiE8BYjmZQ0JAsEJCNPXKrVo0Gfz AD4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=hp7IQRiD; 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=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a63220a000000b0043048ac5cb4si11653510pgi.495.2022.09.05.22.50.43; Mon, 05 Sep 2022 22:50:54 -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=@xry111.site header.s=default header.b=hp7IQRiD; 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=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229499AbiIFFR4 (ORCPT + 99 others); Tue, 6 Sep 2022 01:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232469AbiIFFRw (ORCPT ); Tue, 6 Sep 2022 01:17:52 -0400 Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3386BCD7 for ; Mon, 5 Sep 2022 22:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1662441468; bh=NsoOFwFx0AaCpoovCG8Ki6hZzXU3jxwvWcd2PK9PRqU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hp7IQRiDpU6Bbdl1RyNiTcuOZCsE3I/D4feOVWr+fTnOOcwVUaG6ugNw9L0PSYpDA xGCIEEBIMc4/efYr4wG+whO2rrSX3FZEAaDSuXJV1gfoTjjQyFdhm4UgnA4y99Tx0y 1PViNCnZGTL9hCxrmuonolCKIVEM67AbU4Cetfbo= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 1889965C56; Tue, 6 Sep 2022 01:17:46 -0400 (EDT) Message-ID: Subject: Re: [PATCH 1/3] LoongArch: tools: Add relocs tool support From: Xi Ruoyao To: Youling Tang , Jinyang He , Huacai Chen Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Xuerui Wang , Jiaxun Yang Date: Tue, 06 Sep 2022 13:17:45 +0800 In-Reply-To: <29cd929b-185b-1c4b-f200-08f2a724b59d@loongson.cn> References: <1662113335-14282-1-git-send-email-tangyouling@loongson.cn> <1662113335-14282-2-git-send-email-tangyouling@loongson.cn> <4df8a26c49a35c1fce36d80c370f738fa71a2bef.camel@xry111.site> <78a4a6b0970c309daa336a2329e69d28df486552.camel@xry111.site> <0b2d115c42ff6cb9b8c65d852ec2f0746ca6e8d9.camel@xry111.site> <29cd929b-185b-1c4b-f200-08f2a724b59d@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.45.3 MIME-Version: 1.0 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, 2022-09-06 at 10:16 +0800, Youling Tang wrote: > Switch to relative exception tables: >=20 > https://github.com/tangyouling/linux/commit/6525b8da > https://github.com/tangyouling/linux/commit/b6ac0827 >=20 > Will switch to the relative exception tables after applying the above > two patches. So there is no need to relocate the exception table > (remove relocate_exception_table). >=20 > Now we can remove the relocation of la.abs , got and ex_table, but > still need to relocate LARCH_64. Is there anything else that needs to > be modified to eliminate this relocation? You may see the RISC-V patch as a reference: https://lore.kernel.org/all/20211009171259.2515351-2-alexandre.ghiti@canoni= cal.com/ Basically, make the linker to generate R_*_RELATIVE instead of R_*_64 for pointers. And, perform R_*_RELATIVE relocation loading the kernel. Something problematic IMO: RISC-V uses "-shared" to trick the linker to generate R_*_RELATIVE but I consider it ugly (if the kernel is a shared library, my grandma will be a wagon!) I prefer "-pie -static", but our Glibc does not have static-pie support for now. It won't really affect the kernel (we are -nostdlib), but we cannot learn how to handle R_*_RELATIVE in static pie from Glibc then. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University