5
5
* This software may be used and distributed according to the terms
6
6
* of the GNU General Public License, incorporated herein by reference.
7
7
*
8
- * Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S
8
+ * Usage: kallsyms [--all-symbols] in.map > out.S
9
9
*
10
10
* Table compression uses all the unused char codes on the symbols and
11
11
* maps these to the most used substrings (tokens). For instance, it might
@@ -37,7 +37,6 @@ struct sym_entry {
37
37
unsigned long long addr ;
38
38
unsigned int len ;
39
39
unsigned int seq ;
40
- bool percpu_absolute ;
41
40
unsigned char sym [];
42
41
};
43
42
@@ -55,14 +54,9 @@ static struct addr_range text_ranges[] = {
55
54
#define text_range_text (&text_ranges[0])
56
55
#define text_range_inittext (&text_ranges[1])
57
56
58
- static struct addr_range percpu_range = {
59
- "__per_cpu_start" , "__per_cpu_end" , -1ULL , 0
60
- };
61
-
62
57
static struct sym_entry * * table ;
63
58
static unsigned int table_size , table_cnt ;
64
59
static int all_symbols ;
65
- static int absolute_percpu ;
66
60
67
61
static int token_profit [0x10000 ];
68
62
@@ -73,7 +67,7 @@ static unsigned char best_table_len[256];
73
67
74
68
static void usage (void )
75
69
{
76
- fprintf (stderr , "Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S\n" );
70
+ fprintf (stderr , "Usage: kallsyms [--all-symbols] in.map > out.S\n" );
77
71
exit (1 );
78
72
}
79
73
@@ -164,7 +158,6 @@ static struct sym_entry *read_symbol(FILE *in, char **buf, size_t *buf_len)
164
158
return NULL ;
165
159
166
160
check_symbol_range (name , addr , text_ranges , ARRAY_SIZE (text_ranges ));
167
- check_symbol_range (name , addr , & percpu_range , 1 );
168
161
169
162
/* include the type field in the symbol name, so that it gets
170
163
* compressed together */
@@ -175,7 +168,6 @@ static struct sym_entry *read_symbol(FILE *in, char **buf, size_t *buf_len)
175
168
sym -> len = len ;
176
169
sym -> sym [0 ] = type ;
177
170
strcpy (sym_name (sym ), name );
178
- sym -> percpu_absolute = false;
179
171
180
172
return sym ;
181
173
}
@@ -319,11 +311,6 @@ static int expand_symbol(const unsigned char *data, int len, char *result)
319
311
return total ;
320
312
}
321
313
322
- static bool symbol_absolute (const struct sym_entry * s )
323
- {
324
- return s -> percpu_absolute ;
325
- }
326
-
327
314
static int compare_names (const void * a , const void * b )
328
315
{
329
316
int ret ;
@@ -455,22 +442,11 @@ static void write_src(void)
455
442
*/
456
443
457
444
long long offset ;
458
- bool overflow ;
459
-
460
- if (!absolute_percpu ) {
461
- offset = table [i ]-> addr - relative_base ;
462
- overflow = offset < 0 || offset > UINT_MAX ;
463
- } else if (symbol_absolute (table [i ])) {
464
- offset = table [i ]-> addr ;
465
- overflow = offset < 0 || offset > INT_MAX ;
466
- } else {
467
- offset = relative_base - table [i ]-> addr - 1 ;
468
- overflow = offset < INT_MIN || offset >= 0 ;
469
- }
470
- if (overflow ) {
445
+
446
+ offset = table [i ]-> addr - relative_base ;
447
+ if (offset < 0 || offset > UINT_MAX ) {
471
448
fprintf (stderr , "kallsyms failure: "
472
- "%s symbol value %#llx out of range in relative mode\n" ,
473
- symbol_absolute (table [i ]) ? "absolute" : "relative" ,
449
+ "relative symbol value %#llx out of range\n" ,
474
450
table [i ]-> addr );
475
451
exit (EXIT_FAILURE );
476
452
}
@@ -725,44 +701,22 @@ static void sort_symbols(void)
725
701
qsort (table , table_cnt , sizeof (table [0 ]), compare_symbols );
726
702
}
727
703
728
- static void make_percpus_absolute (void )
729
- {
730
- unsigned int i ;
731
-
732
- for (i = 0 ; i < table_cnt ; i ++ )
733
- if (symbol_in_range (table [i ], & percpu_range , 1 )) {
734
- /*
735
- * Keep the 'A' override for percpu symbols to
736
- * ensure consistent behavior compared to older
737
- * versions of this tool.
738
- */
739
- table [i ]-> sym [0 ] = 'A' ;
740
- table [i ]-> percpu_absolute = true;
741
- }
742
- }
743
-
744
704
/* find the minimum non-absolute symbol address */
745
705
static void record_relative_base (void )
746
706
{
747
- unsigned int i ;
748
-
749
- for (i = 0 ; i < table_cnt ; i ++ )
750
- if (!symbol_absolute (table [i ])) {
751
- /*
752
- * The table is sorted by address.
753
- * Take the first non-absolute symbol value.
754
- */
755
- relative_base = table [i ]-> addr ;
756
- return ;
757
- }
707
+ /*
708
+ * The table is sorted by address.
709
+ * Take the first symbol value.
710
+ */
711
+ if (table_cnt )
712
+ relative_base = table [0 ]-> addr ;
758
713
}
759
714
760
715
int main (int argc , char * * argv )
761
716
{
762
717
while (1 ) {
763
718
static const struct option long_options [] = {
764
719
{"all-symbols" , no_argument , & all_symbols , 1 },
765
- {"absolute-percpu" , no_argument , & absolute_percpu , 1 },
766
720
{},
767
721
};
768
722
@@ -779,8 +733,6 @@ int main(int argc, char **argv)
779
733
780
734
read_map (argv [optind ]);
781
735
shrink_table ();
782
- if (absolute_percpu )
783
- make_percpus_absolute ();
784
736
sort_symbols ();
785
737
record_relative_base ();
786
738
optimize_token_table ();
0 commit comments