Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14433157pxu; Tue, 5 Jan 2021 01:07:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKnI0B7ViIlBb8hwXM4EGMdqGzlklNuc6NaKw6yUutrKn6I1U37RI5AZviMkkoGuvdedPl X-Received: by 2002:a50:b944:: with SMTP id m62mr74105418ede.182.1609837676972; Tue, 05 Jan 2021 01:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609837676; cv=none; d=google.com; s=arc-20160816; b=L0SGDZjG5cAuHliSobDoSVgmZVWPC7/ZIhaoX87ProNBTaEpLzCQN6nTA6cijumk1e hRWnyHYqE5hekIdDYoCdnW7DJQufWMUSeOike1Z4elctMUHdPdhJ8CXFrT8PwqMM/gX7 NPn9CPEHD/2F0SyzLLmYHt9Ii9jE9H3zEN2EYmRnCu4mv7Vvm5CKfV69wEP3HNCbGKDF UDkTV0glz8v1BV+eVHhwx+nxp/5xqK/J8FqOf0thhNwMBeRSh3pTwS8f0zeVBhhSEamL kZj3b0gNqi5pq9DLe+wIEAC85DLPpNF/xaRjaln/uitgPOSHxp1vOugMMFWyuEAXsbF/ xKjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=KwHmlBlSYwHrDiz4lTbH37Kq075cZSKda6f/07inWNs=; b=nnDgUeMqauN8tC5CfmA+ddyZ/S8XbxUyp4f8YDg2mj35blP6xDhAppxnVDvNPkudMI T1lyYJOei4FBZw+3cD26IUZm3PnDmd1VU1oThMZfV28sR1n7GM9Bun2Fvg9OkzklO+mH nzWxejgXwy7SQLi/wBKUB2VWCzvF0l9AGl4zWVHzivd0CQqujsWB1G8AQFn4F2nEmgEM VcS9XLnij8beH2yItXiTvVv9L+3/aaAOBcChFIiUBj58/s7da2QoQA0sqieY3Hyqa4qO o+M8mH5lCF9I3ANthU1u4eZXzKog56mFpFAp4qjWd/MRO02SUJEDpNk0Jo5ORsQ2sUhl 1AQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=lV928XRb; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="XOm/h1Gn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si32460008edi.388.2021.01.05.01.07.33; Tue, 05 Jan 2021 01:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm1 header.b=lV928XRb; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="XOm/h1Gn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbhAEJAA (ORCPT + 99 others); Tue, 5 Jan 2021 04:00:00 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:42237 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726982AbhAEI77 (ORCPT ); Tue, 5 Jan 2021 03:59:59 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 29A5358049B; Tue, 5 Jan 2021 03:59:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 05 Jan 2021 03:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=K wHmlBlSYwHrDiz4lTbH37Kq075cZSKda6f/07inWNs=; b=lV928XRb5T4InzEV6 QI7e1C76AIKWbduwZ0Ar2S6JI5ucUPUuZDHyKvMEfnLkyyhGVKFz6FiSmddalZNh t+AFrkWSdUJGxeOM7AodFLYeCpnyxg2N6hvlAGrq8htRBHJecgHAnzo87B5brL50 yxzJKRVM3A1cViiAP4/r5DzcmHnaEqoakikE2NNoKqkxCGsIwYXapQ9YW6AKAuxK 8QgBBkveKz2jxOd2/zlQ1gfSVlqn7Eb+Yo4zHbER5WZAavtUISCNLSPKJBBF4Ary tmSnBLTN0yQy52sGxSBJYMGuVrOtrerw6iQSvOe8170WCM3qosRVZghyhK4SKowX cM/jw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=KwHmlBlSYwHrDiz4lTbH37Kq075cZSKda6f/07inW Ns=; b=XOm/h1GnqHc3oSkjeXx1xkn2OqdXDdXKuR9O3/BLEXhRnh6i0yAHzabm/ 7CeMoKY4BS7Ocfg2i3lOc+osz6sMHTSBgfLkrKtJqMULx/38BSClKq/u9racyJgL AO6CgdVwNDkzqGDmTzuf9IgVmxOgBsX3phNHwSpxJEX1GWqEVFiyX8xB40eU+CbQ 3lTIkCjSkSfe6kiIuqfWnIOIJ9HNlsZo7fsDNdSFa2+pIyBEBPQVsfBzLQcIQrZp IFZIaXDvqqshAII2R4wCLtUovmmpRD5BQ742omn28fg3VAuFdiBjoBsTIYzO+D7z jlxbnlM2J8Nn/u692SrePewwK9XAQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdefgedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhephffgteehteeuuddtvdeikeduvdeuiedukeeiuddtgeevledt ueekteejfeevffdunecuffhomhgrihhnpehlughsrdhssgdpohhpthhiohhnshdrvghhne cukfhppeeghedrfeefrdehtddrvdehgeenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtoh hm X-ME-Proxy: Received: from [0.0.0.0] (li1000-254.members.linode.com [45.33.50.254]) by mail.messagingengine.com (Postfix) with ESMTPA id 054A1108005B; Tue, 5 Jan 2021 03:59:07 -0500 (EST) Subject: Re: [PATCH mips-next 2/4] MIPS: vmlinux.lds.S: add ".rel.dyn" to DISCARDS To: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= , Alexander Lobakin Cc: Thomas Bogendoerfer , Kees Cook , Ingo Molnar , Ralf Baechle , Alex Smith , Markos Chandras , linux-mips , "# 3.4.x" , LKML References: <20210104121729.46981-1-alobakin@pm.me> <20210104122016.47308-1-alobakin@pm.me> <20210104122016.47308-2-alobakin@pm.me> From: Jiaxun Yang Message-ID: <2add3f2d-ab2a-1ca3-5e04-d7b66738bfbe@flygoat.com> Date: Tue, 5 Jan 2021 16:59:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/1/5 下午3:39, Fāng-ruì Sòng 写道: > On Mon, Jan 4, 2021 at 4:21 AM Alexander Lobakin wrote: >> GCC somehow manages to place some of the symbols from main.c into >> .rel.dyn section: >> >> mips-alpine-linux-musl-ld: warning: orphan section `.rel.dyn' >> from `init/main.o' being placed in section `.rel.dyn' >> >> I couldn't catch up the exact symbol, but seems like it's harmless >> to discard it from the final vmlinux as kernel doesn't use or >> support dynamic relocations. >> >> Misc: sort DISCARDS section entries alphabetically. >> >> Signed-off-by: Alexander Lobakin >> --- >> arch/mips/kernel/vmlinux.lds.S | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S >> index 83e27a181206..1c3c2e903062 100644 >> --- a/arch/mips/kernel/vmlinux.lds.S >> +++ b/arch/mips/kernel/vmlinux.lds.S >> @@ -221,9 +221,10 @@ SECTIONS >> /* ABI crap starts here */ >> *(.MIPS.abiflags) >> *(.MIPS.options) >> + *(.eh_frame) >> *(.options) >> *(.pdr) >> *(.reginfo) >> - *(.eh_frame) >> + *(.rel.dyn) >> } >> } >> -- >> 2.30.0 >> >> > (I don't know why I am on the CC list since I know little about > mips... Anyway, I know the LLD linker's behavior in case that was the > intention... ) > > I think it'd be good to know the reason why these dynamic relocations > are produced and fix the root cause. > > arch/x86/kernel/vmlinux.lds.S asserts no dynamic relocation: > ASSERT(SIZEOF(.rela.dyn) == 0, "Unexpected run-time relocations > (.rela) detected!") Hi all, Runtime .rela can't be avoided as MIPS kernel can't be built with fPIC. Our relocatable kernel uses another approach, fixup dynamic relocations at boot time. abicalls simply gave us too much overhead on PIC code, which is unacceptable for kernel. In my local tests, PIC kernel reduced unix bench results for around 30%. For MIPS Release6 and afterwards, we may utilize new pcrel instructions to reduce overhead but for older ISA I don't have any idea. Thanks. - Jiaxun