From patchwork Sat Nov 23 16:04:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180107 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886452ilf; Sat, 23 Nov 2019 08:05:25 -0800 (PST) X-Google-Smtp-Source: APXvYqx4f2kPDVRvXlanyU2y8GOQ0no6UexRMK7X0AUfHhA7sR7pC+I+Qka0RJ75jpCe3cjflouU X-Received: by 2002:a50:946b:: with SMTP id q40mr7907244eda.70.1574525125455; Sat, 23 Nov 2019 08:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525125; cv=none; d=google.com; s=arc-20160816; b=fbJUx1SZ7bmPnzPCyUDG9VoMhOlokvLB/HMwL3H91i1gV3ySeSlYsBbwDl7p0VfDY/ f9Zx3fXu+AkSYlHbdIWg9m6twN0Rs/CHPchVz/MvQQDMpugwGjbRI3kb+sw/03BFZ02a 2JN01g5nlHYKQ2Td4AEEvc41sb6muG4wE08NmAJ1C29f1vv9Lvs9urR8AQGfasazulMS VxydRPZclYjOv1UaEqVR/FXOvSxyl1WJaK5fT+JABg4/6gA95XLTkBXbWuvHA/abROfI 2QA3peei/ceTac7axITWNTLjZk9LZAjVSvmgWZWZK0ZJ1/ujr0ZbefvZ/X9GpzNN+NFE PAMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=6aYBJLETzzZ9tKk9VjyP9bE0/hE74dTgHGjrEeWx9tY=; b=uVhhXPmdC36wipzoCyJoPr2hwkR1Cgcm4EWN3pPRpj6LVjEKF/7bte2HE5reYpt6TO EBe0L6Vspk5o7mE4vIPikFYc1JA/Wp+4CMq92Tqiwc02vS/onQ0yrgLGACwdpa3c3Nzx ZDwsjzQZXHkwEjXsJfMmvWDMJU/D7iBqDZWOONtcjn9BmDqXG0oK9YfyoBxELskuI1Xc qm7VbN5r1J5XWsob0zXPDO+IWu5Uk8PCzZFlub8ZWdTkVhIDg/puZz83O2dfyIsIaYq5 MwzKu09xYUJGqFBCaKovNxHRZAeFM9b2W+FxGtLcoh+KS6J0+Yu+cCoH6qk2cAWkI6c/ Ge0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=N7FL27dA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dt11si952344ejb.126.2019.11.23.08.05.25; Sat, 23 Nov 2019 08:05:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=N7FL27dA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726962AbfKWQFC (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:02 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49448 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5I019106; Sun, 24 Nov 2019 01:04:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5I019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525088; bh=6aYBJLETzzZ9tKk9VjyP9bE0/hE74dTgHGjrEeWx9tY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7FL27dA/kBwCUd2PiBYIDy2zn0eXNV0eFrD9GtjMz/7rjD/f+UGAV1/F9JwuYckj 7YnV9+dRizG4tIHpkPqPmdhqenRw6KOj9pO+ZsFtJ5M5pAuhMOttzkV1/y9CpJPVf7 xwerW59vgpNG13UM0Ci/y9v0ba1HtJGD4wFxr3mE+yDGnAKEQh0jK1GZyjK47N6Sws jJaJ/DNQMHmfRrZP6MNkB6JBRuBnT7iJfphGkcfaM9ulj3ex4FJZ6JGzVSVXMwP3+A 046/QJQ2F8xrsv1/wSnqdGZpw2qjFDXRQRT/iDW8Ch5K3FhotK5XvhTiINI2tSuryN oDbPZ4skevYFw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 01/16] scripts/kallsyms: remove unneeded #ifndef ARRAY_SIZE Date: Sun, 24 Nov 2019 01:04:29 +0900 Message-Id: <20191123160444.11251-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is not defined in the standard headers. #ifndef is unneeded. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 2 -- 1 file changed, 2 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ae6504d07fd6..918c2ba071b5 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -24,9 +24,7 @@ #include #include -#ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) -#endif #define KSYM_NAME_LEN 128 From patchwork Sat Nov 23 16:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180102 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886042ilf; Sat, 23 Nov 2019 08:05:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwBnKIt5DDvPYioNq/Qfb1sxE6cd21OZ9neYHINFwBjD5xjYh2OAG7BtU66EbEhZYPXwFik X-Received: by 2002:a17:907:20d2:: with SMTP id qq18mr27797301ejb.305.1574525107959; Sat, 23 Nov 2019 08:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525107; cv=none; d=google.com; s=arc-20160816; b=UD+A3DhobWlHcbN7NvfrFYYzdln1ePWbacwi7L3GFIi6ao2HZbPEgryx1/8Xo1OS5A h/WYkI9ZNwteRAlwLOzl8RrvXA8cjK/asBku5UuWCtRueZhpcM6OALX77JNgtAolxL4c bwV9RUB9fjjYLH7RSLjyncEGhRsZfyvK44/bS+Sq9BVkpx0i0DAK+VeT8RqLtrO9e/rN ky0aUYdsGN2Nc9pzBdNgPjUPVnSmwARZuG3cjnyaQwdMwYb+9M/+vT0Md4dpU0eG+PZ6 rl4XGyuZh08vRfhbUjiVinqBIJhMUwlssGUCKlSJB1h/4qzjm+QRCyCiYrLGjCoLWlwc aYhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=WZZFA6dol6oYL7xPQCp9izlpiyCZuwW4132+Q9wwKac=; b=aRQYIzYyxbeJrEmlCMpJisHLX3zO5RUB2Rl9WtKsBsbTZU+th1Elq8IbusULE5KQLd anGusjYGnEYm8Dr++v+OR9lpga38sfJKRU/ZcJlrETr7X2MBdJSYn1xuYAbCQevybev/ 3FXnEIWTPzIEWCAMoS0QBFUWXRnjzqWJNmybP9rq0ZrwTklrzbAUdpyREvl9niVyYe39 LRwqX8IdPogT7m5MGW9DTrdKtjb9+emGggTzthQ0rPB6XL255aieO7by5cxRqUKQPHWq 9NygyWsaq07AHbQHqELmk0E+VH6kLAkM148FCySBtyBB5uTkoItNuYOTpEYGkdYGPLIX kOnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gp4THjHF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si1068885eds.39.2019.11.23.08.05.07; Sat, 23 Nov 2019 08:05:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gp4THjHF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726922AbfKWQFC (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:02 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49444 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5J019106; Sun, 24 Nov 2019 01:04:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5J019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525088; bh=WZZFA6dol6oYL7xPQCp9izlpiyCZuwW4132+Q9wwKac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gp4THjHFa0mPASPXe10mzi1lw1vjiNOyzebQLbBxg6WwQ0kO7VHCfoqqbGMIBZ2bu ogDa4JhABiSWOBlP+etmaJ9AohyLKDBDrRp8otdiZYPFKwWTf9mhlpg5rw5mVW3uVr Sxf/26CmgGYt9CEmrqvYZSCN2TWjMr7BzN0XF4Fvl6uEWRQeQMmVZ2fvFwWcI5o4co 8dpDv2r1GXrNk0PlCLB83+75aX+UoeVyTxcO80XO7c0ob7t2C82GQ7Pmsb/Ed29XIU jEqGT6qVp3PcbryuBq1vnV/vd/N3UoIkCd0F7037ct8HA+v6gRTMUSpErkG7pRkpLK FINV9xO1FxSUw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/16] scripts/kallsyms: fix definitely-lost memory leak Date: Sun, 24 Nov 2019 01:04:30 +0900 Message-Id: <20191123160444.11251-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org build_initial_tok_table() overwrites unused sym_entry to shrink the table size. Before the entry is overwritten, table[i].sym must be freed since it is malloc'ed data. This fixes the 'definitely lost' report from valgrind. I ran valgrind against x86_64_defconfig of v5.4-rc8 kernel, and here is the summary: [Before the fix] LEAK SUMMARY: definitely lost: 53,184 bytes in 2,874 blocks [After the fix] LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 918c2ba071b5..79641874d860 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -487,6 +487,8 @@ static void build_initial_tok_table(void) table[pos] = table[i]; learn_symbol(table[pos].sym, table[pos].len); pos++; + } else { + free(table[i].sym); } } table_cnt = pos; From patchwork Sat Nov 23 16:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180109 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886622ilf; Sat, 23 Nov 2019 08:05:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwU01XY7uxco/9l01+TlEyWJNBj4XN/WvEJXR+eUcQai/vqK9Lo7mTxYLsqXOgpR5cmAgdf X-Received: by 2002:a17:906:709:: with SMTP id y9mr26943873ejb.321.1574525133824; Sat, 23 Nov 2019 08:05:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525133; cv=none; d=google.com; s=arc-20160816; b=UUU1C56kkVzPRxn1SfvcgeFO7qjWuTxzEmtDP+OO97mfiahv4aVpsu+sTKwAZl5yGf q2vl6UhCHc2qrmNuQPupYdIhl83Wawq8FrdhYNVcCVQ5gmd3SfRRLSEzhZ7HZUy9rSxi 9BjlQ27qsLBKvFYgO1laEl/I6jcGd8Md2rylwHXMb2beDAssffbVaj35XyhKcEa0W2e3 x6sXYRjkd57ZDeE1FA11cmBbJeAYieTkAdSAGACXnN3/sthTBSXWe/72FmKjxgnrfouS QlJyYATqZN2m5/hKB6nuhx0x58gy0zNDnHx0JPYAC31xM597qzbiUt/vgA1iCS4Lq+Zu cNBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=NiWcGoRSkJ1ToZ+rAR8uqUuIB/kFxxkQ/T4OsoV5GoA=; b=fDx37KEBZtxx9YFntAKABkX5R03+BOBUlpLAS+IuMxe3Rlzkb57e/LDd+8JlrWsui9 Q6eV773ZZBdLMklPkK7AAgc65rEf5VFMBfBu0CQkDA2Fu79R2oHce55PnYzIGH6227u2 rsz+Yu8lXTUOz+kq0MnmXJW3TLChE1XXrJoB+6FzdtVY9ROSb9nxbTQLcdKUDYupSNtx YZMbLbrawag/w/o7P5dkL7UdEhUqjZM76d1gI/NeOWgMTOSGzMcP0iujh2M1ojfvDjG5 Q/Y5R6yh8D9cZSlq2Wsraz4IZDSfsv/x1jysKsg0VD0hx8pmDzjNJH6u/+TGLObE4MpD vAQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="v/+rqumx"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si999308ejb.257.2019.11.23.08.05.33; Sat, 23 Nov 2019 08:05:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="v/+rqumx"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbfKWQF2 (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:28 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49454 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5K019106; Sun, 24 Nov 2019 01:04:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5K019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525089; bh=NiWcGoRSkJ1ToZ+rAR8uqUuIB/kFxxkQ/T4OsoV5GoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/+rqumxnqCo8borqbNoOmcZ+UTQtLFg9D1qGgnjRgnSouqHHc8n+EmdrhMdd/HG1 LTZG0bOtEcXsaKegzYSDoSJ9D6cBGbuDElcmL24fG9g8ERHI6eVZchYbdbMnEkOjr4 Mz8qVFnTNoOExJsgK+Nw7rpQyTkVCH8TczsWzVdKRgYXpo6cZPAXkWByCJWKKfCDKF q1KwHmqmf8oBI8eC8AYyteryM5oIzT8fiyF5VdSd9CLAvMohFnyE1cQndL0HCn7m36 AILp2k/NrjHd2qkW3lwRoRMFZ08O/XD9r673m7i8elxA+cizFjNIP0xR2ASKgmM1wJ tyj9amgzO1hQA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/16] scripts/kallsyms: shrink table before sorting it Date: Sun, 24 Nov 2019 01:04:31 +0900 Message-Id: <20191123160444.11251-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, build_initial_tok_table() trims unused symbols, which is called after sort_symbol(). It is not efficient to sort the huge table that contains unused entries. Shrink the table before sorting it. Signed-off-by: Masahiro Yamada --- Changes in v2: - New patch scripts/kallsyms.c | 49 +++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 20 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 79641874d860..de986eda41a6 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -268,6 +268,30 @@ static int symbol_valid(struct sym_entry *s) return 1; } +/* remove all the invalid symbols from the table */ +static void shrink_table(void) +{ + unsigned int i, pos; + + pos = 0; + for (i = 0; i < table_cnt; i++) { + if (symbol_valid(&table[i])) { + if (pos != i) + table[pos] = table[i]; + pos++; + } else { + free(table[i].sym); + } + } + table_cnt = pos; + + /* When valid symbol is not registered, exit to error */ + if (!table_cnt) { + fprintf(stderr, "No valid symbol.\n"); + exit(1); + } +} + static void read_map(FILE *in) { while (!feof(in)) { @@ -475,23 +499,13 @@ static void forget_symbol(unsigned char *symbol, int len) token_profit[ symbol[i] + (symbol[i + 1] << 8) ]--; } -/* remove all the invalid symbols from the table and do the initial token count */ +/* do the initial token count */ static void build_initial_tok_table(void) { - unsigned int i, pos; + unsigned int i; - pos = 0; - for (i = 0; i < table_cnt; i++) { - if ( symbol_valid(&table[i]) ) { - if (pos != i) - table[pos] = table[i]; - learn_symbol(table[pos].sym, table[pos].len); - pos++; - } else { - free(table[i].sym); - } - } - table_cnt = pos; + for (i = 0; i < table_cnt; i++) + learn_symbol(table[i].sym, table[i].len); } static void *find_token(unsigned char *str, int len, unsigned char *token) @@ -614,12 +628,6 @@ static void optimize_token_table(void) insert_real_symbols_in_table(); - /* When valid symbol is not registered, exit to error */ - if (!table_cnt) { - fprintf(stderr, "No valid symbol.\n"); - exit(1); - } - optimize_result(); } @@ -756,6 +764,7 @@ int main(int argc, char **argv) usage(); read_map(stdin); + shrink_table(); if (absolute_percpu) make_percpus_absolute(); if (base_relative) From patchwork Sat Nov 23 16:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180112 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886834ilf; Sat, 23 Nov 2019 08:05:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxEHW726enxoyNjUu390VyadDTijJa9vKK6dkgHDpNrRjTtNpllJa0fXCeDHwvYKi7Rm95V X-Received: by 2002:a50:fc18:: with SMTP id i24mr7837218edr.41.1574525143469; Sat, 23 Nov 2019 08:05:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525143; cv=none; d=google.com; s=arc-20160816; b=tdF28EjE4101+ZQTfKK27t4FLKpnYU/WVUzMrEDRghpQSSommDpxLBLdy7LGRzEkdK VRV9oqymfymavntOoUb8ytEjrzVnXJjiyNeulnir0EHYOSXh9dl3A4xcrJ1w1iKXy+op kPA16k0nnV+qEW1cJhZvW422igG6Mew0E0a7zeuKzqulEWayQiKvewvEztPKQxOTdA73 lq0M7Cj1O/U+ekxWZDc3c79onbotNBtyypmjMKdyINiU4gUPx3WKS9huRaVvNgvh01q5 of43X9oJLoZIhfRVokivgb+EZH7lrfjPln+Oi1QLN+mb8e/CuWgguaguGpfIbRUuGm2I b8tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=jnfvjcB5kg6ke5illdITerqCOO0i1ll9kEjlHRPbqGY=; b=pgbpfZhLmZ4m8H4Kleyu3AEgmn5rug2KKdMXqD4YI4978njME34iyfXPhvy9DuO7qq /F5eGuZrzHfAn+qdew4qETmvwUahufb4xrYgbKsgqdDyEYPWIvlLKuWqrXTR5IY/d7SP 7BB2b8achXA13b7lOopwcxD/+xy5QytkVysx6hrP1wpjil2AAqym+0XT/q3/jLwseF7L XAjm06W76+vDezzBSj+1dvHTOgRN9Roxr7yxhZAstIIqjQAouY1KAygbj0McilEMtl/2 sAb03JcsmSGDsvEJFk1f+xothCwiyhxEw7fXzRajJMP1nwJL4a71hrrrjxO00MOdt+pa IRkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FV5lkNil; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn4si970396ejb.329.2019.11.23.08.05.43; Sat, 23 Nov 2019 08:05:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FV5lkNil; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbfKWQFh (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:37 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49450 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5L019106; Sun, 24 Nov 2019 01:04:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5L019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525089; bh=jnfvjcB5kg6ke5illdITerqCOO0i1ll9kEjlHRPbqGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FV5lkNildmiiTubSxu06HhEHVwMSCweueZUvG39cNL4RC+2Y06tdbNeQ+n+4gIaOg mz8MvphMJNMQaJ77fuMEifS//aXw4yo9HUy9PjOK82SF5/FeffaWpAEqSIioZyKuh0 SoT0F1o60PUaujqnJDfQzyD5tLAVkUiJZycvr0+EieuQSf3oV4PUUYx1cGCNrl1bRN eryi/OfaiFCnoN0acxhAdZaF1H/VIl10EbSswtRhbbZZTi9aYciQdPd20LgXXIguiu Eh+B3GeDep7xVK/CPK2XKiNMlqnp520LumaCkvxPLZLcXnmCmjjN1+FY52EYIy2b2U 8vhLr9bI/+LkQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 04/16] scripts/kallsyms: set relative_base more effectively Date: Sun, 24 Nov 2019 01:04:32 +0900 Message-Id: <20191123160444.11251-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, record_relative_base() iterates over the entire table to find the minimum address, but it is not efficient because we sort the table anyway. After sort_symbol(), the table is sorted by address. (kallsyms parses the 'nm -n' output, so the data is already sorted by address, but this commit does not rely on it.) Move record_relative_base() after sort_symbols(), and take the first non-absolute symbol value. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index de986eda41a6..c9efb67c6ecb 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -739,11 +739,15 @@ static void record_relative_base(void) { unsigned int i; - relative_base = -1ULL; for (i = 0; i < table_cnt; i++) - if (!symbol_absolute(&table[i]) && - table[i].addr < relative_base) + if (!symbol_absolute(&table[i])) { + /* + * The table is sorted by address. + * Take the first non-absolute symbol value. + */ relative_base = table[i].addr; + return; + } } int main(int argc, char **argv) @@ -767,9 +771,9 @@ int main(int argc, char **argv) shrink_table(); if (absolute_percpu) make_percpus_absolute(); + sort_symbols(); if (base_relative) record_relative_base(); - sort_symbols(); optimize_token_table(); write_src(); From patchwork Sat Nov 23 16:04:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180105 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886235ilf; Sat, 23 Nov 2019 08:05:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyp/siQpYhHAprelFKodijncV/UazpL/P+znzTPPLXgtOf52BdQ48oc/12WiwnnjLph4q+V X-Received: by 2002:aa7:d147:: with SMTP id r7mr7948618edo.198.1574525116730; Sat, 23 Nov 2019 08:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525116; cv=none; d=google.com; s=arc-20160816; b=dat4UbPVuRe0oKGt98QxCnJIMPUochi9bjwkrU02ABTkPCB1kE0khiR5XDNH8ITOb6 eQ/zU4yO3qSPh2SakoPOPkcEARf4gjQwUBMwhh4m10cU2wGPCCMCjpqhs7hnm0oheK5B kbgbBFpKW+nY83AVfy3wtVH27oBQFSJxYMAVZuT3FsyWPljC6h/TPG86rKEfZgf51DRc 5AUySntG0UmRaj29UmRhMT/Zsv3HAdMLNZYnmauN6bLmmuDUx6NFOXnBeYnDJoVVzMel lmram2GlMAaD3Gu1oEf8Ej1sPwZfjeUEQC819BBqMZGi/avPEnP7L7++VMkqRgFZf276 /LlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=IIQsi1izm8K/GBPuGItQbp2rWTEbFo+vUJb/JZsPBDI=; b=m6uZrtH41dQpkwFwqvGOBsW84oSY7nkm1G6NimzBB/YSXfiC89Kr9Zgkk0bGYzl3x+ gsaipdzjbTPpjrPwtWrabQ9TsEvMXK0XxvMV7o7daGTSL0M0OqBcrjU0s1V9JiLEEj4o BcmtbD8yF8VjGKWR/Emt49T/pXTg1l42grdiaWjgSlyyDps0gxWJYYve+hO3z5dFVffu BahHEAUvMJFLowqg0boxfmGJjgCdnnAU2v+xKkITeqgnubo2RyJaUFl+dgSHACpszxv8 WHajvOaznJbqIb53GiEfXlqah81gMG3Iqyon54eadOzzBZ85e6Bkwdc2qacxpZRYwZe8 +u9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GbAAVpbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si942944ejb.296.2019.11.23.08.05.16; Sat, 23 Nov 2019 08:05:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GbAAVpbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727059AbfKWQFJ (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:09 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49493 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbfKWQFD (ORCPT ); Sat, 23 Nov 2019 11:05:03 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5M019106; Sun, 24 Nov 2019 01:04:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5M019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525090; bh=IIQsi1izm8K/GBPuGItQbp2rWTEbFo+vUJb/JZsPBDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GbAAVpbgjzpdtjqkO8wl3cJej1h/ITGS5yHcTf9awSi3XY26RsKP4Ki1jX1rnYzIB JH7UZ3e472ol+0QSqmBjgH/huyJdnyIPiByIYYeiIxQkWEEGrkiQ38gzRS35nc+UVy RALjM0UoNDh1KduT0bwIMM9ndb6vfMucqhI5QbIPA7RlZZVlZy8VxIdUOxPThnKYRv SVJ0Du52HgWW/ypuwRfhoBLbp71ZzmHo3Jox4VR/mez9NfogoksbeiE7PMYP4yq1oA 91XXY7FZ+1wVOhUreeYPH7vMkSo8M6ezucg8MS2KuM10OmvPvB2eEV4NXzpxBasSPT suh+56AJBy2xQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 05/16] scripts/kallsyms: remove redundant is_arm_mapping_symbol() Date: Sun, 24 Nov 2019 01:04:33 +0900 Message-Id: <20191123160444.11251-6-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 6f00df24ee39 ("[PATCH] Strip local symbols from kallsyms"), all symbols starting '$' are ignored. is_arm_mapping_symbol() particularly ignores $a, $t, etc. but it is redundant. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c9efb67c6ecb..14a50c8d3f34 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -74,16 +74,6 @@ static void usage(void) exit(1); } -/* - * This ignores the intensely annoying "mapping symbols" found - * in ARM ELF files: $a, $t and $d. - */ -static int is_arm_mapping_symbol(const char *str) -{ - return str[0] == '$' && strchr("axtd", str[1]) - && (str[2] == '\0' || str[2] == '.'); -} - static int check_symbol_range(const char *sym, unsigned long long addr, struct addr_range *ranges, int entries) { @@ -139,10 +129,13 @@ static int read_symbol(FILE *in, struct sym_entry *s) return -1; } - else if (toupper(stype) == 'U' || - is_arm_mapping_symbol(sym)) + else if (toupper(stype) == 'U') return -1; - /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ + /* + * Ignore generated symbols such as: + * - mapping symbols in ARM ELF files ($a, $t, and $d) + * - MIPS ELF local symbols ($L123 instead of .L123) + */ else if (sym[0] == '$') return -1; /* exclude debugging symbols */ From patchwork Sat Nov 23 16:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180117 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp887188ilf; Sat, 23 Nov 2019 08:05:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyvdlZGk68fxGbC9o5P3B4bff3sXCyQ4S2rdBBBId9v06EptmYaFeMPi2+XLWVl97t5FoCR X-Received: by 2002:aa7:cf19:: with SMTP id a25mr1235279edy.237.1574525159540; Sat, 23 Nov 2019 08:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525159; cv=none; d=google.com; s=arc-20160816; b=bNxpKjMy9UgIJA1rx/5UBJvE/cl1kPDQBaQTeprN6YrDYxL8j7MXmrILBQWagsmYKs JAT4zA5z+/KrdJqSMpP6uGtEU1SzXqNBp3KFcCK996TGLXZXyPAvfSJyZUSCBzKkIx+T mXVfpgkFZJb4DvvmjSu+WNovJyo6IdHLXq0rySJ7dMn/i+DtDTAHJiF5TpAsyrIReDdk +Yt6r1jQVMkBfa0fvlGQNM64AQOi182R+TqyXRxkJreFWUfQ8vLsVCcpY1nM/4ugF0xF o5bqHY7PTpmztG8BV2DpS1TKrBoy3acsPJHPWqRGyfzcWdMgwcwpYoY7/VXMd37TBZKU jueQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=lxCDJ/TzRamerzIHNtq7hRwp1rjH2y4uMZMCuV7ILJg=; b=DMELAzAMnBFsNg22/UO1vu1MUmAKbO6pQzgCebkFnMCW7giRXwBVcfB83ctF80Sqil V423P+U6ZdIzFYJY/Uj7qDfWMiCerlihJLI0P6savWUVp/ancgn9RDPdJPZA7wHr1cjK E3zbGNuGgIOWdGco255IOzQ9/KgF0KRw3MpQ5Jv9OZbaW1jy1ZM74pTzpMGR1EIjxTKi IogoTjDGOIf6Eb7sntQxAftuRNbeL74nW298E9KFDt0z9xxagyGAs2yYVZ62GLujGaRp UoPuxmPZ72XEr42FuBZHdVz9SQPLfx0ghmbMOdEKR8S1kzVgvpy2GADjPAPuOK8a38qT 88iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vIz5p4JA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bt28si1019271edb.270.2019.11.23.08.05.59; Sat, 23 Nov 2019 08:05:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vIz5p4JA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727258AbfKWQFv (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:51 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49451 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5N019106; Sun, 24 Nov 2019 01:04:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5N019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525090; bh=lxCDJ/TzRamerzIHNtq7hRwp1rjH2y4uMZMCuV7ILJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIz5p4JABWr2ukQchXCPsHDjkp9lot5DP65ulXNWDBNpkGwr6lpe3sbq6Wq6h4yUI CTPa8hO/pnYsxUW3L8QgPtlW9oPaihXyL0Gyu/M+fwXVTWl+KLNf2L6nkLWQSQvnca MRU4S7CXku89X7hLsHUgk4eyDKmlJw2c011IZ2EHIMKrSgoolLDKHb+B4LqhxYC62V znZ4YrKLWyyp0UEoJXzZHMoMBEyNxQx76fFp+X1gCzi1bHwQABbJjyNZZ/1bvIh002 I6SA7YmkDoKKqLoqCL2L2Uurq/XlPmQXHbR4DAygejWWjInPiAO4yvoJXfV4KbL4Zy HI8R+OWSJ+hJQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 06/16] scripts/kallsyms: remove unneeded length check for prefix matching Date: Sun, 24 Nov 2019 01:04:34 +0900 Message-Id: <20191123160444.11251-7-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org l <= strlen(sym_name) is unnecessary for prefix matching. strncmp() will do. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 14a50c8d3f34..a57636c6f84f 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -246,8 +246,7 @@ static int symbol_valid(struct sym_entry *s) for (i = 0; special_prefixes[i]; i++) { int l = strlen(special_prefixes[i]); - if (l <= strlen(sym_name) && - strncmp(sym_name, special_prefixes[i], l) == 0) + if (strncmp(sym_name, special_prefixes[i], l) == 0) return 0; } From patchwork Sat Nov 23 16:04:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180106 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886249ilf; Sat, 23 Nov 2019 08:05:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyRVz6pD4/SlOc9l3xxfgSdfsZq2UWilurpz9cA01evokxJoyfnj1dmZo3qmUtMcdO/vi1v X-Received: by 2002:a50:f284:: with SMTP id f4mr7771800edm.126.1574525117592; Sat, 23 Nov 2019 08:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525117; cv=none; d=google.com; s=arc-20160816; b=bOTQV0wa//ICLAwwDt5rW/NCzYE8rwOtggbNg5Hh5rstVfmcw/o9LuJPad76bnjb0n 9cwkJ6UGVBo3Sc5X20Gt0NQ/FH3tvlRqnxUQZUDUpD9TmCgqhGyhYs7N0rVKQu8Wy/ga /s1YqJogfpUMLxyHSJF14qhrQJ8H3i3i5XcBXV7dVDHir4JgMFOR82eguszSG0/wKkfD JTFF2uOGNCXvwSE8DRyNLt4H23RR9Yxi3euX+qLrMy44T3+7sZIpvnFG4zhwm7bbCEA1 vgEHxnVkgRugzgNgvy5LD4Ukk+QzevU4d4tcSLie7sPIptklsA+7bQYhVz1bJoHPsliX 7DjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=5gU5mTeXomynZztjP51R9lorDaBP4CN8eEVudih4LaA=; b=JEBUBW1a3F/ZMUvXoZD4GrrJPRrUTIBm/erUTLqRSi/Rbb5T4+YuJONqIB9nz/cX5R a20WIM1FEPqggtO0MaeKWqVYO9GCEeNneu1oNY8yZlCoFrk6UMJVsPKctfk4p0npz3Ci 8L7/7fmhJxBsgiEJcLrQI1QtmD3vjatwSr1/v9Wrk1bH56l50av5U6WRZO/NrGTdakc+ VvifWa4GqrpQvEiJy+0OYNttPuDpUXihic+ANWPN+givAkWY6DChB0205ndFUE47PFq5 Rvgo7JzF53Pfk78FCnmOA4r11rcLBpa1sDgU+LSQRNFp5tozygihhAgDHCgUlLG14fxV vusQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dhx5Vk9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si942944ejb.296.2019.11.23.08.05.17; Sat, 23 Nov 2019 08:05:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=dhx5Vk9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbfKWQFO (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:14 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49458 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5O019106; Sun, 24 Nov 2019 01:04:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5O019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525091; bh=5gU5mTeXomynZztjP51R9lorDaBP4CN8eEVudih4LaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhx5Vk9AJvt0Op2JB+kGtg0JPl6yuizFEzP+J8nR3M6CG2ZT56IpztMeEFwO6OOLf oJ6F/BApszEqr4AoIcxPwc29Hcnoiyqm/dTqaZT2pdozhZzjLUaA9M7S+3V5h/teJ1 D/zZtLXvacAovXuzOf3QAD8EgXNUw7GVQOzZOUA04K/BdFZF04AF2md3VjV2sZMcNG M9nKpTZhatL0W7ztKYxo6dFd1/Sho4ayXi6hO4RQlVn9BOL8XWyaX52AnRuo+8Cz8r PbrifJL0hvV8kP5gHiwG3n/VDQT4eIs0th3hY4bxYiFo/khTfYWmcrk0qQZhnsfN6L ZQojm/CsRlllw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 07/16] scripts/kallsyms: add sym_name() to mitigate cast ugliness Date: Sun, 24 Nov 2019 01:04:35 +0900 Message-Id: <20191123160444.11251-8-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sym_entry::sym is (unsigned char *) instead of (char *) because kallsyms exploits the MSB for compression, and the characters are used as the index of token_profit array. However, it requires casting (unsigned char *) to (char *) in some places since standard library functions such as strcmp(), strlen() expect (char *). Introduce a new helper, sym_name(), which advances the given pointer by 1 and casts it to (char *). Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index a57636c6f84f..baa2fa5692b0 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -74,6 +74,11 @@ static void usage(void) exit(1); } +static char *sym_name(const struct sym_entry *s) +{ + return (char *)s->sym + 1; +} + static int check_symbol_range(const char *sym, unsigned long long addr, struct addr_range *ranges, int entries) { @@ -154,7 +159,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) "unable to allocate required amount of memory\n"); exit(EXIT_FAILURE); } - strcpy((char *)s->sym + 1, sym); + strcpy(sym_name(s), sym); s->sym[0] = stype; s->percpu_absolute = 0; @@ -215,7 +220,7 @@ static int symbol_valid(struct sym_entry *s) NULL }; int i; - char *sym_name = (char *)s->sym + 1; + const char *name = sym_name(s); /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ @@ -230,30 +235,28 @@ static int symbol_valid(struct sym_entry *s) * rules. */ if ((s->addr == text_range_text->end && - strcmp(sym_name, - text_range_text->end_sym)) || + strcmp(name, text_range_text->end_sym)) || (s->addr == text_range_inittext->end && - strcmp(sym_name, - text_range_inittext->end_sym))) + strcmp(name, text_range_inittext->end_sym))) return 0; } /* Exclude symbols which vary between passes. */ for (i = 0; special_symbols[i]; i++) - if (strcmp(sym_name, special_symbols[i]) == 0) + if (strcmp(name, special_symbols[i]) == 0) return 0; for (i = 0; special_prefixes[i]; i++) { int l = strlen(special_prefixes[i]); - if (strncmp(sym_name, special_prefixes[i], l) == 0) + if (strncmp(name, special_prefixes[i], l) == 0) return 0; } for (i = 0; special_suffixes[i]; i++) { - int l = strlen(sym_name) - strlen(special_suffixes[i]); + int l = strlen(name) - strlen(special_suffixes[i]); - if (l >= 0 && strcmp(sym_name + l, special_suffixes[i]) == 0) + if (l >= 0 && strcmp(name + l, special_suffixes[i]) == 0) return 0; } @@ -626,7 +629,7 @@ static void optimize_token_table(void) /* guess for "linker script provide" symbol */ static int may_be_linker_script_provide_symbol(const struct sym_entry *se) { - const char *symbol = (char *)se->sym + 1; + const char *symbol = sym_name(se); int len = se->len - 1; if (len < 8) @@ -696,8 +699,8 @@ static int compare_symbols(const void *a, const void *b) return wa - wb; /* sort by the number of prefix underscores */ - wa = prefix_underscores_count((const char *)sa->sym + 1); - wb = prefix_underscores_count((const char *)sb->sym + 1); + wa = prefix_underscores_count(sym_name(sa)); + wb = prefix_underscores_count(sym_name(sb)); if (wa != wb) return wa - wb; From patchwork Sat Nov 23 16:04:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180101 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886032ilf; Sat, 23 Nov 2019 08:05:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyd0BLRPdV9PMv6g1r0I8JocRi/ObEZ/pGdzWOVCot4DJCbeqHWPbzvXSXA9gTTiIVE9blU X-Received: by 2002:a05:6402:184e:: with SMTP id v14mr7804884edy.138.1574525107482; Sat, 23 Nov 2019 08:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525107; cv=none; d=google.com; s=arc-20160816; b=iZ6dgBCJlaHmwV5EJgE/dTt3YZkTVEkh+ZhXtTm2Jj1WT/Bz6XcprDmJ7VdVsFcVo+ KPO5nYnQNPM+5CCxZUzOVJpSQiRFweZvISJCR1Haqi4me+mMwVJIIJ6Ctb7JCB4W7bHu zFmEnOohTEvZv+68sL1wM9+c+vHtz3QcgPjw1waYb2usP0im7Equ7ypUOIQ1MO/fHiu+ BunWHjyh3WuV8x5XzIPVbdzzr3PUVpI3eTa7q695QRms7SfEayYoOv9ydIUpMQtqYCig c97OJanoBQjl7CHN9GoSKlu0apRlWWkgJ5QycsISSAEKgug1VOclNUNt45zA7MwMi6cS eaAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=5lggXg5IEg7tnVaBbwPVhFClDCwiRJJs4nnaP/eGSlc=; b=sYRxgxQ3TgDQ8neqWbM288jDSKvBhzZimhzrZ0xYCiMIyLA6DHSAFntVcm/9DeaBjF bYLWsrfrclKLswguKWEJ3Izde8BZR6H/mCW0T1sXQa78iH8gPlFpl+nqDPtni0xODwuY FlmFQ4lZZFC4ASuNyIc5tHwEwQpji2mIEoDjXOHUNcObErTimu7sukUXHncjWhAN6xRw aCLnIbcdF9hId5Sk946Au85U/IU0BquX9OcBOA2aObcK6MJCUS4YzIG/tqMj7CP4jfFZ RilbvHkVOx50N5A2L3emD14RqQT9+wlyjEy/VdOclWUmDcCs3TgDIYii0mnLXJVDMKOe 0joA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VwmXuzPh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si1068885eds.39.2019.11.23.08.05.06; Sat, 23 Nov 2019 08:05:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VwmXuzPh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbfKWQFD (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:03 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49445 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5P019106; Sun, 24 Nov 2019 01:04:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5P019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525091; bh=5lggXg5IEg7tnVaBbwPVhFClDCwiRJJs4nnaP/eGSlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VwmXuzPhD1uessmiV+Ruu8F6Y+D7MZ687YsdNBGIvHKg70mg4Cx3SfLSORXOhsTJv Xt6pGQ9lYlHZ0xdSJx03kM/pNj/PFozWAbmMrXm9S+lnwRAsDv4jHBoFj1YFjeCbto i/1MPAf1c4xLkNrE+HzM78xumNwG+c3Fo5UjVLZkTojpicyMZ5nZ9P/bGCknI05A6H qPkuQ6oNJTO0J6Q6kXy2/5IVMwM0Uai2H6LxNdL4D2WsQm6MdCgEqN4D3rV2uCRH3w N1MEH7SSDC7WI+BqjqZ7c49dYRM9Eevk3iPhm+V28EWvBQjbIVzBTEo0FcMOsHntDI dUS9rNz6/YCdw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 08/16] scripts/kallsyms: replace prefix_underscores_count() with strspn() Date: Sun, 24 Nov 2019 01:04:36 +0900 Message-Id: <20191123160444.11251-9-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org You can do equivalent things with strspn(). I do not see noticeable performance difference. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index baa2fa5692b0..89cc7c098c51 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -661,16 +661,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se) return 0; } -static int prefix_underscores_count(const char *str) -{ - const char *tail = str; - - while (*tail == '_') - tail++; - - return tail - str; -} - static int compare_symbols(const void *a, const void *b) { const struct sym_entry *sa; @@ -699,8 +689,8 @@ static int compare_symbols(const void *a, const void *b) return wa - wb; /* sort by the number of prefix underscores */ - wa = prefix_underscores_count(sym_name(sa)); - wb = prefix_underscores_count(sym_name(sb)); + wa = strspn(sym_name(sa), "_"); + wb = strspn(sym_name(sb), "_"); if (wa != wb) return wa - wb; From patchwork Sat Nov 23 16:04:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180114 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp887021ilf; Sat, 23 Nov 2019 08:05:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyToRczzVzmPBEiNPkDab5h3P0ZTstHs7bAnfjhqkTMYy9i8SrDI/0axTYCqPew4G4IJDEt X-Received: by 2002:a17:906:5604:: with SMTP id f4mr1832513ejq.255.1574525152133; Sat, 23 Nov 2019 08:05:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525152; cv=none; d=google.com; s=arc-20160816; b=jA4FJWEfebWdFbveQcDA27oH+7ab79yF74cx1RQYS1Crsgz5WFi4dHUxUb9M1UZ2YC lkb2pT34boTs+WM1mfTNud9LWJtlitt+vCnRMNLhzDHt0Ku9xPsIh1vU/6lttcOo7fw8 XXgjeDwaT28PwnwEL5Lg2da/9asy+vyk/ML6Scg6eLEZoZLVxrlL0Thw4ekow/fVijuP kQ4I4iTh/vwfxWVUjYkkJ0210nVH9QwRx0abXhCVgTyAKp4TWGUsqnwpmY9n86taEByK Qq9+CqeV5Glj1AvC17cQnuqoCA1CoktGyvVZTsFKjuL4fr9H88vbJlzf7GXFLFHqR6Uk pqIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=ST5LRkJJeHH7On7Bbq1YlVG0Rs9L/Y4/DythexYfliU=; b=Filja+BfKbAlOAR00CeFqr3oiVv4mPLbnWynG6S6559zJj8BZMhzFUkL82t6e0dlgi dU84mSok+ppEebdiUMkT8ZnsMt2sd9pjAGHYDqRoAs0oVm6qD/Dn/QMzVVd7AuWg4Yj2 zQXJ3k+UOdptgABChX7xRiH0LUTxt/gDtWxrHFBTN4I2vSmMKMX4GGkJBPyzGoprLwQa PhfelgGc0qnPOwGjcpCFbQZrBsGsGOYaQVYfqOQfOpKdRjTbw/lDrx8nEUIle+mvlyEd KJX+BjTwE5aeLUY+V+u8ld+RDzzGhz9Pj9VNNGqEEkklamE7Sh20iJfA4jFPH4w0oiq3 pORA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NQSJuzMy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i14si1057566edr.68.2019.11.23.08.05.51; Sat, 23 Nov 2019 08:05:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=NQSJuzMy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727233AbfKWQFq (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:46 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49446 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5Q019106; Sun, 24 Nov 2019 01:04:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5Q019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525092; bh=ST5LRkJJeHH7On7Bbq1YlVG0Rs9L/Y4/DythexYfliU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQSJuzMyjfcrZ60At93JKcETtagGnDncoY8ShgTiWSEH3PwcQnMWfM9HSyaIwVt/+ ooeDAihoomWwymaLfST4PPkx7zou4KtnMlCsbXXM2zjW7IqiPaOG/vKq6mss9QUx8N XKaAVfU1tYwz/tEeoR3GCGo5e+L9XS58/uZHwpMtQgQkZ56oWYZkoKZkh2hp6O8m1S xkJco+A9rwomJJH0w/zYJ9fCHkk5F0JIIKEvkUs5SKs+ncqYcmtI81PNKWNRHBya65 j+Xqc0JhhFGsH5m5ozQpRjFDNWHcqgcnSPmhlybii0wLlP9IjGpktiMmORvhk1zex1 Pnu0KkPAkgcjA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 09/16] scripts/kallsyms: make find_token() return (unsigned char *) Date: Sun, 24 Nov 2019 01:04:37 +0900 Message-Id: <20191123160444.11251-10-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The callers of this function expect (unsigned char *). I do not see a good reason to make this function return (void *). Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 89cc7c098c51..274a77bfbd63 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -503,7 +503,8 @@ static void build_initial_tok_table(void) learn_symbol(table[i].sym, table[i].len); } -static void *find_token(unsigned char *str, int len, unsigned char *token) +static unsigned char *find_token(unsigned char *str, int len, + unsigned char *token) { int i; From patchwork Sat Nov 23 16:04:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180108 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886478ilf; Sat, 23 Nov 2019 08:05:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyaRdEmu5zYMxfmfuR5kFMdUhjDJo5csaixshufagakveqUMmiogMQfCjeyEqFiGB7GIGmS X-Received: by 2002:aa7:d652:: with SMTP id v18mr7700237edr.184.1574525126543; Sat, 23 Nov 2019 08:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525126; cv=none; d=google.com; s=arc-20160816; b=BOCAv2XhAOEBwoBQbHoTpTWWguOdQdfdKZPU+Qgymx77oq7xFsjKJ680ykr0Wsq4xd PaLd/oPv3HZYzUj9/kfwBSrVTjne2IUzy19Inmz+/srUN5N0ojfFycyjjrbNnxd95I5i /OuDCjI5Us7WuiYNkbXhud5Nzyob2tn70P3jszbtP0ENipnseQbh6T59ICXl8pYax7wV BYT3rpAMkfXWWdRPMvOWn8W06AY5JzA1aQf8xJioZA6guJKqR4b8QGUWsVAUqI6c3fkb 0jaRoi9kK7/17CkhZ4X92hTHOp5f79de0yC+Jj6A/8TrOlej0pO8ExGZYGZhTbjBQKva 5hxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=TqAVE85oDKpy1eWHxD/8KLZmwl3zyQtGJJFbn4W7YnQ=; b=YHnAlri065BtqMi9fRVl8dJ4+dqEIK61iMjVWuyeNl4kTSZwYPrqSM0fKIqeYeyVPm t1sX/8u7/D1FbvvwN8TEmwg4FK+LgEoZDynPUB0iwW8wiVzUcZ8eMGgKCfGT4uBUpdOu cSo0hW9Gtj0EmtQk/AvxQdDlaX8y7crrCQA7rdGNDaWWXZ35H+3erv0cXbc8TvTaDJz5 sFWxG2DkxGMNTkno7jEPJ/UvAzMIVX4JmyvRuo0tnEDjJ69Yk703jOy+lTR+ceu5Rt/P FF5oTsi3RRVkkqRaqEhzTBQaiw/rD2oAEHgSp0zLSC5opTD/SGiRvHUZq7jo/oShUvg+ vnnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="1i5yw/SO"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dt11si952344ejb.126.2019.11.23.08.05.26; Sat, 23 Nov 2019 08:05:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="1i5yw/SO"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbfKWQFX (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:23 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49452 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5R019106; Sun, 24 Nov 2019 01:04:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5R019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525092; bh=TqAVE85oDKpy1eWHxD/8KLZmwl3zyQtGJJFbn4W7YnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1i5yw/SOLwH/DwJsCx+Uv4HD6c+KnXEA/xMqf+faLL0RPm/HsMiaJMq5FwpCfnF1J ZiXPYaOECNh8LFNAWfGbwV+ZDuskFk/QruKmDzfMOlg2gZHWtKxrYbKO49uoAxO5lg JX1TNNX29XpXu2LNex95EYkvUOF5sr4uVcSqwR6SSAjxVwo8YZ0numa97G/oQCyUqY t32ZyN6dT+BkFSNLzappuTtMW8wOAPaQQwVyKwq4TQVIA9o95/jeKlQwF3e7pNW3Ez gP0ApTluces2GggGcRn3MTxfyZx06LsxyxsbcZ0WctvblBwQR+LTCZJK4VNRiqKNIw xau0jAXnELx1Q== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 10/16] scripts/kallsyms: add const qualifiers where possible Date: Sun, 24 Nov 2019 01:04:38 +0900 Message-Id: <20191123160444.11251-11-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add 'const' where a function does not write to the pointer dereferenes. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 274a77bfbd63..056bde436540 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -170,11 +170,11 @@ static int read_symbol(FILE *in, struct sym_entry *s) return 0; } -static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges, - int entries) +static int symbol_in_range(const struct sym_entry *s, + const struct addr_range *ranges, int entries) { size_t i; - struct addr_range *ar; + const struct addr_range *ar; for (i = 0; i < entries; ++i) { ar = &ranges[i]; @@ -186,14 +186,14 @@ static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges, return 0; } -static int symbol_valid(struct sym_entry *s) +static int symbol_valid(const struct sym_entry *s) { /* 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. */ - static char *special_symbols[] = { + static const char * const special_symbols[] = { "kallsyms_addresses", "kallsyms_offsets", "kallsyms_relative_base", @@ -208,12 +208,12 @@ static int symbol_valid(struct sym_entry *s) "_SDA2_BASE_", /* ppc */ NULL }; - static char *special_prefixes[] = { + static const char * const special_prefixes[] = { "__crc_", /* modversions */ "__efistub_", /* arm64 EFI stub namespace */ NULL }; - static char *special_suffixes[] = { + static const char * const special_suffixes[] = { "_veneer", /* arm */ "_from_arm", /* arm */ "_from_thumb", /* arm */ @@ -305,7 +305,7 @@ static void read_map(FILE *in) } } -static void output_label(char *label) +static void output_label(const char *label) { printf(".globl %s\n", label); printf("\tALGN\n"); @@ -314,7 +314,7 @@ static void output_label(char *label) /* uncompress a compressed symbol. When this function is called, the best table * might still be compressed itself, so the function needs to be recursive */ -static int expand_symbol(unsigned char *data, int len, char *result) +static int expand_symbol(const unsigned char *data, int len, char *result) { int c, rlen, total=0; @@ -339,7 +339,7 @@ static int expand_symbol(unsigned char *data, int len, char *result) return total; } -static int symbol_absolute(struct sym_entry *s) +static int symbol_absolute(const struct sym_entry *s) { return s->percpu_absolute; } @@ -477,7 +477,7 @@ static void write_src(void) /* table lookup compression functions */ /* count all the possible tokens in a symbol */ -static void learn_symbol(unsigned char *symbol, int len) +static void learn_symbol(const unsigned char *symbol, int len) { int i; @@ -486,7 +486,7 @@ static void learn_symbol(unsigned char *symbol, int len) } /* decrease the count for all the possible tokens in a symbol */ -static void forget_symbol(unsigned char *symbol, int len) +static void forget_symbol(const unsigned char *symbol, int len) { int i; @@ -504,7 +504,7 @@ static void build_initial_tok_table(void) } static unsigned char *find_token(unsigned char *str, int len, - unsigned char *token) + const unsigned char *token) { int i; @@ -517,7 +517,7 @@ static unsigned char *find_token(unsigned char *str, int len, /* replace a given token in all the valid symbols. Use the sampled symbols * to update the counts */ -static void compress_symbols(unsigned char *str, int idx) +static void compress_symbols(const unsigned char *str, int idx) { unsigned int i, len, size; unsigned char *p1, *p2; From patchwork Sat Nov 23 16:04:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180110 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886629ilf; Sat, 23 Nov 2019 08:05:34 -0800 (PST) X-Google-Smtp-Source: APXvYqx03SnLnsOKm1VGDf+V6519rSJ54hQBFbWGKGiwxOsc8ysiXQpLNVZdIYZMYvKMjKCMoaz+ X-Received: by 2002:a17:906:4899:: with SMTP id v25mr27757018ejq.235.1574525134268; Sat, 23 Nov 2019 08:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525134; cv=none; d=google.com; s=arc-20160816; b=M2vskcS+OuqSjngVkcpcVMDHacHo1T5blIOQTFDItdNK29xhQwQi24YQ1rNxTraW/G NVShKxsG5m4ogN1gJ0hmWsM6qN3P53HXZ4pa00BjaPRZWIVsBTrTrgZS4AlY0aTHCrF1 rLcvKQpPvDxl6rYyfrKNyaprK9IJj8oKqQxd+tLVgk0EPxcMehCQO551g3UsX4wmsssW jx1GJZkQhPvhF8cMMQkvMWEMLabB1ydvUvGIFvpBhGGcDIMh/5KXsr3Cttxey/5JFmLV lsQ1BOe0lRymQJ/jboWVxF2ZgDBlVTbZ1n33iP0J6piYDkq9AcbaLSh9gfIFFqzpA7a6 GybA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=L3zUH6rFXSpzUIwhA4bPRr4LzEsUQo/+LU2wclGFUeM=; b=sQkfU4bHUUn/8ihMp2J1CrUrBIsVufHDpRk4tfahLYgR4lIjddAm8cOHmOEfjvt8Ou Q5SSebeYFW6cOF5rJHLKcaDJNtDxrdwgiH2UK7MTMKNvSNQ+bQgTnc2knEKElQ7k4+98 uzJh3R4WBBVGmPaCpVTfYvcvlG4u8LLZAYB6aN3kAqMUqitr+aDESFdk6kDErPbUWK88 bTTb+Ce2AsuQ+CBDKBCPnRQobBUWemNMTaIkfJqbD9ZiR8OI35ZiAcxI+M/1WV105JOO hEflJshBwAwOaiCR0bJ2I8ywb2o61CcAklkEOVJdDt1CRtrzmDoiC+grBmF+yCKX+v+Q a1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=koLs9OL+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si999308ejb.257.2019.11.23.08.05.34; Sat, 23 Nov 2019 08:05:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=koLs9OL+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727128AbfKWQF0 (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:26 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49447 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5S019106; Sun, 24 Nov 2019 01:04:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5S019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525093; bh=L3zUH6rFXSpzUIwhA4bPRr4LzEsUQo/+LU2wclGFUeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=koLs9OL+iw4m7NwJ6DHSqxM62gT4jNuvHmeGX23Vg7wCLnclSKzxlEAWgjIYuujuy BWhtpWvMNEKpaEKJrUITq4FMLLGjwMmNW2In+pUb2qqlDrn3kssQp5qRwpkXxgIUZZ 1lZCFo2T51boOVR5lDFjTczRLrMTpYJbsSyLysKKN51m8AgndwEPgJJzSvR7hwfUuH 6MZuCAxBRQGT2IyyCrtVfjlUKvxTJcFouhhzyrpQ4kUWx8q+pf7rE5WaCYrsX+ZWA0 r+A6/G0fmPxkmD5HJGC+ndc+FLTubwnuuUONKND/gyjoOhOkOKmRuzBWMH9oHUkyyE JH+umBKBAvA+A== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 11/16] scripts/kallsyms: skip ignored symbols very early Date: Sun, 24 Nov 2019 01:04:39 +0900 Message-Id: <20191123160444.11251-12-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unless the address range matters, symbols can be ignored earlier, which avoids unneeded memory allocation. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 113 +++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 51 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 056bde436540..843615c1d384 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -18,6 +18,7 @@ * */ +#include #include #include #include @@ -79,6 +80,64 @@ static char *sym_name(const struct sym_entry *s) return (char *)s->sym + 1; } +static bool is_ignored_symbol(const char *name, char type) +{ + 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", + /* Exclude linker generated symbols which vary between passes */ + "_SDA_BASE_", /* ppc */ + "_SDA2_BASE_", /* ppc */ + NULL + }; + + static const char * const ignored_prefixes[] = { + "__crc_", /* modversions */ + "__efistub_", /* arm64 EFI stub namespace */ + NULL + }; + + static const char * const ignored_suffixes[] = { + "_from_arm", /* arm */ + "_from_thumb", /* arm */ + "_veneer", /* arm */ + NULL + }; + + const char * const *p; + + /* Exclude symbols which vary between passes. */ + 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; + } + + return false; +} + static int check_symbol_range(const char *sym, unsigned long long addr, struct addr_range *ranges, int entries) { @@ -118,6 +177,9 @@ static int read_symbol(FILE *in, struct sym_entry *s) return -1; } + if (is_ignored_symbol(sym, stype)) + return -1; + /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; @@ -188,38 +250,6 @@ static int symbol_in_range(const struct sym_entry *s, static int symbol_valid(const struct sym_entry *s) { - /* 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. - */ - static const char * const special_symbols[] = { - "kallsyms_addresses", - "kallsyms_offsets", - "kallsyms_relative_base", - "kallsyms_num_syms", - "kallsyms_names", - "kallsyms_markers", - "kallsyms_token_table", - "kallsyms_token_index", - - /* Exclude linker generated symbols which vary between passes */ - "_SDA_BASE_", /* ppc */ - "_SDA2_BASE_", /* ppc */ - NULL }; - - static const char * const special_prefixes[] = { - "__crc_", /* modversions */ - "__efistub_", /* arm64 EFI stub namespace */ - NULL }; - - static const char * const special_suffixes[] = { - "_veneer", /* arm */ - "_from_arm", /* arm */ - "_from_thumb", /* arm */ - NULL }; - - int i; const char *name = sym_name(s); /* if --all-symbols is not specified, then symbols outside the text @@ -241,25 +271,6 @@ static int symbol_valid(const struct sym_entry *s) return 0; } - /* Exclude symbols which vary between passes. */ - for (i = 0; special_symbols[i]; i++) - if (strcmp(name, special_symbols[i]) == 0) - return 0; - - for (i = 0; special_prefixes[i]; i++) { - int l = strlen(special_prefixes[i]); - - if (strncmp(name, special_prefixes[i], l) == 0) - return 0; - } - - for (i = 0; special_suffixes[i]; i++) { - int l = strlen(name) - strlen(special_suffixes[i]); - - if (l >= 0 && strcmp(name + l, special_suffixes[i]) == 0) - return 0; - } - return 1; } From patchwork Sat Nov 23 16:04:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180111 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886658ilf; Sat, 23 Nov 2019 08:05:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzjp83hSbi1qevT+GNPUPgyA1iJnCQuuBr2YD9XbPacA4+1HYx/7LCgWIMvsqYCI8GWI4Xn X-Received: by 2002:a50:e68c:: with SMTP id z12mr8082612edm.53.1574525135323; Sat, 23 Nov 2019 08:05:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525135; cv=none; d=google.com; s=arc-20160816; b=XttnzvnTHH0Ck2oHIS+hoOSY9Uk/hZ3+phGiHvdnlcvn5ownHJueDPkWdCGJ7EYW5A Qh52CcrxJZ7/oleQOsPhq2toNwM6pjc/NJPDHnFFntr/e4XZJBHKgnTla7IveCDykZ5/ Tc+Ikil1p0zEg8qIvOd0R4OiQSlMKulVqkRzmhZA3187BinTuEJgvkL99/cVbCgFk1cE VuyZm78OvUY7yuqVbUXEb/zzlUhlkTFNQEi7T822xYY8Ks8uQoAtZ7kp+ULkDvyYJfWb Z7FCHT3DFrTNzuy+NhXT/iqjn6bC+piblUynLzLZvpfjvhYmser9TXc5sxtLVsVWK2k1 bvAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=9iKDRL9d6hTzpOpmUOinbE+RaKJ+14kZ7Ic+FqY8y+Y=; b=hq2e/XMXwzZUrJG3FuN5YPMc0GcR335bug0zk/3vBNz7pmcpFtxJAW5ubBwrew7Yiz TACWscKJ9wFOPPH1Y5AmOLimEM7JrtIJxQS7VgPXyzu50uStBmuRkSkelefyYOnTODKt WW6WILy5zhIZ+sS/lIbHH6Uz2H9NcHFlHwrFnl51ny2MAeT7lg6ct0zbfaJsep+bnNOf A6ttVMacNoUHiRT4zhPqgSF9Kbe7r2QvgUIx+uaQU3Y5EpciQxTA3D1f1JpAR4WM1yKn PJJFrDF4UhRHqkr65XVxzkhTjOH+V7+yVaPMwgVdt80tnhTzoJycyusMXfYhjMx5WJvs LOYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KFpeQPl7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si999308ejb.257.2019.11.23.08.05.35; Sat, 23 Nov 2019 08:05:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=KFpeQPl7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbfKWQFd (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:33 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49456 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5T019106; Sun, 24 Nov 2019 01:04:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5T019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525093; bh=9iKDRL9d6hTzpOpmUOinbE+RaKJ+14kZ7Ic+FqY8y+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KFpeQPl7WSOVE5M+4JYWJ8DMYIoVWCT9dijqhBO0BSP29OO5sbiSI38pWWHLPvQsR 3P2tCKW9H7g5pB3N1UJXUEJTKd77GHg0d+36p4dO0Sy1++uNzc32sO2iMtc/hUE5dX U3Slqh0jkDfZUIZqhHaTMgOv+AawhekGBWj4+qJHz5LSRhrlrcp/AKa9i6DPxm8Fh0 FqxhmXd46eEK7LPhlTg38Tbh7TIYT+U69UZchvJz/Uy0IQ1T9Xj/1NleQbNrneYbBM t76u28L7Rz6MhKlUlcFoIjeHeTGRSsyYwOREi1teDNknwm2oBNv/iczAabOK8Hnup5 Y5V1zze2RuJnw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 12/16] scripts/kallsyms: move more patterns to the ignored_prefixes array Date: Sun, 24 Nov 2019 01:04:40 +0900 Message-Id: <20191123160444.11251-13-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactoring for shortening the code. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 843615c1d384..04a1dd16edcf 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -105,6 +105,8 @@ static bool is_ignored_symbol(const char *name, char type) }; static const char * const ignored_prefixes[] = { + "$", /* local symbols for ARM, MIPS, etc. */ + ".LASANPC", /* s390 kasan local symbols */ "__crc_", /* modversions */ "__efistub_", /* arm64 EFI stub namespace */ NULL @@ -198,19 +200,9 @@ static int read_symbol(FILE *in, struct sym_entry *s) } else if (toupper(stype) == 'U') return -1; - /* - * Ignore generated symbols such as: - * - mapping symbols in ARM ELF files ($a, $t, and $d) - * - MIPS ELF local symbols ($L123 instead of .L123) - */ - else if (sym[0] == '$') - return -1; /* exclude debugging symbols */ else if (stype == 'N' || stype == 'n') return -1; - /* exclude s390 kasan local symbols */ - else if (!strncmp(sym, ".LASANPC", 8)) - return -1; /* include the type field in the symbol name, so that it gets * compressed together */ From patchwork Sat Nov 23 16:04:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180104 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886076ilf; Sat, 23 Nov 2019 08:05:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwlG9Hv1Iu+RrDshuRWSKt8m0utKf0cWxEY+K4DjQgXTUphO9g63/rKYLPFSvpXumZXcxT2 X-Received: by 2002:aa7:c68d:: with SMTP id n13mr2418786edq.193.1574525109056; Sat, 23 Nov 2019 08:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525109; cv=none; d=google.com; s=arc-20160816; b=Fbq6wjTOQSv3lnURYO2rdiMYj4f5g7x0gQ6CbDuJWRNuQpX4wZus1lYMANXbhXrFHm GXtdYc2sW+z/bfk+4vPXNEvZBGEebytxfWz47r7pqp3158DBOLnfJdPqAqyNBHG7VbBj PEzLJodGMtL5Nmzgm0m+ETPj+8M2mIZly0ktTBUfU5oLj8kS61/a9SUPliUXraS4dRDi gBw4xK4/I8czEEK/jeWNGL0+drCkS7Xj4wmHe68wBZdHxTv3e4/N0wsbtp54k4ggZYvL suHT4XnkhNeTPjq7uqbadHNsxQ9TMgUJn0SpGCJ6nLVSGIqOytIOZzAoPa3e1N/bTbua I2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=MJZKY+LNnUcmoA8/8v1d9mnVbNRYD0Hp8Ly2ZpnRV9k=; b=BZMbPZUagJS+Bd02Vg2xDthOTkf1d0u0QI8UMJxkAwIgDkCRgrqPOygd1RgQneKDHj YG1z5fs721MIcBWVMHwM6OT0A0sXaZGZP/EWSkCbxRn/andji6klbkbDU6vtd9qeb43m x+v25f/RswcWy8q9/cdA1FGXWMfw9IQd2U6Apbm0erbrv83q1LGMBMFebRpEfqlVf0us baqsfKVNFIf/rebU+XcsAutDn9ifZOfJxhzmIt4zuH/xaqLI9YXKbqgz576otfKR82vv k5i0a/DJH+YS4oHdPDKNd2ekitgaOz6Wrfe8AMFvz3qqVai7ozlyTCV2/XwidA+kNZ/a MPRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mGJ7eDDU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si1068885eds.39.2019.11.23.08.05.08; Sat, 23 Nov 2019 08:05:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=mGJ7eDDU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbfKWQFF (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:05 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49492 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfKWQFD (ORCPT ); Sat, 23 Nov 2019 11:05:03 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5U019106; Sun, 24 Nov 2019 01:04:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5U019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525094; bh=MJZKY+LNnUcmoA8/8v1d9mnVbNRYD0Hp8Ly2ZpnRV9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGJ7eDDUJ/MkRY2+xwDSNHG2eQ/ZOUJh1wAD4uYUzIFhkEL1Fi2xbIM89oOVsxwdq W7T1Juhy8d4BtYO/g5ddpCysacO26UjhC+v8Tfiy2hEImld0TIcXr5+QCXCQ5gdUUJ HEbqQn5oBTmDTcu6GXWkUZnnByLyOiaf1D6DgM3dJRLUCwF0zQMOFFeSndgeKMQZWo eUzt+b/HyLocv9oHq9pGQirNI0Q4EHa7CFjWdfRAY+N2Cp3crUueTxTOTNgnPyI1Gj ttRHmaaCJCwaLVZu5OyaT9oWBw1zLPUjhekwSw62QSKjD2adzaJlb506hl7RsU+hRV 5APOT1SbSb0AQ== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 13/16] scripts/kallsyms: move ignored symbol types to is_ignored_symbol() Date: Sun, 24 Nov 2019 01:04:41 +0900 Message-Id: <20191123160444.11251-14-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Collect the ignored patterns to is_ignored_symbol(). Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 04a1dd16edcf..d90a6133d7b8 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -137,6 +137,21 @@ 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') + return true; + + if (toupper(type) == 'A') { + /* Keep these useful absolute symbols */ + if (strcmp(name, "__kernel_syscall_via_break") && + strcmp(name, "__kernel_syscall_via_epc") && + strcmp(name, "__kernel_sigtramp") && + strcmp(name, "__gp")) + return true; + } + return false; } @@ -188,21 +203,6 @@ static int read_symbol(FILE *in, struct sym_entry *s) else if (check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges)) == 0) /* nothing to do */; - else if (toupper(stype) == 'A') - { - /* Keep these useful absolute symbols */ - if (strcmp(sym, "__kernel_syscall_via_break") && - strcmp(sym, "__kernel_syscall_via_epc") && - strcmp(sym, "__kernel_sigtramp") && - strcmp(sym, "__gp")) - return -1; - - } - else if (toupper(stype) == 'U') - return -1; - /* exclude debugging symbols */ - else if (stype == 'N' || stype == 'n') - return -1; /* include the type field in the symbol name, so that it gets * compressed together */ From patchwork Sat Nov 23 16:04:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180113 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886867ilf; Sat, 23 Nov 2019 08:05:45 -0800 (PST) X-Google-Smtp-Source: APXvYqx0xTlxv4FFJmFMKr1OkkaitKihSoBGPIHNW0qqC/NwBgjECxUS46dhpNGpGbPYDct/tzDX X-Received: by 2002:a50:ef16:: with SMTP id m22mr7807715eds.154.1574525144943; Sat, 23 Nov 2019 08:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525144; cv=none; d=google.com; s=arc-20160816; b=KpcwppM0gfhgJTZp5m+x+ikdVQr62/YPUvwfgO3Kk0AoXeVsHlh3dp82KxHJPMycqh amy9K4MNvvujTUbWAg/Jtir5vetXh/tAwL0zfzbTNuY9eE2F1r5L2G/lDQhYw2ZzlKfI l+q1rXDkq5WRfVA5WlCjwyf8zTkNUsF9k3j/DLoWlIve7D7qKMk6FFH9aBOSnnuLYFom 29ehipwptOKK7bdqcM8JsXJGT7FHPmxVHTizVmOR7awPH7AIihiAOAJNnYM1/ewcLB93 CCTixOln01zKugual0cKXxKIVIpsumlfVs2zbtkF9YvJ8Gv4RmsaqwhVQb2KedPDLCqG dWwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=9MAnCdg3hR5ROOX8y8hcsA9VaCetvt+YAuylmAsTUL4=; b=WvzUzDQcKyw2k2hQBM3KjWmXfPHt3k379ZERFH3ZgV8UZPD6qEdKbbHe07lYpa758q dKiLKlmvxOVmbH1RUrRYgRsUX2e4HNQ+X42ihdCee87W0dLIGWBeyujcyDgXEDMklN+4 nWab0guDLx5vWPPmAzuErq5GhBYiLsA3U9zDRF8nVYw3HhsViG30H7hK9SdP2AWL4IyG 4whMGv0XstFklRsVjZIWE4RxcnMEzOKlCa32O+b7bD/7J5mQTGEDSDMDWUTsluitwGE/ L20ektk5FA7jZgWeuLE2naVUnHRoBxxMVR9j7YkRwFU+BHRXFBSNbbR9CghYRAtfAiCm n8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="x4VIQ1/V"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn4si970396ejb.329.2019.11.23.08.05.44; Sat, 23 Nov 2019 08:05:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="x4VIQ1/V"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727212AbfKWQFm (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:42 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49457 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbfKWQFC (ORCPT ); Sat, 23 Nov 2019 11:05:02 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5V019106; Sun, 24 Nov 2019 01:04:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5V019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525094; bh=9MAnCdg3hR5ROOX8y8hcsA9VaCetvt+YAuylmAsTUL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x4VIQ1/VqdKlMPmJB8JIlJnPeiDjw2UMJPvdhqrzJQXJM40hLJ87fsHejr4cCTmTg 50BMgOnpUNp8aKEup82RBfUju4WPG3xqBJD50ihPyUtSaFXaxi12GsAZB3Fux3yFL0 AJEodQDkTKfQrHaX7BYQzOh7VpGlVWQf3aWhhL2qjg8P1ekPdRA1tip2D0oGBzuici ImZ5hWIP0XV7a2PWUkW9kIZ8V7GhPnNdW8ZQvvZ3FH5YqZqrTCpGjJwWL7jf6Pa03r ThOFqS+ftEUK5BW3/2lI/qZ9ZjU+1jllYHrf0JhWO56ilJw9MZs3BdiMZ3Kee0OMYK bjohBVT5LLiTg== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 14/16] scripts/kallsyms: make check_symbol_range() void function Date: Sun, 24 Nov 2019 01:04:42 +0900 Message-Id: <20191123160444.11251-15-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no more reason to check the return value of check_symbol_range(). Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index d90a6133d7b8..f4d5f131556d 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -155,8 +155,8 @@ static bool is_ignored_symbol(const char *name, char type) return false; } -static int check_symbol_range(const char *sym, unsigned long long addr, - struct addr_range *ranges, int entries) +static void check_symbol_range(const char *sym, unsigned long long addr, + struct addr_range *ranges, int entries) { size_t i; struct addr_range *ar; @@ -166,14 +166,12 @@ static int check_symbol_range(const char *sym, unsigned long long addr, if (strcmp(sym, ar->start_sym) == 0) { ar->start = addr; - return 0; + return; } else if (strcmp(sym, ar->end_sym) == 0) { ar->end = addr; - return 0; + return; } } - - return 1; } static int read_symbol(FILE *in, struct sym_entry *s) @@ -200,9 +198,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; - else if (check_symbol_range(sym, s->addr, text_ranges, - ARRAY_SIZE(text_ranges)) == 0) - /* nothing to do */; + + check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges)); /* include the type field in the symbol name, so that it gets * compressed together */ From patchwork Sat Nov 23 16:04:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180115 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp887156ilf; Sat, 23 Nov 2019 08:05:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyx4d0pqlsk5yGYuEY0HljnNxYfW9ZWbat38EBkWL6Fq1k/q1/KtZSH/XVajIfaE5a54OMQ X-Received: by 2002:aa7:dd4f:: with SMTP id o15mr7803329edw.189.1574525158466; Sat, 23 Nov 2019 08:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525158; cv=none; d=google.com; s=arc-20160816; b=CRn62/K4otzZQzsZE/Q5HVYRf/O0aIFPahb0xw4Nfbv5XT/4BGAbrB14yE1HgMrHw0 zUcCrwANZG5GCY2mgygxMdBLrzbnvpVbWitR/UJ9Y49KyygrXXkJzOdWdDgn2pS8TZM9 7PjpgjBVXnpC25JH/YsWC3qDVGzOrFsstGXjK5YdY2+Uw4Fwn8ObrcExrGjBhNBSev8L ZrkKrOVesN0yQ47MwVHNd/2VzYp3EowIuvBCe+ugBJRICdyKDN35wvrWSZAmh0AwTAVE WEoWSw8GZZKRB6dmAVKHUPZWREHEsMBB8cTIYET6s8Bnh6cJQWETOrCoc3rDnit7Tdfg DrXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=jA3oyA+zBfgpdI/EjevUAFgNYlad6/34++q2OdZf31k=; b=ZCei2C0y2SbztYMQ7YxbE/EJdRIo44Ql0NO/g5jccEgqq/0LbnvJGf68SQsAfOykpw 6FmCz+XncCkQVtxOqfOET90tqqd4SVPEuleaX3fxurwMj4W6apPPOGfnBwKZN0YGfCqX yaVKVnpm7YOttLTPDWyMJATknyXwid7Vzs10H1DvoW6yaHCha5+Hj5gTqrpj9d+1lADS VMWVAVdfM+vrQCtYNAcEsV9GdFvus6cgv6t3/col98hYYDFhpnBZIE7T2HxIWkBLYb/u AgJCLp0QNWaPZFn1QKZEWgmOP/NVEHripLewQOogjUtXwimFZbVfSealte4gZhYdnQhK az2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ls8Ej6lz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bt28si1019271edb.270.2019.11.23.08.05.58; Sat, 23 Nov 2019 08:05:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ls8Ej6lz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727270AbfKWQFw (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:52 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49449 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5W019106; Sun, 24 Nov 2019 01:04:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5W019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525095; bh=jA3oyA+zBfgpdI/EjevUAFgNYlad6/34++q2OdZf31k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ls8Ej6lzwh4m25ICQmLvpNEmvovUsuCJ4C3qbnAgD1chP/UidRNAzql0uxWy25+7p 8DqN7YSD3JMYFEfaEC/ah4vFxymxc4YKfGp5g4j5ofQU0Te2JJpl0NBb7Yo1rgqrAS aiZ2iOhmO7JoFZtTxbc5UNgfvyuPpCly4OY/VUK6JcwQEatCPj5McFCYorIzht0tzM QbzLq9AvWdPo4ePLfSH5OvmtQeFhUjBPOOBwge0TWp8x7/dPMxwsv/12xsyZvZI9xz OaDsaYQe+dAX8ySAUxAV1k8Q9OxQepfEcYzj/hZCY3tpXiqlA5tVOHZcgButhqtA5F jPc6R7aUvjYMw== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 15/16] scripts/kallsyms: put check_symbol_range() calls close together Date: Sun, 24 Nov 2019 01:04:43 +0900 Message-Id: <20191123160444.11251-16-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Put the relevant code close together. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f4d5f131556d..b9b1a4cf1c65 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -200,6 +200,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) _text = s->addr; check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges)); + check_symbol_range(sym, s->addr, &percpu_range, 1); /* include the type field in the symbol name, so that it gets * compressed together */ @@ -215,9 +216,6 @@ static int read_symbol(FILE *in, struct sym_entry *s) s->percpu_absolute = 0; - /* Record if we've found __per_cpu_start/end. */ - check_symbol_range(sym, s->addr, &percpu_range, 1); - return 0; } From patchwork Sat Nov 23 16:04:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 180103 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp886051ilf; Sat, 23 Nov 2019 08:05:08 -0800 (PST) X-Google-Smtp-Source: APXvYqydEPZHWWva+EAayxtVTd8dURR7qGphezQxpdxZMsqH+deoAcwVpyHLAiR3grfPSK/U4Zao X-Received: by 2002:aa7:c4c8:: with SMTP id p8mr7787408edr.121.1574525108346; Sat, 23 Nov 2019 08:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574525108; cv=none; d=google.com; s=arc-20160816; b=qv5BUU1xUylHvj8Bo39/MV9TW8AcSgglKs9YIkt3Dun5+lpXGrDgn6wCQuO7YYN26X MhDrLOxutpNjm8nCP/cCi3Plf052v4Pjlk3cZu8u6EBEV34q4ukPFH/lx8g1IqH5JKB+ Dq713cdSjv9r7PToQytvEVL7UIAYA0GXgxwWVNQa7OC7045ac764YeprtJSrSKkg1uWz XksZET5jeEVIN0FXf5IS6MC84uVe0R5SaO09/uxdrmZtRiaotySxZaV8OVM8yoK+sqKP lTlD0wwZrUPjt+2Ux8bTvHYrzfluSEYiFOHLhc0out/vwM3oIaTyTSyr6v86IYc901Sl V1Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=bQe/3Y9Yl+Kq9fBfAZOWGkCZwUqZVs1ZvuNfALS8C3M=; b=uH3TZvcEKsY+d3M1YsvDQ85ommhqp4b7vHxzBO18lcp9w2AIVP1GxZjCPmkS4Jm7MB KMSAPj0ZRTeDHwRCoUW9ADdlOSmAhMUCRlemS3WUzsVBa52hqU8nHhztkAIbDABubd3A 4OHpUewiFL4dxZFla0RZ1PEHGPTzYD6cchmP18PfF5FOygSlMcQ8bcHlD6i3H/X6AGvJ hSxCuElqK+QcUoiCxo2PWEULkmtkijyJ2UawLGBWTBjpOQuEF07A3jbH0Qsmu+X5IFFo cgyYYm1DEExfg7Di14oPbmg2SFLCCSzcgoSnLTU2iuPF4mM0EHKDkOqB+2ovKMzTaHPK GVVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="cjUQ/FkK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si1068885eds.39.2019.11.23.08.05.08; Sat, 23 Nov 2019 08:05:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="cjUQ/FkK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbfKWQFD (ORCPT + 26 others); Sat, 23 Nov 2019 11:05:03 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:49453 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbfKWQFB (ORCPT ); Sat, 23 Nov 2019 11:05:01 -0500 Received: from grover.flets-west.jp (softbank126093102113.bbtec.net [126.93.102.113]) (authenticated) by conuserg-12.nifty.com with ESMTP id xANG4l5X019106; Sun, 24 Nov 2019 01:04:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com xANG4l5X019106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1574525095; bh=bQe/3Y9Yl+Kq9fBfAZOWGkCZwUqZVs1ZvuNfALS8C3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjUQ/FkK+GKaB9FQDS2oQmQIFqTtwvMn+XU1w5kuJ6vuHntQh4WviKuCipgVTOF6q NzeW7B9KsE0GmU8xIkFvUv7XNpcbQjMUsYsSfZrjwBqQDhXsoltaIx3fE8NjBUvQCB sas9D0BQCiU/9W9yDBKqbz3tRMJJB8aQQ787SEfNd7jHDKAkSKQeamVl3eg9vyhgVh EXrv+fluli/i+h6ys9DnIzcLUfEriwp/nsqUP0Au24yHYt+ywR05MPfG1yB0JbDXqd bzpFWevKawuhs8VpksT8PQ19fCGK3G7WWQ9RyaYaYwnpo7oSaH3mLUD3o3eP5pBL+L hmKdJHq1iwlSA== X-Nifty-SrcIP: [126.93.102.113] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 16/16] scripts/kallsyms: remove redundant initializers Date: Sun, 24 Nov 2019 01:04:44 +0900 Message-Id: <20191123160444.11251-17-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191123160444.11251-1-yamada.masahiro@socionext.com> References: <20191123160444.11251-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are set to zero without the explicit initializers. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/kallsyms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index b9b1a4cf1c65..fb55f262f42d 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -57,9 +57,9 @@ static struct addr_range percpu_range = { static struct sym_entry *table; static unsigned int table_size, table_cnt; -static int all_symbols = 0; -static int absolute_percpu = 0; -static int base_relative = 0; +static int all_symbols; +static int absolute_percpu; +static int base_relative; static int token_profit[0x10000];