From patchwork Fri Aug 2 21:08:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 13751998 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69AF1219FC; Fri, 2 Aug 2024 21:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722632936; cv=none; b=YIMnn4X0glHzZDhTHi1ZjstGJ+NSX0m1FRXYXY5eqRf76Yh1nvrvYSUSXQIzKpcIurq3mEn4Ij1ZPe+wZaHsnEhTVWaLSqq4jPWNp6fzq5779qEztl5QPubeR8/AuJ3NWUFX9osr6BZw0tTIfDIqXjWPV/BiVAo7BoNA3RrpYdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722632936; c=relaxed/simple; bh=pyBJdtxBPz3GxnxSNiZhE22PkJY5jWrFTCpJgLxoSPI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ekS4gWAMTtOcJV++ItKGYKFLf3E7mMupAj4Nricja+hqCb5LqoGLdr8N/GMz5RxLKvBbl+EyaU09ga/wwiHWQ/vCIF4krJbmHRY5DJ4i6yxgI0FyRDJAKNSv7SCM9LdFBeQQW+XKddWw5cks4d9ZM6eNn39C0YOyuLGTcPcTgag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M/ooE/aV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M/ooE/aV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2E30C32782; Fri, 2 Aug 2024 21:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722632936; bh=pyBJdtxBPz3GxnxSNiZhE22PkJY5jWrFTCpJgLxoSPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/ooE/aVl1Ul56u1Bl0w7qHeIpO4lGmqtYeRlqbCwKf/g4qjEOfo8b6awMTBNu8mB L5cGti5vcL9Tk1M3SKK6WTrhjtOJAtMN7Dzu+z98cNMe/SahEXw5O+J2f7DOJtk+CZ cp9RBZRFYWwPEalXRuiA/P22ioFAofv/q9Gcd1L57oIxCbFYbYAmrIEOi8s69e7FL7 Ll5/37Jh2xf1Bnt4iItOJPwQMzTb1amxubkIyLTPTtM1f1fle7NAlCNolOomgzrfo6 rv5wJBAEv1rqIsAnvXvfksoVNF/yFouEpKv/xOgHX9CNJ9EYXUs+Wtb/T0WF0WSE9r PJI/Ao2MjGj/g== From: Song Liu To: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, nathan@kernel.org, morbo@google.com, justinstitt@google.com, mcgrof@kernel.org, thunder.leizhen@huawei.com, kees@kernel.org, kernel-team@meta.com, song@kernel.org, mmaurer@google.com, samitolvanen@google.com, mhiramat@kernel.org, rostedt@goodmis.org Subject: [PATCH v2 1/3] kallsyms: Do not cleanup .llvm. suffix before sorting symbols Date: Fri, 2 Aug 2024 14:08:33 -0700 Message-ID: <20240802210836.2210140-2-song@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240802210836.2210140-1-song@kernel.org> References: <20240802210836.2210140-1-song@kernel.org> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Cleaning up the symbols causes various issues afterwards. Let's sort the list based on original name and handle suffix later during the symbol lookup. Signed-off-by: Song Liu --- scripts/kallsyms.c | 31 ++----------------------------- scripts/link-vmlinux.sh | 4 ---- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 0ed873491bf5..123dab0572f8 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -5,8 +5,7 @@ * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * - * Usage: kallsyms [--all-symbols] [--absolute-percpu] - * [--lto-clang] in.map > out.S + * Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might @@ -62,7 +61,6 @@ static struct sym_entry **table; static unsigned int table_size, table_cnt; static int all_symbols; static int absolute_percpu; -static int lto_clang; static int token_profit[0x10000]; @@ -73,8 +71,7 @@ static unsigned char best_table_len[256]; static void usage(void) { - fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] " - "[--lto-clang] in.map > out.S\n"); + fprintf(stderr, "Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S\n"); exit(1); } @@ -344,25 +341,6 @@ static bool symbol_absolute(const struct sym_entry *s) return s->percpu_absolute; } -static void cleanup_symbol_name(char *s) -{ - char *p; - - /* - * ASCII[.] = 2e - * ASCII[0-9] = 30,39 - * ASCII[A-Z] = 41,5a - * ASCII[_] = 5f - * ASCII[a-z] = 61,7a - * - * As above, replacing the first '.' in ".llvm." with '\0' does not - * affect the main sorting, but it helps us with subsorting. - */ - p = strstr(s, ".llvm."); - if (p) - *p = '\0'; -} - static int compare_names(const void *a, const void *b) { int ret; @@ -526,10 +504,6 @@ static void write_src(void) output_address(relative_base); printf("\n"); - if (lto_clang) - for (i = 0; i < table_cnt; i++) - cleanup_symbol_name((char *)table[i]->sym); - sort_symbols_by_name(); output_label("kallsyms_seqs_of_names"); for (i = 0; i < table_cnt; i++) @@ -807,7 +781,6 @@ int main(int argc, char **argv) static const struct option long_options[] = { {"all-symbols", no_argument, &all_symbols, 1}, {"absolute-percpu", no_argument, &absolute_percpu, 1}, - {"lto-clang", no_argument, <o_clang, 1}, {}, }; diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index f7b2503cdba9..22d0bc843986 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -156,10 +156,6 @@ kallsyms() kallsymopt="${kallsymopt} --absolute-percpu" fi - if is_enabled CONFIG_LTO_CLANG; then - kallsymopt="${kallsymopt} --lto-clang" - fi - info KSYMS "${2}.S" scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"