* [PATCH 1/3] kallsyms: avoid repeated calculation of array size for markers
@ 2024-07-20 10:30 Masahiro Yamada
2024-07-20 10:30 ` [PATCH 2/3] kallsyms: use \t instead of a tab in printf() Masahiro Yamada
2024-07-20 10:30 ` [PATCH 3/3] kallsyms: add more original symbol type/name in comment lines Masahiro Yamada
0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-07-20 10:30 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
Introduce the markers_cnt variable for readability.
No functional change intended.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
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 <asm/bitsperlong.h>\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");
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/3] kallsyms: use \t instead of a tab in printf()
2024-07-20 10:30 [PATCH 1/3] kallsyms: avoid repeated calculation of array size for markers Masahiro Yamada
@ 2024-07-20 10:30 ` Masahiro Yamada
2024-07-20 10:30 ` [PATCH 3/3] kallsyms: add more original symbol type/name in comment lines Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-07-20 10:30 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
This string literal uses a mixture of \t escape sequences and a tab.
Use \t consistently.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
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");
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 3/3] kallsyms: add more original symbol type/name in comment lines
2024-07-20 10:30 [PATCH 1/3] kallsyms: avoid repeated calculation of array size for markers Masahiro Yamada
2024-07-20 10:30 ` [PATCH 2/3] kallsyms: use \t instead of a tab in printf() Masahiro Yamada
@ 2024-07-20 10:30 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-07-20 10:30 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
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 <masahiroy@kernel.org>
---
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");
}
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-20 10:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-20 10:30 [PATCH 1/3] kallsyms: avoid repeated calculation of array size for markers Masahiro Yamada
2024-07-20 10:30 ` [PATCH 2/3] kallsyms: use \t instead of a tab in printf() Masahiro Yamada
2024-07-20 10:30 ` [PATCH 3/3] kallsyms: add more original symbol type/name in comment lines Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®