From patchwork Sat Jul 20 10:30:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13737787 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 48A0829AB; Sat, 20 Jul 2024 10:30:57 +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=1721471458; cv=none; b=oIyH2qCpqdFCU2EdiQK0r+p2rWhQ467bs61wP/PYpi0oDSJHYDcv/ZuQVyiW4DDVZGAVzos8zmQJEwQs/lDk4WQ7wjmDtw7tTaiakuIM6cI4i+w2Zrc7eodf8Q43OW4utAmdAjbp5cMvjDH7SOwXW5qY98q0TqFEg2CtSDNhRmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721471458; c=relaxed/simple; bh=3WdX0nkfO4LbxitkdWg1wlALf7fMnNq3EvIWIU3bKL4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Lzjibd/mBSpiJui2OeLKPLueM+EpkV9fw2SO9yuUPQlk50B1yWFOMk7WfqcR8iYJ4+T6C9m7WwGJNwqd+JXYZ2rpLSXidrL6/hHJhj6fUMJoQ95cHKn1zXlDuVEOkqlZu7z7Z4ZAcqBynmyoCHd1Yc6Tzkdsr+sFSSWeViviGo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kpW63dWV; 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="kpW63dWV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38D7C2BD10; Sat, 20 Jul 2024 10:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721471457; bh=3WdX0nkfO4LbxitkdWg1wlALf7fMnNq3EvIWIU3bKL4=; h=From:To:Cc:Subject:Date:From; b=kpW63dWVcT25nippSN6TOjVp+dzBRy+Qab8wIsvQ2/EoLWCH4Jj9hlJ8OCfDXzIX9 L/K+yx6JDUkVR9MdaSUzfvkjyP7FChufgq1w7kqvYbCzaOkOPKm8k/eGaG6t6elBYE pn/0+biQZCnjwuwhvTcsD8uNHpQ/dXTsuFOfjkoSENQp9MbVdwgmQPCtMIRbOlCzv8 744QiU5wwIU+SIzaQbvB8RIFvRH3lSyv5Kendmj076IAS7YeQV9qjq1cOteDohziNL c129jtxDtHm+jSgYYw8UWFxtPGOw70l/p/DY8U48Z0hQF8L6ZfyMopJ2RS1F3jS3un VbUh1VYkURNkg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/3] kallsyms: avoid repeated calculation of array size for markers Date: Sat, 20 Jul 2024 19:30:12 +0900 Message-ID: <20240720103053.2870014-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Introduce the markers_cnt variable for readability. No functional change intended. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 55a423519f2e..f0ea8c922dc8 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -393,7 +393,7 @@ static void write_src(void) { unsigned int i, k, off; unsigned int best_idx[256]; - unsigned int *markers; + unsigned int *markers, markers_cnt; char buf[KSYM_NAME_LEN]; printf("#include \n"); @@ -413,7 +413,8 @@ static void write_src(void) /* table of offset markers, that give the offset in the compressed stream * every 256 symbols */ - markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); + markers_cnt = (table_cnt + 255) / 256; + markers = malloc(sizeof(*markers) * markers_cnt); if (!markers) { fprintf(stderr, "kallsyms failure: " "unable to allocate required memory\n"); @@ -469,7 +470,7 @@ static void write_src(void) } output_label("kallsyms_markers"); - for (i = 0; i < ((table_cnt + 255) >> 8); i++) + for (i = 0; i < markers_cnt; i++) printf("\t.long\t%u\n", markers[i]); printf("\n"); From patchwork Sat Jul 20 10:30:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13737788 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 77B9F2030B; Sat, 20 Jul 2024 10:31:00 +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=1721471460; cv=none; b=eIOanH0AwO5O5n1dIZ8cwBk92Ogq7BAyyZORVKCHiuvFvjhwJCm9AL6F5UbmthYtfplYj1o5A/tK0g3nPgfYZ4mYFeF7nlXEvK+zog5XADh1YrAVxDZRt5LGZa9VcuZIlRsDKj65/qnKhHQzVygUXuY5ASrWxITK8fyOh3CC2Pw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721471460; c=relaxed/simple; bh=ByfgYKKvNMtTldgmxYr1sWL8C4ln1p+Y9xYJTAycY/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DnCnmR3/l5IrXxLqYsnnxI9GX5F1Hl0xQ8xM1RAvb4ATrwKITNKhnleUN0fhq5MxI1FXHBBuNpp5DsD//nbIUQykn2R2mwdUJ6E++HesYYAlBnJLMJWXzBtg26sjt5AW6PRDsTMOChwmJW/GDEHfa+/f4dHzHTFPmUIDMypXM2Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m4wOaVhL; 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="m4wOaVhL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF0AFC2BD10; Sat, 20 Jul 2024 10:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721471460; bh=ByfgYKKvNMtTldgmxYr1sWL8C4ln1p+Y9xYJTAycY/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4wOaVhLNGT4mPR5cOlyFCpr+wVawMdMDaGlG9Sk8x1DNknb5C2ZOdW8sUuSITbCi f5IMhAY4xhKlFOy7QKxkGMLB04TDnDGlzSP+mfySfAnpoXYAGZyi0kqpGmTZkfRCOX lRmifMJzTHQdZ3Xq9LH+swLuuCW+ot/CQFUJ/JEWbIL4Geravjbbu+120YZRCPowhZ Eb208YA6bq3/6nakYHPh9vA75CpywC+3/cKfuo8QmlwQV2KzOibqLrbj2etqmRK9Ea c9XuyA65FN2NZi0kJ34QC1iwiYgtDKL3ZmnxJGBj8v7cdj8qglZLi8pnhWuVxY2ZHH ub3rPub9D6iEg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/3] kallsyms: use \t instead of a tab in printf() Date: Sat, 20 Jul 2024 19:30:13 +0900 Message-ID: <20240720103053.2870014-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240720103053.2870014-1-masahiroy@kernel.org> References: <20240720103053.2870014-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This string literal uses a mixture of \t escape sequences and a tab. Use \t consistently. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f0ea8c922dc8..164c04d22061 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -521,7 +521,7 @@ static void write_src(void) table[i]->addr); exit(EXIT_FAILURE); } - printf("\t.long\t%#x /* %s */\n", (int)offset, table[i]->sym); + printf("\t.long\t%#x\t/* %s */\n", (int)offset, table[i]->sym); } printf("\n"); From patchwork Sat Jul 20 10:30:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13737789 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 3257785923; Sat, 20 Jul 2024 10:31:01 +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=1721471462; cv=none; b=AND65rSg+Z8BLbukAhB6/LTu6sHj+CuLIRYb22qmOm3/6+1pfS0s37JlVfb/euBru91UNeYrAjMqR5qLeMPbC9mfaqePTBXmo5LtsiozGdMtEDyn4iqC2coj8+6vc/WeMldQd/myWHrdnUQ4sYg9xmbJhKs76k+cNaDxd67mLz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721471462; c=relaxed/simple; bh=CdM0mfeBZ7YQywmo6lZ+gVSYc4tCedR3ptcgXbsWHp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hMtp9Xepj9Cw2v6cgR44Pv6+Ut+knP6UGrxm2ExtKh/QBL2pDgFDI2JxAMKU6YkzdO4Q5w2Cp+cpUBYfmWpoWrbiY7w2bwOkslWDlXbKrmEpYbDNayGB6tQ9elyA3w85ory0+ANJ220f6QiLeMaF7edGM7VjYEBfyw87l+5v5Ek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WCPrbLtb; 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="WCPrbLtb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB6B7C4AF11; Sat, 20 Jul 2024 10:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721471461; bh=CdM0mfeBZ7YQywmo6lZ+gVSYc4tCedR3ptcgXbsWHp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCPrbLtbL4Q6rPYB5/BEnaTJ1XydMHx2TN8Y6Pbn1NyPTV7EApvPrIozFwxVTugKa yOoyDgWJ0kgnO5xRmL/hfpxktXwAPU2CyOYHr74bujCWaYOEiqT3HXtzwYw0D7JbXg TpeY7D5XoD01tRZF0AaT4CTJ8o3MqlJhlM2lA4FxSWUMIFiVMFiF+sIRJbRTEv5Hx+ gbawquz4aZ8qsRX+nqfIUaa59duCN/C7yXyQu5xdiFxfJIi4o5azVD3AwqX2uQnniQ PiM5HJCA8lL0C/5yZ0tXDHNb7/YtohwcJqrDeIYXRUVrAk0MHFjFoeFmzOcADpPTa0 bKiQ41vTyD5sg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/3] kallsyms: add more original symbol type/name in comment lines Date: Sat, 20 Jul 2024 19:30:14 +0900 Message-ID: <20240720103053.2870014-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240720103053.2870014-1-masahiroy@kernel.org> References: <20240720103053.2870014-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit bea5b7450474 ("kallsyms: expand symbol name into comment for debugging") added the uncompressed type/name in the comment lines of kallsyms_offsets. It would be useful to do the same for kallsyms_names and kallsyms_seqs_of_names. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 164c04d22061..e291e34a450b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -456,18 +456,16 @@ static void write_src(void) } for (k = 0; k < table[i]->len; k++) printf(", 0x%02x", table[i]->sym[k]); - printf("\n"); - } - printf("\n"); - /* - * Now that we wrote out the compressed symbol names, restore the - * original names, which are needed in some of the later steps. - */ - for (i = 0; i < table_cnt; i++) { + /* + * Now that we wrote out the compressed symbol name, restore the + * original name and print it in the comment. + */ expand_symbol(table[i]->sym, table[i]->len, buf); strcpy((char *)table[i]->sym, buf); + printf("\t/* %s */\n", table[i]->sym); } + printf("\n"); output_label("kallsyms_markers"); for (i = 0; i < markers_cnt; i++) @@ -536,10 +534,11 @@ static void write_src(void) sort_symbols_by_name(); output_label("kallsyms_seqs_of_names"); for (i = 0; i < table_cnt; i++) - printf("\t.byte 0x%02x, 0x%02x, 0x%02x\n", + printf("\t.byte 0x%02x, 0x%02x, 0x%02x\t/* %s */\n", (unsigned char)(table[i]->seq >> 16), (unsigned char)(table[i]->seq >> 8), - (unsigned char)(table[i]->seq >> 0)); + (unsigned char)(table[i]->seq >> 0), + table[i]->sym); printf("\n"); }