Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1821613rwe; Fri, 2 Sep 2022 04:32:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR794J5O0jziKxQZy7Bz5glfdwyVJUYmIqcNxWOvAW92OA+PT/RzuU2nqfJKHbGmLZDRb6Aj X-Received: by 2002:a05:6402:2499:b0:440:942a:40c2 with SMTP id q25-20020a056402249900b00440942a40c2mr33754638eda.37.1662118336093; Fri, 02 Sep 2022 04:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662118336; cv=none; d=google.com; s=arc-20160816; b=OhtwV1CN93J/BhQrcLBslCZRtuH+A4u4NKK2Ivwls+hIzMlV28wKlSCFl9TmG/xgzG SoGWlnSQqtVUxpEWcEACNavCcGm/Z2st6Lzz7bKs7ZIrpRtYF2AQzENbWqxJPIIjJ7eV C1gwsdXxSFDLt6oFER0lNw7f3eamCjz4hGnMstHm82dvCsYsHCFpu4+UaXBiZgkyIbsp AXSmKbbrL/OpXFXoTCgqvRkoktEAPavWUokPvAviknSZwvZUV7XagQ/ElZt30OAGSWrF X4PobIvdMsd0nyNmIyWtAioRVlRIVc/Jdcz4KsR0OoLkXcI6pjSo3XIj8jopj5U01QKK 6Owg== 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=oK5k/XarZgYM6Fzyx42ZEatqkwXlaQsFnP9duylzayM=; b=TSe78PyLwtIb9YWqOT5i6Y2RED1CE7N5L6nALbgv+TOFnIRyLio496g9SYGcGDsOJE W6emR0Nqc77XbwFAef3+homIL4gEl92smYVEEC415/RjC4xbSQ0WRo6kW+Mk9dq1JP2N 30TVXV9pykcACuaNoo4bsp+nWXqC6BgxfMKmui2u20GvAnHWArpbRNcgO71oXnvJf/QH u9FqCfPpS9F12IX8372lASqcYffK+OfBEQIirermRTMkk6UVwgQZBfQrx6DODWtscFMN 0BV89y///rssYMlcAd2QUCbs8pgAFu5ey0kcXQK4XWbCc3byIqmCi+qz12pSeZO4SwV9 lPtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=B5ydBUwq; 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 b6-20020a056402278600b004486b3296aasi1763046ede.511.2022.09.02.04.31.49; Fri, 02 Sep 2022 04:32:16 -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=B5ydBUwq; 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 S235646AbiIBLLT (ORCPT + 99 others); Fri, 2 Sep 2022 07:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235564AbiIBLLN (ORCPT ); Fri, 2 Sep 2022 07:11:13 -0400 Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFB4550A2 for ; Fri, 2 Sep 2022 04:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1662117028; bh=EGtbjyLDzpTVkWrfldEazAiMbJLZUSfJaD+YS6RdxSw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=B5ydBUwqEYiO0W7fXnSf32TmrwU0GeDqLZrXhZlNVYCpOtsVX1rmf04VFuTiINlYg bR1JRKOUyxbifnSV6XBlHV/0kMsAGT0oi4g6WnTQO9yC6kHaoyW67rjhbY+dI++HQi I4PwikI7S9zVZYI/ovM6BltW0v1uEaz+EhZqSHUQ= 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 44A5366825; Fri, 2 Sep 2022 07:10:27 -0400 (EDT) Message-ID: Subject: Re: [PATCH 1/3] LoongArch: tools: Add relocs tool support From: Xi Ruoyao To: Youling Tang , Huacai Chen Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Xuerui Wang , Jiaxun Yang Date: Fri, 02 Sep 2022 19:10:25 +0800 In-Reply-To: <1662113335-14282-2-git-send-email-tangyouling@loongson.cn> References: <1662113335-14282-1-git-send-email-tangyouling@loongson.cn> <1662113335-14282-2-git-send-email-tangyouling@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.1 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 Hi Youling, On Fri, 2022-09-02 at 18:08 +0800, Youling Tang wrote: > This tool is based on the arch/mips/boot/tools/relocs tool. I've dig some history of MIPS relocatable kernel (https://lwn.net/Articles/682020/): * Kernel is compiled & statically linked as normal, with no position independent code. MIPS before R6 only has limited relative jump instructions so the vast majority of jumps are absolute. To compile the kernel position independent would introduce a highly undesireable overhead. Relocating the static binary gives a small startup time penalty but the kernel otherwise perforns normally. Unlike (pre-r6) MIPS, LoongArch has a complete support for PIC, and currently LoongArch toolchain always produces PIC (except, if -Wa,-mla- {local,global}-with-abs or la.abs macros are used explicitly). So would it be easier to review and correct the uses of "la.abs" in the code, and make the main kernel image a real PIE? Then we can load it everywhere w/o any need to do relocation at load time. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University