From patchwork Wed Mar 8 11:52:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp296489wrd; Wed, 8 Mar 2023 04:18:07 -0800 (PST) X-Google-Smtp-Source: AK7set+/ZgY5lnt6jK4NuzDbTSNgClYbM1Dl9UoOsZxEWhnzvnIxymKX6hHk3Mzu0Q8lpQo00FIx X-Received: by 2002:a05:6a20:1b28:b0:cd:478b:a9c9 with SMTP id ch40-20020a056a201b2800b000cd478ba9c9mr15871589pzb.6.1678277887288; Wed, 08 Mar 2023 04:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678277887; cv=none; d=google.com; s=arc-20160816; b=Ydw2iGyL8GLUHvqxwfcx7rq9wCU1bFbzWoLsZNYOhS9FGn9BHuHHWs6JjG2NCyAWNc GDB3mFrdGJf1EulxSzunMz2pDb23WhKjjzdN1MmOajSTyhYpynCMlxcKZaXWvuKj1ubk PIiRru1JQhqnue1gu8rqbfTpfq4vGYtEM4uOfjSWdM4yP2ur+nX8JsEbCsbGyqQ6zAfm eSl3ovUEcKWj8XMe+gICcKn8cIDFZUkSr9CZTAI0Do6SxlZsLASh8y2p4ytyUGPDb7Bj 8dWDwE8VARti4bFcP0zHVtsnciJAUPjfJ3M9KsaCILO1DwxU8+Wk1PKG3TCzw7aeo0VN FVgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AOrYYLXTwH8AAtlgmWVu0wufDzGQBB+nMb1srk3P8EU=; b=rYlYXi52+s4uNC5UtD+s0ULUP3PnJQk4WE8PF7TO276ZIxAi16mjEAEucY6flXln2p rPrHHcHiB9AZpUJAcPbWq2nYqN5MJpqERtrTUZy2zV7x3uJZrD+SmakVUoW/6PgzpC+K /2HyZHRcmWXnFVQovcfQYi/0nqqmDZ2m1q5cFfW61i766KOpqGMw2AEmJBq8sX6lP53r VxOzh31BA1DklZfwkqacHDV3cJjhMvg1WKfDEv62iP6VUFWldx91bqTV82eZOO198JCD oRr6NjBZbK2+VxskTTYqBzXjYgC98ZNU4jVvUO5Ph073I3Xn7ppr1oa3LQLcei4bG+NH G/Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XHzIAH0o; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa79422000000b005a8b55f540bsi14372846pfo.268.2023.03.08.04.17.54; Wed, 08 Mar 2023 04:18:07 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=XHzIAH0o; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjCHLw7 (ORCPT + 99 others); Wed, 8 Mar 2023 06:52:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbjCHLw5 (ORCPT ); Wed, 8 Mar 2023 06:52:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C761A273D; Wed, 8 Mar 2023 03:52:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4620861655; Wed, 8 Mar 2023 11:52:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 373A2C433D2; Wed, 8 Mar 2023 11:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276372; bh=BeJj33VWZheoqQzbtxVsohI47cZzA4a7E3ypOo6W0Pw=; h=From:To:Cc:Subject:Date:From; b=XHzIAH0oH+BppJXxAfqSReRiAUOg/CHKUXvRi+KNdxIHQzmRpBfINd+ZSnMobb+Os FLwt/8kP12IPYoGs5Uv/e5Y8A0S0Hyvv7bNecOM4WCX8TTDlQFXUQ0409t9XWCaWF8 PxFpmOC76ROd/g72JyQSBmmpFgjgCDXiSI0l3/z/XwB8NfEMUxSWpnQd6HYns+36wI jMATkTumWGHnxB7KE242Y0/ohhokp/02fNol0HJFLRq7k5Kykk38ETmN6FpHL4cGAM MKP8MRQneSkOvccf+Xh1If7hY8dEP7OSlNeN0wWs5gW6ExXflhbAcn07eQiE0imbiz hnh95dFxLqWlA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada Subject: [PATCH 1/8] scripts/kallsyms: remove redundant code for omitting U and N Date: Wed, 8 Mar 2023 20:52:36 +0900 Message-Id: <20230308115243.82592-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759801913894384899?= X-GMAIL-MSGID: =?utf-8?q?1759801913894384899?= The symbol types 'U' and 'N' are already filtered out by the following line in scripts/mksysmap: -e ' [aNUw] ' Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/kallsyms.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ea1e3d3aaa6b..8148e880f78e 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -178,10 +178,7 @@ static bool is_ignored_symbol(const char *name, char type) return true; } - if (type == 'U' || type == 'u') - return true; - /* exclude debugging symbols */ - if (type == 'N' || type == 'n') + if (type == 'u' || type == 'n') return true; if (toupper(type) == 'A') { From patchwork Wed Mar 8 11:52:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp296970wrd; Wed, 8 Mar 2023 04:19:18 -0800 (PST) X-Google-Smtp-Source: AK7set+oaPhRU9zrgzObxbBP9o9reymsalp+ECrGklo9ExUeXTU1bY6gt1yk8RoZFY05yN71VhaT X-Received: by 2002:a17:90b:3142:b0:237:a50e:1781 with SMTP id ip2-20020a17090b314200b00237a50e1781mr18670814pjb.24.1678277957988; Wed, 08 Mar 2023 04:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678277957; cv=none; d=google.com; s=arc-20160816; b=UBJXqhmdsIPYncyD+Ml2ReCoHRmo+S3qhAZVgOfTfy5qdEdSCAYMRKetsJZA8XqboP HuB9nca060JKCNZUzEBljE9rOcEez7ApSFVojfg4QgWXW3E6KOyoNESpGN5cvJZ+asAG OBlZJAdGmzjJ6N1XAQp36izkf2HXSIQGO4WvQv+HhgVaDQBUvpZE9xUST2fPOUtWug19 bNRs1dJQncwTV8Ay1FzND+dt8sbizAwQet+W+YjBqt31suPUffQpfFpygvU8JOkx41+h OxKCkXY3Mo60xbG8QydcNXuGy8TPKboWwK8NNydbI7BCPJ+obmCrd6gRdumSia0V63KI vMhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QudJD/x5BIZibTv925hxg5ArhjxStPxXKKxr8KdYLng=; b=bz/gVaoZOA0JUx3G3A8Zi/zp2Unq2dZln+9k/fol5fvnIKgnBgqeqg5yVbYcN4ZVav vN40IambMUY610sALyOvzUxczHyFj41BL8a+ckJcImGaLybN1VQgYiulZEu3sb5yO/Uc 628HZfCwoIV9htvP+e3ZDRxubsqRza1GCF5DqX+EDj7b+R0qm985fsMngxbfJ5pIzypY Y7zVNW2mPUDLMGpvEWemCVLx7CIaQjzUtZlEynNeckqjtFVdRL3tlwG3cWndlfpVkZMu 4BhoBiinBuF7XeFlLRNg62wQ4fdnKHI5+Xx34pKfKgC94UbnaG9UvzG+MGg7rpdBww5f iV8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XWpx5u4w; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ep23-20020a17090ae65700b00233cee16612si17439263pjb.151.2023.03.08.04.19.05; Wed, 08 Mar 2023 04:19:17 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=XWpx5u4w; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbjCHLxC (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbjCHLw7 (ORCPT ); Wed, 8 Mar 2023 06:52:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AAA35AA; Wed, 8 Mar 2023 03:52:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50BE361773; Wed, 8 Mar 2023 11:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C6CAC4339C; Wed, 8 Mar 2023 11:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276375; bh=7uyUzsavvn0QEnswHAxVeA6k/NagrwixLEe+w1g1YW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XWpx5u4w/WjzWIG3/mhevYhQqttiYoDbw8Gck4AhykT5ME6A4HZwlOw79m8o0wIfz NllFc4NOksNjqZF1AnOuCqof2kGwz+OH51Hm7wOC5Y4EeryGCt801KOBx0aKsLS4hO p2e5U+P1cm0xAylP3gOPGuV1G6xWuvNsLsrqHRVhkGnMhb5tYOYakx1eA4wVulOLIA g0fzYfdu4aXmMh6d2YXNXW2R+oNCp2qT+ICAvHcXYBv5oac8qchWmLZVPDbp9xGtbq zlG/gAOFRidhaliuwGqHTXTMIlY+TnNeZ9NURu68d8vHCTXRohJmqbooGNh2BrkXiE q7XsYZFdH57mg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 2/8] scripts/mksysmap: remove comments described in nm(1) Date: Wed, 8 Mar 2023 20:52:37 +0900 Message-Id: <20230308115243.82592-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759801988141504072?= X-GMAIL-MSGID: =?utf-8?q?1759801988141504072?= I do not think we need to repeat what is written in 'man nm'. Signed-off-by: Masahiro Yamada --- scripts/mksysmap | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/scripts/mksysmap b/scripts/mksysmap index 16a08b8ef2f8..697fc6653953 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -10,25 +10,6 @@ ##### # Generate System.map (actual filename passed as second argument) -# $NM produces the following output: -# f0081e80 T alloc_vfsmnt - -# The second row specify the type of the symbol: -# A = Absolute -# B = Uninitialised data (.bss) -# C = Common symbol -# D = Initialised data -# G = Initialised data for small objects -# I = Indirect reference to another symbol -# N = Debugging symbol -# R = Read only -# S = Uninitialised data for small objects -# T = Text code symbol -# U = Undefined symbol -# V = Weak symbol -# W = Weak symbol -# Corresponding small letters are local symbols - # For System.map filter away: # a - local absolute symbols # U - undefined global symbols From patchwork Wed Mar 8 11:52:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp297596wrd; Wed, 8 Mar 2023 04:20:41 -0800 (PST) X-Google-Smtp-Source: AK7set/zBAp7DmfIkbI2ZA5OklRCBxB9xvqcgpY+X+IpCRtKhAGcv0cooBpBx+gZj5w0AokT+8+B X-Received: by 2002:a05:6a20:66a4:b0:bc:8b91:69a3 with SMTP id o36-20020a056a2066a400b000bc8b9169a3mr15001685pzh.46.1678278041497; Wed, 08 Mar 2023 04:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678278041; cv=none; d=google.com; s=arc-20160816; b=ZOl3sVXw4E4GOYOfhHh0IISql/AkDMhZ86ffRUCD4TVkgOIwJOkd35bsLG+0TcDVJA Wy9L1NR9iiubnVHnIuMHPnSEzjuJphLFzuO8d/+K0Rcvo56qlRz/qkVwwn1ZOhVPAWPF 8UkB7X0MdpQxe1MQ9baik1jtvOLwKY8QE5H30gwxwmyq5XXOxQfZYEiPh1aqN1djodHS VV87xdESuF94mwYDhi0Fja6yesme+JFB0YF3KT0wi15sF9WfntlCRy01mrLt+tEbYhP8 IMpDPPiBjr42Z2rNBMl402GT+TpwW9ynk5VnG0Iigy8wjX1F9zLLldCq42g9zdf9YmIN r1Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PKZKp4CyHRaJotl76z/reysfB7rCzDaugwqqtEsPN5M=; b=tMhJ6F31YJ0nNjPZgga2yI0IigrOQYGHJsrPft2yzoEQ0UGW1bxAxpyigzteNtjhxc F958TLKPRGTt58L/fa1d0rbMJ0Kkuai8oIfWcAn3TrDcV4Fcjvb297Zp1/tyCH4JcqAy Zrpkn7yV7BgKVH0MrVYZJs4tGf19WCGz29Zsc59vImCZbYJv2jY9LNonHScy02WCC5ar lPgF88JOZ57TpuJzcrnFYs3eNJKnZpMVi2DpH0bJKgOKaaKKibULuZw+FmoQQsdxJmg5 zKc4iU81Wi/Yc/q3QyouACThm0vtOXgyOmi091vEURSg8Ug1rzc5IyM8Co/1taRlmojE dGjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pgJsNJ9N; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6300c1000000b00502d7cd012csi14775996pga.378.2023.03.08.04.20.28; Wed, 08 Mar 2023 04:20:41 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=pgJsNJ9N; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbjCHLxH (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjCHLxC (ORCPT ); Wed, 8 Mar 2023 06:53:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC419ED7; Wed, 8 Mar 2023 03:52:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 819206176B; Wed, 8 Mar 2023 11:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F03BC4339E; Wed, 8 Mar 2023 11:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276378; bh=DuoivBb2Ni55n4AFx8endkrW+/Kl+HHtMvz18aW6xeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pgJsNJ9NGSDlsj5g3Jb9yWN/CmyktGdnhQLccuksOSSvVLHuF/Q9OmsQgSPK/9ZWa G5zOdxaSw4exdJAs4NaMs14+e40IZqK7M70W3Bu+peo7HGqVzCLZQh7mngJVHa0bYO 2opFAp188IG94eJEzEzASwVaEDkf090H1QcIrskjSF88xTcRmyaKpJWDm28SrAjm3Y 8OncH3KIp6MIOZ9/JQa23fWX9oYJEA4WrchQnO+CympTiPdsTEiNe4jtS22CBUHEce Xw0tH+/ZemKrJIkxKOQeYaEe+n9G5RF/L8ZRIalcgnOCZqUv2iVc+e/5cppw8meEDK garFmig1nkMtA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 3/8] scripts/mksysmap: use sed with in-line comments Date: Wed, 8 Mar 2023 20:52:38 +0900 Message-Id: <20230308115243.82592-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759802075251514212?= X-GMAIL-MSGID: =?utf-8?q?1759802075251514212?= Move comments close to the code. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/mksysmap | 61 +++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/scripts/mksysmap b/scripts/mksysmap index 697fc6653953..8ea1955e03c6 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -10,32 +10,45 @@ ##### # Generate System.map (actual filename passed as second argument) -# For System.map filter away: -# a - local absolute symbols -# U - undefined global symbols -# N - debugging symbols -# w - local weak symbols - # readprofile starts reading symbols when _stext is found, and # continue until it finds a symbol which is not either of 'T', 't', # 'W' or 'w'. # -# Ignored prefixes: -# $ - local symbols for ARM, MIPS, etc. -# .L - local labels, .LBB,.Ltmpxxx,.L__unnamed_xx,.LASANPC, etc. -# __crc_ - modversions -# __kstrtab_ - EXPORT_SYMBOL (symbol name) -# __kstrtabns_ - EXPORT_SYMBOL (namespace) + +${NM} -n ${1} | sed >${2} -e " +# --------------------------------------------------------------------------- +# Ignored symbol types # -# Ignored symbols: -# L0 - for LoongArch? - -$NM -n $1 | grep -v \ - -e ' [aNUw] ' \ - -e ' \$' \ - -e ' \.L' \ - -e ' __crc_' \ - -e ' __kstrtab_' \ - -e ' __kstrtabns_' \ - -e ' L0$' \ -> $2 + +# a: local absolute symbols +# N: debugging symbols +# U: undefined global symbols +# w: local weak symbols +/ [aNUw] /d + +# --------------------------------------------------------------------------- +# Ignored prefixes +# (do not forget a space before each pattern) + +# local symbols for ARM, MIPS, etc. +/ \$/d + +# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. +/ \.L/d + +# CRC from modversions +/ __crc_/d + +# EXPORT_SYMBOL (symbol name) +/ __kstrtab_/d + +# EXPORT_SYMBOL (namespace) +/ __kstrtabns_/d + +# --------------------------------------------------------------------------- +# Ignored symbols (exact match) +# (do not forget a space before and '$' after each pattern) + +# for LoongArch? +/ L0$/d +" From patchwork Wed Mar 8 11:52:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp297575wrd; Wed, 8 Mar 2023 04:20:39 -0800 (PST) X-Google-Smtp-Source: AK7set83JRsqmzo2Wvm8Qk5NJjlPzEfQml8F8Rm4KyODx6ZBNB12iu7UTL5K3YbnQTps5LAjymbQ X-Received: by 2002:aa7:9d11:0:b0:602:7c0:3afe with SMTP id k17-20020aa79d11000000b0060207c03afemr16609325pfp.26.1678278039340; Wed, 08 Mar 2023 04:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678278039; cv=none; d=google.com; s=arc-20160816; b=XeRUiW0KT/w+ncv0AdtnJbpcJrl6LVtydnhCT6MNwOwIes9uJBTrScQzlxRwbQtzeq 6njABWZAG3bCqmTcDNaCLq1DRspySF0UAF+bae44bIvZDomjOoahUMt4yC0pAq+iMN4b JV8MXKuwzWynwC/bt5Irf4B4SmYcndsQ0r3pP2Fy0UdOpRPsBglTtoRIQVGXocIX4VmN Rs+zDqCAzX2vm5DdHRH5et4TZ3AJnTzHrUCcnox/ddPkAhseUgnh8WqVH5ppqoTdOsLK quOiJ4XqKxVJelQZ54scprP8u8KyI/e0Nda8znRvbJyF1ro4TWo5KXJDwaHv8Run0V4A EJYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KnYTh9AAMaRCMtoR95hJgWKNkJsQD2lDSYfWxL2Wa5o=; b=g9JjukiBTjeOrDJm1j6zEJhgSmNX0ZNXcqcz4l1EHKHsYfOEWi/Cb3dbznzQ5/xTLS xiAqEGjp+8R/v/5kJ6oVt6t+XazBvs1EYCTsbixlFaZ9sqHXPsSWmwdzYNruS23Evyk0 i/kgTgJD/ZAM0/4gAEdbqk2vBAsIlA4hZYS//ZtLwmC+8rMtknHIDa7PY+AtGLLs/bA7 AmnxK37HyW5qdApSHVOS/mZt7PyYWwjlF6UQBdBqHiRRnaDTYlGQAzMBHeplfuIrnE9Z zPxEOW3wL9GC5bxkgAoWQUpwey2Y/19kfTDY0yDqvyW0DFxB2ZL4pVyF7HkjNrAMYo0B 2icQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L1jTgMuw; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a635856000000b00502f145822bsi13695922pgm.345.2023.03.08.04.20.26; Wed, 08 Mar 2023 04:20:39 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=L1jTgMuw; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjCHLxM (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbjCHLxF (ORCPT ); Wed, 8 Mar 2023 06:53:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30BAB762; Wed, 8 Mar 2023 03:53:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC42C6176B; Wed, 8 Mar 2023 11:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B117C4339C; Wed, 8 Mar 2023 11:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276382; bh=rzdeuDSykz2lbhUNiiPdPDJhEgRczqxF+BJjUEVIz4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1jTgMuwB04sq37pEEEIjv9sJG8uvJ6UszRj3ctQJQmONScLg2Ln/vmW7ZiIGWPca /QAKR6kGu5qBzhmC0LWMKEI3DTQkUCvxWbFfNOxY73K7DSgkXTn8MNh9vrtEGUEuaI SB+DZwf0dtqsovvFU6HbQSXJkkouPPvkq0aM1/gwfREYR0iRhbeTcSJRb/A9Ahl5Kl E2HM7iTYsdoDDked1x8VdK0kxo5T0nBNbN3QIuGM1+I1hYvh6jD042AAZwOVcuaso6 jd0rixHpDw11tiIPF1PhF0TvnTt5Zq8CbixxCs3+C1IyliQ0TKHC2dsb5/h1K2tn6o RVUJJrH3tmC2Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 4/8] scripts/kallsyms: exclude symbols generated by itself dynamically Date: Wed, 8 Mar 2023 20:52:39 +0900 Message-Id: <20230308115243.82592-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759802073213062215?= X-GMAIL-MSGID: =?utf-8?q?1759802073213062215?= Drop the symbols generated by scripts/kallsyms itself automatically instead of maintaining the symbol list manually. Pass the kallsyms object from the previous kallsyms step (if it exists) as the third parameter of scripts/mksysmap, which will weed out the generated symbols from the input to the next kallsyms step. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 17 ----------------- scripts/link-vmlinux.sh | 6 +++--- scripts/mksysmap | 11 ++++++++++- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 8148e880f78e..e572fda6fe42 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -104,23 +104,6 @@ static bool is_ignored_symbol(const char *name, char type) { /* Symbol names that exactly match to the following are ignored.*/ static const char * const ignored_symbols[] = { - /* - * Symbols which vary between passes. Passes 1 and 2 must have - * identical symbol lists. The kallsyms_* symbols below are - * only added after pass 1, they would be included in pass 2 - * when --all-symbols is specified so exclude them to get a - * stable symbol list. - */ - "kallsyms_addresses", - "kallsyms_offsets", - "kallsyms_relative_base", - "kallsyms_num_syms", - "kallsyms_names", - "kallsyms_markers", - "kallsyms_token_table", - "kallsyms_token_index", - "kallsyms_seqs_of_names", - /* Exclude linker generated symbols which vary between passes */ "_SDA_BASE_", /* ppc */ "_SDA2_BASE_", /* ppc */ NULL diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 32e573943cf0..679eb4653b16 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -174,7 +174,7 @@ kallsyms_step() kallsyms_S=${kallsyms_vmlinux}.S vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} - mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms + mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms ${kallsymso_prev} kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S} info AS ${kallsyms_S} @@ -188,7 +188,7 @@ kallsyms_step() mksysmap() { info NM ${2} - ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2} + ${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2} ${3} } sorttable() @@ -277,7 +277,7 @@ if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then ${RESOLVE_BTFIDS} vmlinux fi -mksysmap vmlinux System.map +mksysmap vmlinux System.map ${kallsymso} if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then info SORTTAB vmlinux diff --git a/scripts/mksysmap b/scripts/mksysmap index 8ea1955e03c6..1efd61ee0bac 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -4,7 +4,7 @@ # tools to retrieve the actual addresses of symbols in the kernel. # # Usage -# mksysmap vmlinux System.map +# mksysmap vmlinux System.map [exclude] ##### @@ -51,4 +51,13 @@ ${NM} -n ${1} | sed >${2} -e " # for LoongArch? / L0$/d + +# --------------------------------------------------------------------------- +# Ignored kallsyms symbols +# +# If the 3rd parameter exists, symbols from it will be omitted from the output. +# This makes kallsyms have the identical symbol lists in the step 1 and 2. +# Without this, the step2 would get new symbols generated by scripts/kallsyms.c +# when CONFIG_KALLSYMS_ALL is enabled. That might require one more pass. +$(if [ $# -ge 3 ]; then ${NM} ${3} | sed -n '/ U /!s:.* \([^ ]*\)$:/ \1$/d:p'; fi) " From patchwork Wed Mar 8 11:52:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp297598wrd; Wed, 8 Mar 2023 04:20:42 -0800 (PST) X-Google-Smtp-Source: AK7set+XWsFjoikLW8PiedctsXkBhTl8gXvfdCTP5OBaBAVunfyMoD5qaaLmNHb/rBxU46oiD4CX X-Received: by 2002:a17:90a:1911:b0:234:b8cb:512b with SMTP id 17-20020a17090a191100b00234b8cb512bmr17974339pjg.30.1678278041862; Wed, 08 Mar 2023 04:20:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678278041; cv=none; d=google.com; s=arc-20160816; b=nbHeLN2gA+KTU54F1WqunWEhAUf9e+8YXRLZaZZTgNALvCoSEQ3vKwN8l5sSlJtmfK GSYCvMU6XGJvDFWYcN1bcnleJQP7ax5/VC/BBEXiKZA1rtf9ekFxqPWAdKZb9FHID4fM Oq/6ZXNRBcuTw1Smjqz+cPQaKQObbQErSsoc9gCJGiwxuBJFuYKmzwtZU/RbDSAxEJzk egBWhoZT8HyHN+CnDDePr7Cu+1RKHDVdb+w/M/484mktVdex/J/SZdTfFK2OxvWWuM6h 4gTfXdyLlMxpC1pYD003w/aqP1bjTuBdZQ/vhfpHie63kwPEBPhaBCIi6K+ZjMhr40OH WTGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tdaERdf/meMPRuEgmtamTKOgYCI9AQndgWXFGm6VNHU=; b=ogW3uOQQOTpwkjtKEI4L5Xze4raXRu02P0mUkFWL7YNlONW3LT4D4CydMUJS3hSKjR LjtFTebYG4eeajU7S7p2oL6YSMaYsjQccG7QHVqjFJ2br24lo0/gphSEv8D7OLVhx8/7 FapfgE6GtzxpW0+InnMXOjG1BVyb6Fi2TCuWZvQsBMhtqIBrXNPCWkz4nOt6fd4vTsrb mPrfzn4S0EVrgvc2vRe+ycp7+8tnBPFH2Z29bnKQMx9is4OndtL/2AC6oa2h/ZLZIEWh GEOJMpxysYDDcdL/YxHkitqBSST2a+DDTGnIoqg7XawBVsw3Ljuy6LEqV49rNhXbqm+x 0t/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WfwbJYJ9; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq1-20020a17090b104100b00235563071d3si16990181pjb.75.2023.03.08.04.20.29; Wed, 08 Mar 2023 04:20:41 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=WfwbJYJ9; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjCHLxS (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjCHLxI (ORCPT ); Wed, 8 Mar 2023 06:53:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36FFF42BD8; Wed, 8 Mar 2023 03:53:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 87BF2615EB; Wed, 8 Mar 2023 11:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB95C43445; Wed, 8 Mar 2023 11:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276385; bh=x4NdmLNpKer8WoqTYRuQhcNBJO8WGAf/8/P+yX6tpcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfwbJYJ9KCfJ0Rfwc4cxTT23fpofjgLd7dGmAbnlwFL5sbDjWD9DtaHM3/MyBbPwm wW4IV2zH9Gu0c37qm8pTkm2t5KQuPv+le3C5KwV/858ZUDIGaA3vUy3UQYYX38PUQ/ 4jkOQDwRzbZ7JGK8qzSNSZRSHz/z/sBdabOyvYAYZCD5JUchj/52jdNMY/OMlMcFVj i0tyfkHvc9R29p9a32IL0MaEYck1Fs/acwdU8KxrBTzltkcsyVlqrXv+Ml1mSAsenu EO/RUAdahhV1uTf4Ud89UTj7/5QcOF6zBJY6S8gYt+KkqT3LnGmAHXcrSuXfFPNELn ztJJJPV0e0V7A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 5/8] scripts/kallsyms: move compiler-generated symbol patterns to mksysmap Date: Wed, 8 Mar 2023 20:52:40 +0900 Message-Id: <20230308115243.82592-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759802076257980634?= X-GMAIL-MSGID: =?utf-8?q?1759802076257980634?= scripts/kallsyms.c maintains compiler-generated symbols, but we end up with something similar in scripts/mksysmap to avoid the "Inconsistent kallsyms data" error. For example, commit c17a2538704f ("mksysmap: Fix the mismatch of 'L0' symbols in System.map"). They were separately maintained prior to commit 94ff2f63d6a3 ("kbuild: reuse mksysmap output for kallsyms"). Now that scripts/kallsyms.c parses the output of scripts/mksysmap, it makes more sense to collect all the ignored patterns to mksysmap. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/kallsyms.c | 59 ---------------------------------------------- scripts/mksysmap | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 59 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index e572fda6fe42..97d514c0fc8f 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -102,65 +102,6 @@ static char *sym_name(const struct sym_entry *s) static bool is_ignored_symbol(const char *name, char type) { - /* Symbol names that exactly match to the following are ignored.*/ - static const char * const ignored_symbols[] = { - "_SDA_BASE_", /* ppc */ - "_SDA2_BASE_", /* ppc */ - NULL - }; - - /* Symbol names that begin with the following are ignored.*/ - static const char * const ignored_prefixes[] = { - "__efistub_", /* arm64 EFI stub namespace */ - "__kvm_nvhe_$", /* arm64 local symbols in non-VHE KVM namespace */ - "__kvm_nvhe_.L", /* arm64 local symbols in non-VHE KVM namespace */ - "__AArch64ADRPThunk_", /* arm64 lld */ - "__ARMV5PILongThunk_", /* arm lld */ - "__ARMV7PILongThunk_", - "__ThumbV7PILongThunk_", - "__LA25Thunk_", /* mips lld */ - "__microLA25Thunk_", - "__kcfi_typeid_", /* CFI type identifiers */ - NULL - }; - - /* Symbol names that end with the following are ignored.*/ - static const char * const ignored_suffixes[] = { - "_from_arm", /* arm */ - "_from_thumb", /* arm */ - "_veneer", /* arm */ - NULL - }; - - /* Symbol names that contain the following are ignored.*/ - static const char * const ignored_matches[] = { - ".long_branch.", /* ppc stub */ - ".plt_branch.", /* ppc stub */ - NULL - }; - - const char * const *p; - - for (p = ignored_symbols; *p; p++) - if (!strcmp(name, *p)) - return true; - - for (p = ignored_prefixes; *p; p++) - if (!strncmp(name, *p, strlen(*p))) - return true; - - for (p = ignored_suffixes; *p; p++) { - int l = strlen(name) - strlen(*p); - - if (l >= 0 && !strcmp(name + l, *p)) - return true; - } - - for (p = ignored_matches; *p; p++) { - if (strstr(name, *p)) - return true; - } - if (type == 'u' || type == 'n') return true; diff --git a/scripts/mksysmap b/scripts/mksysmap index 1efd61ee0bac..d8ad6ff69320 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -36,6 +36,28 @@ ${NM} -n ${1} | sed >${2} -e " # local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. / \.L/d +# arm64 EFI stub namespace +/ __efistub_/d + +# arm64 local symbols in non-VHE KVM namespace +/ __kvm_nvhe_\$/d +/ __kvm_nvhe_\.L/d + +# arm64 lld +/ __AArch64ADRPThunk_/d + +# arm lld +/ __ARMV5PILongThunk_/d +/ __ARMV7PILongThunk_/d +/ __ThumbV7PILongThunk_/d + +# mips lld +/ __LA25Thunk_/d +/ __microLA25Thunk_/d + +# CFI type identifiers +/ __kcfi_typeid_/d + # CRC from modversions / __crc_/d @@ -45,6 +67,15 @@ ${NM} -n ${1} | sed >${2} -e " # EXPORT_SYMBOL (namespace) / __kstrtabns_/d +# --------------------------------------------------------------------------- +# Ignored suffixes +# (do not forget '$' after each pattern) + +# arm +/_from_arm$/d +/_from_thumb$/d +/_veneer$/d + # --------------------------------------------------------------------------- # Ignored symbols (exact match) # (do not forget a space before and '$' after each pattern) @@ -52,6 +83,18 @@ ${NM} -n ${1} | sed >${2} -e " # for LoongArch? / L0$/d +# ppc +/ _SDA_BASE_$/d +/ _SDA2_BASE_$/d + +# --------------------------------------------------------------------------- +# Ignored patterns +# (symbols that contain the pattern are ignored) + +# ppc stub +/\.long_branch\./d +/\.plt_branch\./d + # --------------------------------------------------------------------------- # Ignored kallsyms symbols # From patchwork Wed Mar 8 11:52:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp297601wrd; Wed, 8 Mar 2023 04:20:42 -0800 (PST) X-Google-Smtp-Source: AK7set9x24Fo3uWgnVFNveLfc2CMUpGdMqT1KGV4H594Ec2a8JC7y8FBxrYEeYYqxsTjsL65h8vP X-Received: by 2002:a17:90b:33ce:b0:234:5eb:2177 with SMTP id lk14-20020a17090b33ce00b0023405eb2177mr19698837pjb.9.1678278042567; Wed, 08 Mar 2023 04:20:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678278042; cv=none; d=google.com; s=arc-20160816; b=k12ukvWKygRWSWqCOHxkQAgVwL8gPj+/7QbCyqLaJ50zlCsQLi05Je/9fpXPO+76tT gebdQxVRrI9Oi1iql+oGVUrzV37jHQinu540DUUFfJJ2ua7LgY6cW0Y4Y7nCNkHMYhwt 8nzaoaFX7Fj64tien9ErW+6MTKVtD2ntC6MbwwazHrZw+T4OuvJaQP4by1zQusyVvnnp 27WaKl+la/UGRHVbp1rLJevkgd1MBWVxA+laakVIEHG6avNKQDZkLuDDDBPUlizC00Ex P12PuH1XTr4SkRUaIQVJ05hGNyucTcymWtnO0PuExElbIvWjZC3VtKMKS+Y6es6PwRNE aepA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pId6MBlP4Ox3au/MrJS7Aky0JVLwAxD9sbRnvXPtqFI=; b=GKmfYNMBVtwSxRwz+yfOLgBPSK4hB0CZGuyf+Rlwa3tgBbZ9lH0jJo/U+Y0yHtU2N7 9J9mP/XXe/342KA+KdQzSmSdOVvpP2ACCoRfKXUBKgL9D0zktnWpjwbBhQoZ4n+vI7ce GdjXVPzWJ/PFMiTNE9NXeljcaUiNuOwl9ccD1UXPnG2O81l8AFJOpcVk8v0i9ollTt5Y 1/FCVfq8mcH+5Tf2miBhIF0PeBNFj7FB5dfPfnAk+OmvyB2LnE29hL3uRWqFXj1U1oXJ M5EQ4zVIuWlWS89DVSfY+iO9VC1X08hpQ0/QfK5CwFONR9FsOAEQIpR12L2yL+ct34sO HGww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vsd5CVbV; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020a170902c19400b0019a730571dfsi2434802pld.394.2023.03.08.04.20.29; Wed, 08 Mar 2023 04:20:42 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Vsd5CVbV; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231180AbjCHLxe (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230458AbjCHLxZ (ORCPT ); Wed, 8 Mar 2023 06:53:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A08226CEB; Wed, 8 Mar 2023 03:53:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F056961655; Wed, 8 Mar 2023 11:53:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6CC4C433D2; Wed, 8 Mar 2023 11:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276387; bh=ZkVhJIkKT/UYTmS7WbDcXYK9TEkAwrVF1Ql4lmc2Mhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vsd5CVbV1PoPpTPc7I4dJkA9DptzliuNU/OO92MKuJkgXQjffDnCWDLTofFP4qc1o V12RE3UK1V3PmTMHZpHKs1VI17AA1u4Za+bA3Ykwbd/OztMLes/XAGGMWmK5109DSY oJmOIXFw6yV81jOMcf0AvLnyLLRV4sclBYrmELndDxoO9M5k1A/o7z82PUQbMIWHGd BH1gRujdy4fgNRWearLeF3WbAjX09Kp7AgstPy0Q+4UdhFbQNMrHfbBpucrJ8Iv1NU ucjgZQddu8Z98G7hHhVklDHlEMD2vB385s4/bLbQXeVv7E7/K+FOX8V5yPsolCnVZ4 LZfS963zU9B5Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada Subject: [PATCH 6/8] scripts/kallsyms: change the output order Date: Wed, 8 Mar 2023 20:52:41 +0900 Message-Id: <20230308115243.82592-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759802076555093881?= X-GMAIL-MSGID: =?utf-8?q?1759802076555093881?= Currently, this tool outputs symbol data in the following order. (1) kallsyms_addressed / kallsyms_offsets (2) kallsyms_relative_base (3) kallsyms_num_syms (4) kallsyms_names (5) kallsyms_markers (6) kallsyms_seq_of_names (7) kallsyms_token_table (8) kallsyms_token_index This commit changes the order as follows: (1) kallsyms_num_syms (2) kallsyms_names (3) kallsyms_markers (4) kallsyms_token_table (5) kallsyms_token_index (6) kallsyms_addressed / kallsyms_offsets (7) kallsyms_relative_base (8) kallsyms_seq_of_names The motivation is to decrease the number of function calls to expand_symbol() and cleanup_symbol_name(). The compressed names are only required for writing 'kallsyms_names'. If you do this first, we can restore the original symbol names. You do not need to repeat the same operation over again. The actual refactoring will happen in the next commit. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 118 ++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 97d514c0fc8f..5996f1e61bcf 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -412,56 +412,6 @@ static void write_src(void) printf("\t.section .rodata, \"a\"\n"); - if (!base_relative) - output_label("kallsyms_addresses"); - else - output_label("kallsyms_offsets"); - - for (i = 0; i < table_cnt; i++) { - if (base_relative) { - /* - * Use the offset relative to the lowest value - * encountered of all relative symbols, and emit - * non-relocatable fixed offsets that will be fixed - * up at runtime. - */ - - long long offset; - int overflow; - - if (!absolute_percpu) { - offset = table[i]->addr - relative_base; - overflow = (offset < 0 || offset > UINT_MAX); - } else if (symbol_absolute(table[i])) { - offset = table[i]->addr; - overflow = (offset < 0 || offset > INT_MAX); - } else { - offset = relative_base - table[i]->addr - 1; - overflow = (offset < INT_MIN || offset >= 0); - } - if (overflow) { - fprintf(stderr, "kallsyms failure: " - "%s symbol value %#llx out of range in relative mode\n", - symbol_absolute(table[i]) ? "absolute" : "relative", - table[i]->addr); - exit(EXIT_FAILURE); - } - expand_symbol(table[i]->sym, table[i]->len, buf); - printf("\t.long\t%#x /* %s */\n", (int)offset, buf); - } else if (!symbol_absolute(table[i])) { - output_address(table[i]->addr); - } else { - printf("\tPTR\t%#llx\n", table[i]->addr); - } - } - printf("\n"); - - if (base_relative) { - output_label("kallsyms_relative_base"); - output_address(relative_base); - printf("\n"); - } - output_label("kallsyms_num_syms"); printf("\t.long\t%u\n", table_cnt); printf("\n"); @@ -521,15 +471,6 @@ static void write_src(void) free(markers); - sort_symbols_by_name(); - output_label("kallsyms_seqs_of_names"); - for (i = 0; i < table_cnt; i++) - printf("\t.byte 0x%02x, 0x%02x, 0x%02x\n", - (unsigned char)(table[i]->seq >> 16), - (unsigned char)(table[i]->seq >> 8), - (unsigned char)(table[i]->seq >> 0)); - printf("\n"); - output_label("kallsyms_token_table"); off = 0; for (i = 0; i < 256; i++) { @@ -544,6 +485,65 @@ static void write_src(void) for (i = 0; i < 256; i++) printf("\t.short\t%d\n", best_idx[i]); printf("\n"); + + if (!base_relative) + output_label("kallsyms_addresses"); + else + output_label("kallsyms_offsets"); + + for (i = 0; i < table_cnt; i++) { + if (base_relative) { + /* + * Use the offset relative to the lowest value + * encountered of all relative symbols, and emit + * non-relocatable fixed offsets that will be fixed + * up at runtime. + */ + + long long offset; + int overflow; + + if (!absolute_percpu) { + offset = table[i]->addr - relative_base; + overflow = (offset < 0 || offset > UINT_MAX); + } else if (symbol_absolute(table[i])) { + offset = table[i]->addr; + overflow = (offset < 0 || offset > INT_MAX); + } else { + offset = relative_base - table[i]->addr - 1; + overflow = (offset < INT_MIN || offset >= 0); + } + if (overflow) { + fprintf(stderr, "kallsyms failure: " + "%s symbol value %#llx out of range in relative mode\n", + symbol_absolute(table[i]) ? "absolute" : "relative", + table[i]->addr); + exit(EXIT_FAILURE); + } + expand_symbol(table[i]->sym, table[i]->len, buf); + printf("\t.long\t%#x /* %s */\n", (int)offset, buf); + } else if (!symbol_absolute(table[i])) { + output_address(table[i]->addr); + } else { + printf("\tPTR\t%#llx\n", table[i]->addr); + } + } + printf("\n"); + + if (base_relative) { + output_label("kallsyms_relative_base"); + output_address(relative_base); + printf("\n"); + } + + sort_symbols_by_name(); + output_label("kallsyms_seqs_of_names"); + for (i = 0; i < table_cnt; i++) + printf("\t.byte 0x%02x, 0x%02x, 0x%02x\n", + (unsigned char)(table[i]->seq >> 16), + (unsigned char)(table[i]->seq >> 8), + (unsigned char)(table[i]->seq >> 0)); + printf("\n"); } From patchwork Wed Mar 8 11:52:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp288481wrd; Wed, 8 Mar 2023 04:02:33 -0800 (PST) X-Google-Smtp-Source: AK7set+ZgRmqAjPDD4yHmemPOawmmvnguClX0UTlUCL269YOibtZ+j1BomAGYMkwOFMH/FV6K4Sc X-Received: by 2002:aa7:d342:0:b0:4ac:746e:2edf with SMTP id m2-20020aa7d342000000b004ac746e2edfmr15766164edr.9.1678276953802; Wed, 08 Mar 2023 04:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678276953; cv=none; d=google.com; s=arc-20160816; b=jEkHO+Q9OqGA7h9VxNfl7TPLXhs716AQtS9bYIK5ZKWx7QWFE9vs8jPhMFi+livjuK /mcKrarZGxEqo3POuektAeEt+Z+JHQBbDsTyPXF6/L/fhSjN2viD1WCKJ7v7ZVES7sKo dSgKj57EhoSA0PvbyCbDP/oCdwQ8gcVLNcait5824VK089kZXEeTfwfVqigKCZcR2it8 joE9auu8cf/jmc98OEyK1rHetSP4GenkyX5VS0Rea8GyVj48FAohIj6ezmN1+vxHQDSr oL9zJD5hHLO4gEGLiwK/9uVIVbwI8D536qbrM+QxOcjYMs+TF6cWKTS+AiN4LHJjo8Bp y1cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+A9t/k5/7IJWyVlnWrggh7bs4MxTVXI8dcp/KfXtdgg=; b=FvW3Uvvtez/EHdnnCpqD+PEjV/WSoFEGXgcRUIwD3yU6xI+gQdvOKXvZSsuux5GyTF XuAGcuuqaASom6l9QzOGIMD17ZtTuZhYAF/iGgLwciiT7vLtRAerN2uUlDIY8lUQ09WL z2CpEKFnVDoiyFpMam0MtQ/7mK8hsFzC7dc7hYOTtDI4B9eJJ2JcF//XD8bnN2J9hWbH jdeNBMk4Hz5tvNy36ZA1oJ2rs6+djoCCfR5Rsq6tsv/kHOYzWWQTBgX3jMP8OBqvbXu0 VNIaA+8mjxW7izmjR/jNv5kjVX058JvF2Dsa4e24h1ExoChAK2JEOfc1/93MsU4C9Ene Hn8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DuQdIWp3; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a056402054600b004a981a53b39si1351786edx.326.2023.03.08.04.02.09; Wed, 08 Mar 2023 04:02:33 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=DuQdIWp3; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbjCHLxj (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbjCHLx1 (ORCPT ); Wed, 8 Mar 2023 06:53:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23494D280; Wed, 8 Mar 2023 03:53:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B327561758; Wed, 8 Mar 2023 11:53:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3F46C433A0; Wed, 8 Mar 2023 11:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276390; bh=ItNl/VUdFsdbRrM3FYDQwEWNJZg7o1tpHGJGDk3Q3uE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DuQdIWp3o2rCCF0WNC47R0nVaUQFAnWL/A5R99rxnkqvJBtyU0kfQxOwCLLHFjsZk bN9BYnebAVV2QRjWh8Fu/brb56KLp4LlrZDEwOGWU+z1TUS6AXOS30yO/tSIU4jfLp SjXYAr8wdzaIn21GDPOCvSWfpgudc6oImq/K1EdjsILTbPtsxTN5xEE+2y2U/eOLLL VQF3t9dIbPQdj3W5pSxdp5jmyUo2nNJPQsv63GQ4vyxGJLnMeSQ/c4wQ9DVtbtO9sU ZZ4xnmAEIu+E9EA+d0QdObBK5f55B7laDtW1SwT9Bb0FCht4F3Giq366viOoZ7WF+Z Qewp4S7u7uYBw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada Subject: [PATCH 7/8] scripts/kallsyms: decrease expand_symbol() / cleanup_symbol_name() calls Date: Wed, 8 Mar 2023 20:52:42 +0900 Message-Id: <20230308115243.82592-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759800935106844186?= X-GMAIL-MSGID: =?utf-8?q?1759800935106844186?= Currently, expand_symbol() is called many times to get the uncompressed symbol names for sorting, and also for adding comments. With the output order shuffled in the previous commit, the symbol data are now written in the following order: (1) kallsyms_num_syms (2) kallsyms_names <-- need compressed names (3) kallsyms_markers (4) kallsyms_token_table (5) kallsyms_token_index (6) kallsyms_addressed / kallsyms_offsets <-- need uncompressed names (for commenting) (7) kallsyms_relative_base (8) kallsyms_seq_of_names <-- need uncompressed names (for sorting) The compressed names are only needed by (2). Call expand_symbol() between (2) and (3) to restore the original symbol names. This requires just one expand_symbol() call for each symbol. Call cleanup_symbol_name() between (7) and (8) instead of during sorting. It is allowed to overwrite the ->sym field because (8) just outputs the index instead of the name of each symbol. Again, this requires just one cleanup_symbol_name() call for each symbol. This refactoring makes it ~30% faster. [Before] $ time scripts/kallsyms --all-symbols --absolute-percpu --base-relative \ .tmp_vmlinux.kallsyms2.syms >/dev/null real 0m1.027s user 0m1.010s sys 0m0.016s $ time scripts/kallsyms --all-symbols --absolute-percpu --base-relative \ .tmp_vmlinux.kallsyms2.syms >/dev/null real 0m0.717s user 0m0.717s sys 0m0.000s Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 5996f1e61bcf..937900823fa8 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -335,19 +335,10 @@ static int symbol_absolute(const struct sym_entry *s) return s->percpu_absolute; } -static char * s_name(char *buf) -{ - /* Skip the symbol type */ - return buf + 1; -} - static void cleanup_symbol_name(char *s) { char *p; - if (!lto_clang) - return; - /* * ASCII[.] = 2e * ASCII[0-9] = 30,39 @@ -366,16 +357,10 @@ static void cleanup_symbol_name(char *s) static int compare_names(const void *a, const void *b) { int ret; - char sa_namebuf[KSYM_NAME_LEN]; - char sb_namebuf[KSYM_NAME_LEN]; const struct sym_entry *sa = *(const struct sym_entry **)a; const struct sym_entry *sb = *(const struct sym_entry **)b; - expand_symbol(sa->sym, sa->len, sa_namebuf); - expand_symbol(sb->sym, sb->len, sb_namebuf); - cleanup_symbol_name(s_name(sa_namebuf)); - cleanup_symbol_name(s_name(sb_namebuf)); - ret = strcmp(s_name(sa_namebuf), s_name(sb_namebuf)); + ret = strcmp(sym_name(sa), sym_name(sb)); if (!ret) { if (sa->addr > sb->addr) return 1; @@ -464,6 +449,15 @@ static void write_src(void) } printf("\n"); + /* + * Now that we wrote out the compressed symbol names, restore the + * original names, which are needed in some of the later steps. + */ + for (i = 0; i < table_cnt; i++) { + expand_symbol(table[i]->sym, table[i]->len, buf); + strcpy((char *)table[i]->sym, buf); + } + output_label("kallsyms_markers"); for (i = 0; i < ((table_cnt + 255) >> 8); i++) printf("\t.long\t%u\n", markers[i]); @@ -520,8 +514,7 @@ static void write_src(void) table[i]->addr); exit(EXIT_FAILURE); } - expand_symbol(table[i]->sym, table[i]->len, buf); - printf("\t.long\t%#x /* %s */\n", (int)offset, buf); + printf("\t.long\t%#x /* %s */\n", (int)offset, table[i]->sym); } else if (!symbol_absolute(table[i])) { output_address(table[i]->addr); } else { @@ -536,6 +529,10 @@ static void write_src(void) printf("\n"); } + if (lto_clang) + for (i = 0; i < table_cnt; i++) + cleanup_symbol_name((char *)table[i]->sym); + sort_symbols_by_name(); output_label("kallsyms_seqs_of_names"); for (i = 0; i < table_cnt; i++) From patchwork Wed Mar 8 11:52:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 66163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp287512wrd; Wed, 8 Mar 2023 04:01:08 -0800 (PST) X-Google-Smtp-Source: AK7set/SQQgU+tGw5jDq9QFDglyxoIeWuFIC37y9ZrXEkryxPyYxWvdMUbShHI4bPChQNcz/mcpO X-Received: by 2002:a17:906:9382:b0:8e5:40d0:f831 with SMTP id l2-20020a170906938200b008e540d0f831mr16814952ejx.43.1678276868835; Wed, 08 Mar 2023 04:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678276868; cv=none; d=google.com; s=arc-20160816; b=J9VsRpYUf8pJqJRi1ZGniOi1ZpyheUlbio9XOx/INooEq8JK47p8q/RRF1l+oOZ9t0 bf45IO9L6P/1ALIHOBPBKeDVrrWNVT47ds42SsnkK8lGSCCahbDGMr/dH7uzEZEBYaQu PbYvm6zRGwrSWhqVCuOY6TvVZ1f/B8yChAcnIwKgMKXldB4rlOTp3cVEppuQaB6VYenX CRwDNmypMHShBkGTOXxccYhRHpQP9BNbP6Be/Hd0wWEOOosMno4jJkIFWeXEiZlue6Gr JVkKQyHksCyklFo0JqcnWAKR+/1ds6klWqwsTswAkSQB+h7wSPJea3+zdeKGftj+abVs JnaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uc+aDw2ZeE3U4lIVWj3cQ9b3Cjt78+c8qyI8xQgpqp8=; b=g6M7ZhtUHwKMnejw+sSoeJe2d5Sw8ANz6ss05KtsVY5Snk1OIh3Zr9ANpKGZJU6hh3 isUfCstx43WkIs6JgKaO37mhRWXjPxRrPN5UtQ3phrtC6oMDTdpLvP8cavf5GGQI6z+c svTv8Nk/O5rKbdiGcWnTmG/Q+R/c/moUaXvlZ9RqjZP4IMiDMIrTyqXrAbZHHp/e2mPf eao/hhSpA4mKWjcPejFcboTaI1dFyxz1Qk+0oGe6nrxmwM6CkrL+phEmuA5cH9Nastmu m0SlZ2Mn3BoKC+LJ/587nWjGTY+7MOSe+c/nGfJQ1VDiazsalPXTIF1r1738Rf0ao1AL QqCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r6U9siED; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br10-20020a170906d14a00b008be6648db8asi113917ejb.408.2023.03.08.04.00.45; Wed, 08 Mar 2023 04:01:08 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=r6U9siED; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbjCHLxv (ORCPT + 99 others); Wed, 8 Mar 2023 06:53:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbjCHLxb (ORCPT ); Wed, 8 Mar 2023 06:53:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7510A52F59; Wed, 8 Mar 2023 03:53:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C5ABB81C29; Wed, 8 Mar 2023 11:53:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4362C4339C; Wed, 8 Mar 2023 11:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678276392; bh=RlcQhO5rWzvu7PX3sD59EssaFFcnUCBgUHUQxZyhWsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6U9siEDWTuj0SQayayih0dyDBDWbCu77vDCqqe10QDjsbtKNmOD1An87V5wwo+go FxYNHht+qzF/y8yXmnhB+blJKTnAgvkKSq3Qt9wbGE/E9yllDxAej+3x1O/iqabHUM xqksXI6gtI61p0SNKHgif2V7K4hvd9rgZnN5OZs2TEgCAveqfyihlNjIiSZw/b0b9I Y6Jd/4YJW3ke9f63zwYfUXplFqf+1nndy8psyLVOSrkhFGpFsX1ZS/C4KJuLmfYSiX CoBTakNBvoFVDNloQ+sQokSUH66LkpYiN9tiF9/UwH0dBqpoTPZhDmHlkrVIfErhqT /DYwTyl43djtw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Zhen Lei , Arnd Bergmann , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Tom Rix , llvm@lists.linux.dev Subject: [PATCH 8/8] scripts/kallsyms: update the usage in the comment block Date: Wed, 8 Mar 2023 20:52:43 +0900 Message-Id: <20230308115243.82592-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308115243.82592-1-masahiroy@kernel.org> References: <20230308115243.82592-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759800846066537673?= X-GMAIL-MSGID: =?utf-8?q?1759800846066537673?= Commit 010a0aad39fc ("kallsyms: Correctly sequence symbols when CONFIG_LTO_CLANG=y") added --lto-clang, and updated the usage() function, but not the comment. Update it in the same way. Signed-off-by: Masahiro Yamada Reviewed-by: Nick Desaulniers --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 937900823fa8..0d2db41177b2 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -6,7 +6,7 @@ * of the GNU General Public License, incorporated herein by reference. * * Usage: kallsyms [--all-symbols] [--absolute-percpu] - * [--base-relative] in.map > out.S + * [--base-relative] [--lto-clang] in.map > out.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might