summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2022-11-02 11:49:16 +0300
committerLuis Chamberlain <mcgrof@kernel.org>2022-11-13 05:47:36 +0300
commit19bd8981dc2ee35fdc81ab1b0104b607c917d470 (patch)
treef6aa4bb086792556d242c82f7f6810296705d499 /scripts
parent010a0aad39fccceba4a07d30d163158a39c704f3 (diff)
downloadlinux-19bd8981dc2ee35fdc81ab1b0104b607c917d470.tar.xz
kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[]
kallsyms_seqs_of_names[] records the symbol index sorted by address, the maximum value in kallsyms_seqs_of_names[] is the number of symbols. And 2^24 = 16777216, which means that three bytes are enough to store the index. This can help us save (1 * kallsyms_num_syms) bytes of memory. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kallsyms.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 07ecf7e5c49f..04e04fbd9625 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -600,7 +600,10 @@ static void write_src(void)
sort_symbols_by_name();
output_label("kallsyms_seqs_of_names");
for (i = 0; i < table_cnt; i++)
- printf("\t.long\t%u\n", table[i]->seq);
+ printf("\t.byte 0x%02x, 0x%02x, 0x%02x\n",
+ (unsigned char)(table[i]->seq >> 16),
+ (unsigned char)(table[i]->seq >> 8),
+ (unsigned char)(table[i]->seq >> 0));
printf("\n");
output_label("kallsyms_token_table");