From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16318C6FA87 for ; Fri, 2 Sep 2022 11:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235860AbiIBLLT (ORCPT ); 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 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