linux/scripts/kallsyms.c
<<
>>
Prefs
   1/* Generate assembler source containing symbol information
   2 *
   3 * Copyright 2002       by Kai Germaschewski
   4 *
   5 * This software may be used and distributed according to the terms
   6 * of the GNU General Public License, incorporated herein by reference.
   7 *
   8 * Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S
   9 *
  10 *      Table compression uses all the unused char codes on the symbols and
  11 *  maps these to the most used substrings (tokens). For instance, it might
  12 *  map char code 0xF7 to represent "write_" and then in every symbol where
  13 *  "write_" appears it can be replaced by 0xF7, saving 5 bytes.
  14 *      The used codes themselves are also placed in the table so that the
  15 *  decompresion can work without "special cases".
  16 *      Applied to kernel symbols, this usually produces a compression ratio
  17 *  of about 50%.
  18 *
  19 */
  20
  21#include <stdio.h>
  22#include <stdlib.h>
  23#include <string.h>
  24#include <ctype.h>
  25
  26#ifndef ARRAY_SIZE
  27#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
  28#endif
  29
  30#define KSYM_NAME_LEN           128
  31
  32struct sym_entry {
  33        unsigned long long addr;
  34        unsigned int len;
  35        unsigned int start_pos;
  36        unsigned char *sym;
  37};
  38
  39struct text_range {
  40        const char *stext, *etext;
  41        unsigned long long start, end;
  42};
  43
  44static unsigned long long _text;
  45static struct text_range text_ranges[] = {
  46        { "_stext",     "_etext"     },
  47        { "_sinittext", "_einittext" },
  48        { "_stext_l1",  "_etext_l1"  }, /* Blackfin on-chip L1 inst SRAM */
  49        { "_stext_l2",  "_etext_l2"  }, /* Blackfin on-chip L2 SRAM */
  50};
  51#define text_range_text     (&text_ranges[0])
  52#define text_range_inittext (&text_ranges[1])
  53
  54static struct sym_entry *table;
  55static unsigned int table_size, table_cnt;
  56static int all_symbols = 0;
  57static char symbol_prefix_char = '\0';
  58
  59int token_profit[0x10000];
  60
  61/* the table that holds the result of the compression */
  62unsigned char best_table[256][2];
  63unsigned char best_table_len[256];
  64
  65
  66static void usage(void)
  67{
  68        fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n");
  69        exit(1);
  70}
  71
  72/*
  73 * This ignores the intensely annoying "mapping symbols" found
  74 * in ARM ELF files: $a, $t and $d.
  75 */
  76static inline int is_arm_mapping_symbol(const char *str)
  77{
  78        return str[0] == '$' && strchr("atd", str[1])
  79               && (str[2] == '\0' || str[2] == '.');
  80}
  81
  82static int read_symbol_tr(const char *sym, unsigned long long addr)
  83{
  84        size_t i;
  85        struct text_range *tr;
  86
  87        for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
  88                tr = &text_ranges[i];
  89
  90                if (strcmp(sym, tr->stext) == 0) {
  91                        tr->start = addr;
  92                        return 0;
  93                } else if (strcmp(sym, tr->etext) == 0) {
  94                        tr->end = addr;
  95                        return 0;
  96                }
  97        }
  98
  99        return 1;
 100}
 101
 102static int read_symbol(FILE *in, struct sym_entry *s)
 103{
 104        char str[500];
 105        char *sym, stype;
 106        int rc;
 107
 108        rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
 109        if (rc != 3) {
 110                if (rc != EOF && fgets(str, 500, in) == NULL)
 111                        fprintf(stderr, "Read error or end of file.\n");
 112                return -1;
 113        }
 114
 115        sym = str;
 116        /* skip prefix char */
 117        if (symbol_prefix_char && str[0] == symbol_prefix_char)
 118                sym++;
 119
 120        /* Ignore most absolute/undefined (?) symbols. */
 121        if (strcmp(sym, "_text") == 0)
 122                _text = s->addr;
 123        else if (read_symbol_tr(sym, s->addr) == 0)
 124                /* nothing to do */;
 125        else if (toupper(stype) == 'A')
 126        {
 127                /* Keep these useful absolute symbols */
 128                if (strcmp(sym, "__kernel_syscall_via_break") &&
 129                    strcmp(sym, "__kernel_syscall_via_ep_") &&
 130                    strcmp(sym, "__kernel_sigtramp") &&
 131                    strcmp(sym, "__gp"))
 132                        return -1;
 133
 134        }
 135        else if (toupper(stype) == 'U' ||
 136                 is_arm_mapping_symbol(sym))
 137                return -1;
 138        /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
 139        else if (str[0] == '$')
 140                return -1;
 141        /* exclude debugging symbols */
 142        else if (stype == 'N')
 143                return -1;
 144
 145        /* include the type field in the symbol name, so that it gets
 146         * compressed together */
 147        s->len = strlen(str) + 1;
 148        s->sym = malloc(s->len + 1);
 149        if (!s->sym) {
 150                fprintf(stderr, "kallsyms failure: "
 151                        "unable to allocate required amount of memory\n");
 152                exit(EXIT_FAILURE);
 153        }
 154        strcpy((char *)s->sym + 1, str);
 155        s->sym[0] = stype;
 156
 157        return 0;
 158}
 159
 160static int symbol_valid_tr(struct sym_entry *s)
 161{
 162        size_t i;
 163        struct text_range *tr;
 164
 165        for (i = 0; i < ARRAY_SIZE(text_ranges); ++i) {
 166                tr = &text_ranges[i];
 167
 168                if (s->addr >= tr->start && s->addr <= tr->end)
 169                        return 1;
 170        }
 171
 172        return 0;
 173}
 174
 175static int symbol_valid(struct sym_entry *s)
 176{
 177        /* Symbols which vary between passes.  Passes 1 and 2 must have
 178         * identical symbol lists.  The kallsyms_* symbols below are only added
 179         * after pass 1, they would be included in pass 2 when --all-symbols is
 180         * specified so exclude them to get a stable symbol list.
 181         */
 182        static char *special_symbols[] = {
 183                "kallsyms_addresses",
 184                "kallsyms_num_syms",
 185                "kallsyms_names",
 186                "kallsyms_markers",
 187                "kallsyms_token_table",
 188                "kallsyms_token_index",
 189
 190        /* Exclude linker generated symbols which vary between passes */
 191                "_SDA_BASE_",           /* ppc */
 192                "_SDA2_BASE_",          /* ppc */
 193                NULL };
 194        int i;
 195        int offset = 1;
 196
 197        /* skip prefix char */
 198        if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
 199                offset++;
 200
 201        /* if --all-symbols is not specified, then symbols outside the text
 202         * and inittext sections are discarded */
 203        if (!all_symbols) {
 204                if (symbol_valid_tr(s) == 0)
 205                        return 0;
 206                /* Corner case.  Discard any symbols with the same value as
 207                 * _etext _einittext; they can move between pass 1 and 2 when
 208                 * the kallsyms data are added.  If these symbols move then
 209                 * they may get dropped in pass 2, which breaks the kallsyms
 210                 * rules.
 211                 */
 212                if ((s->addr == text_range_text->end &&
 213                                strcp/a>                            for (i = 0; ioffset++;
text_range_text->etext) == 0) {
 114
<2 href21              s->addr == text_range_inittext (&end &&
 115  2     21              return 0;
strcp/a>                            for (i = 0; ioffset++;
text_range_inittext (&etext) == 0) {
 116  2     21        117  2     21 118  2     21scripts/kallsyms.c#L99" id="L99" cl2lass="lin2" name="L119"> 119
<2 href21 href="+code=ement">/* Exclude linker generateary between passes */
  20
f">str);
        for (i = 0; ioffset++;
"_SDA2_BASE_"therilymb
 121  2     22       122  2     2      ts/kallsyms.c#L206" id="L206" class="line" name="L123"> 123  2     2lse if (i = 0; special_symbols[] = {
i];
i;
 124  2     2       strcp/a>                            for (i = 0; ioffset++;
special_symbols[] = {
i];
 125  2     22              return 0;
 126  2     22scripts/kallsyms.c#L197" id="L197" 2lass="lin2" name="L127"> 127  2     22turn 0;
 128  2     22"scripts/kallsyms.c#L159" id="L159" 2lass="lin2" name="L129"> 129  2     22scripts/kallsyms.c#L190" id="L190" 2        e2se if ( 130  2     23 FILE *in, struct  131  2     23"scripts/kallsyms.c#L162" id="L162" 2lass="lin2" name="L132"> 132  2     2              eenlede=all_symbols" clfeo>fprintf(code=s" class="sref"">in, struct  133
<2 href23                     ode=toupper" class="="sref">table_cnt;
table_size,  134  2     23              table_size,  135  2     23              return 0;
malloc(ef">code=s" class="sref""s="stable_size, table_size,  136  2     2         137  2     2       return -1;
fprintf(stderr, "kallsyms failurouuot;);
 138  2     23      exit( 139  2     23              return 1;
 140  2     2       return -1;
 141  2     24      in, table_cnt;
 142  2     24              return -1;
table_cnt;
table_cnt;
 143  2     2       return -1;
table_cnt;
 144
<2 href24               145  2     2span class="copts/kallsyms.c#L159" id="L159" 2lass="lin2" name="L146"> 146 147  2     24scripts/kallsyms.c#L168" id="L168" 2lass="lin2" name="L148"> 148  2     2a hrefref="+ccode=usage" class="souuput_labeestrcp/a>       ouuput_labeecode=+code=special_symbolslabeestrcp/a>       labeecodepts/kallsyms.c#L132" id="L132" 2lass="lin2" name="L149"> 149  2     2f (! 150  2     25pan class="coode=str" class="srefar" class="sref">symbol_prefix_char)
 151  2     2               fprintf("kallsyms failur.globl9s\n&qus\n&q>, &symbol_prefix_char)
 152  2     25se if ( 153  2     25      fprintf("kallsyms failur.globl9s\n&q>, & 154  2     2a href="+code=strcpy" class="sref">fprintf("kallsyms failur\tALGN);
 155  2     2a href="+code=ode=str" class="srefar" class="sref">symbol_prefix_char)
 156
<2 href25      fprintf("kallsyms failurs\n&qus\n&q>:, &symbol_prefix_char)
 157  2     2eturn 0;
 158}
2a hre25      fprintf("kallsyms failurs\n&q>:, & 159
<2 href2"scrippts/kallsyms.c#L159" id="L159" 2lass="lin2" name="L160"> 160st2tic i26scripts/kallsyms.c#L201" id="L201" class="lin2" name="L161"> 161{
2a hre26s="comment">               /* unther */< aether */ 162  2     26s="comment">         * and i* might still pasther */ 163  2     2truct ref="+code=symbol_valid" cexcriass="srestrcp/a>       excriass="srecode=ong          Ifscri"+ode=symbol_valid" cf">len + 1);
table_cnt;
 */ul>scripts/kallsyms.c#L199" id="L199" 2lass="lin2" name="L164"> 164
<2 href2"scrippts/kallsyms.c#L94" id="L94" cl2lass="lin2" name="L165"> 165  2     26t strlen(       aotaeref==rpts/kallsyms.c#L196" id="L196" 2lass="lin2" name="L166"> 166  2     26scripts/kallsyms.c#L197" id="L197" 2lass="lin2" name="L167"> 167
<2 href26turn 0;
len + 1);
 168  2     2       if ( 169  2     2               return mment">/* if --all-symbols i

as as 170  2     27s="comment">                 * rules.
 171
<2 href27      malloc(len + 1);
ef=""i" class="sref">malloc( 172  2     27              return -1;
table_cnt;
 */ul>scri+++cousage" class="s>malloc( 173}
2a hre27      return -1;
       aotaeref=ripts/kallsyms.c#L200" id="L200" class="lin2" name="L174"> 174
<2 href27               175st2tic i27              return 0;
/* if --all-symbols inot,t ocursean>
 176{
2a hre27       strlen(       excriass="srecode=read_symbol_tr"best_as="stable_size,best_as="sef=""i" class="sref">malloc(len + 1);
ef=""i" class="sref">malloc( 177  2     27      return -1;
       aotaeref= += str" class="sreef">strlen( 178strlen( 179 180         Ifscriripts/kallsyms.c#L200" id="L200" class="lin2" name="L181"> 181len + 1);
 182  2     2tatic char * 183  2     2       table_cnt;
 */ul>scri=rpts/kallsyms.c#L196" id="L196" 2lass="lin2" name="L184"> 184  2     28scripts/kallsyms.c#L175" id="L175" 2lass="lin2" name="L185"> 185  2     2              aotaeref=pts/kallsyms.c#L196" id="L196" 2lass="lin2" name="L186"> 186  2     28s="copts/kallsyms.c#L159" id="L159" 2lass="lin2" name="L187"> 187  2     28scripts/kallsyms.c#L168" id="L168" 2lass="lin2" name="L188"> 188  2     28 hrefref="+ccode=usage" class="swrite_s">rc != code=codepts/kallsyms.c#L199" id="L199" 2lass="lin2" name="L189"> 189
<2 href28 (! 190  2     2span class="coong i;
 191  2     2        + 1);
 192  2     2       ,
len + 1);
,
ref=pts/kallsyms.c#L196" id="L196" 2lass="lin2" name="L193"> 193  2     2       ( 194  2     29scripts/kallsyms.c#L175" id="L175" 2lass="lin2" name="L195"> 195  2     2nt fprintf("kallsyms failur#e field +codasm/ef="s.h+cod);
 196
<2 href296 fprintf("kallsyms failur#ef BITS_PER_LONGf="s64);
 197  2     29 href="+code=s" class="sref"sref">fprintf("kallsyms failur#bols.  PTR .quad);
 198  2     29 href="+code=s" class="sref"sref">fprintf("kallsyms failur#bols.  ALGN .al  199  2     2       fprintf("kallsyms failur#f="+);
 200
<3 href300href="+code=s" class="sref"sref">fprintf("kallsyms failur#bols.  PTR .long);
 191  3     3span class="com" class="sref"sref">fprintf("kallsyms failur#bols.  ALGN .al  202fprintf("kallsyms failur#fndif);
 193  3     30scripts/kallsyms.c#L134" id="L134" 3lass="lin3" name="L204"> 204  3     30 href="+code=strcpy" class="sref">fprintf("kallsyms failur\t.scarded .ro  If, \failura\failur);
 195  3     3      ts/kallsyms.c#L152" id="L152" 3l6ss="lin3" name="L196"> 196
<3     3       /* if --all-symbolProvpan>propereary betwre amouability bytas) = href="scrits/kallsyms.c#L152" id="L152" 3l7ss="lin3" name="L197"> 197  3an cl3ss="comment">                 * _etex*wre f="veness_* symbsthat it ge, otnthenbte syspan con"+codef="scrits/kallsyms.c#L152" id="L152" 3l8ss="lin3" name="L198"> 198  3an cl3ss="comment">                 * the k */ 209                 * they  are only pan>
/  emorref="+criar/ 210                 * rules* .o files_* syis 211                 */;hemf="scripts/kallsyms.c#L211" id="L211" 3lass="lin3" name="L212"> 212  3     31s="comment">         * and inittext sf="scripts/kallsyms.c#L121" id="L121" 3lass="lin3" name="L213"> 213  3     3              str" class="sreouuput_labeestrcp/a>       ouuput_labeecode=ring">"kallsyms_addresses",
 114
<3 href31             code=i" class="sref">i = 0; i < table_cnt;
i;
 115  3     31              return ode=toupper" class="sref">toupper(, i];
sym[0] = 'A')
 116  3     31       text_range_texta href="+"+code=tr" class="sref"s="stable_size, i];
addr ==  117  3     31      return -1;
fprintf("kallsyms failur\tPTR\ta hre +9s\n&q#llx, & 118  3     31      i];
addr == text_range_texta href="+ipts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L119"> 119
<3 href31              return 1;
  20
fprintf("kallsyms failur\tPTR\ta hre -9s\n&q#llx, & 121  3     32      text_range_texta href="+"-rer" class="sref"s="stable_size, i];
addr ==  122  3     32              return pef="+cpts/kallsyms.c#L94" id="L94" cl3lass="lin3" name="L123"> 123  3     32      return -1;
fprintf("kallsyms failur\tPTR\ts\n&q#llx, &i];
addr ==  124  3     3        125  3     32pan class="copts/kallsyms.c#L159" id="L159" 3lass="lin3" name="L126"> 126  3     326 fprintf("kallsyms failur);
 127  3     32scripts/kallsyms.c#L168" id="L168" 3lass="lin3" name="L128"> 128  3     32 href="+code=s" class="sref"ouuput_labeestrcp/a>       ouuput_labeecode=ring">"kallsyms_addresses"/span>,
 129  3     32      fprintf("kallsyms failur\tPTR\ts\n&qd);
table_cnt;
 130  3     330href="+code=s" class="sref"sref">fprintf("kallsyms failur);
 131  3     33scripts/kallsyms.c#L172" id="L172" 3lass="lin3" name="L132"> 132  3     3              ement">/* if --all-symbolht.,
, pan>
gi 133
<3 href33     mment">                 */ 134  3     33 href="+code=strcpy" class="span>,
len + 1);
,
ref=de=malloc" class="sref">malloc(table_cnt;
 135  3     33 href="+code=ode==all_symbols" clspan>,
len + 1);
,
ref=pcpts/kallsyms.c#L94" id="L94" cl3lass="lin3" name="L136"> 136  3     3        fprintf(stderr, "kallsyms failure: "
 137  3     3       return -1;
"unable to allocate required amount of memor/span>);
 138  3     33      exit(EXIT_FAILURE);
 139  3     33             pts/kallsyms.c#L159" id="L159" 3lass="lin3" name="L140"> 140  3     34scripts/kallsyms.c#L201" id="L201" 3lass="lin3" name="L141"> 141  3     34pan class="com" class="sref"ouuput_labeestrcp/a>       ouuput_labeecode=ring">"kallsyms_addresses"/a>,
 142  3     34 href="+code=size_t" class="of>fprintf(ref=+codets/kallsyms.c#L153" id="L153" 3lass="lin3" name="L143"> 143  3     34se if (i = 0; i < table_cnt;
i;
 144
<3 href34              i <  145  3     34              return 0;
,
len + 1);
,
ref="i" class="sref">i];
 146 147  3     34      fprintf("kallsyms failur\t.byunt0xs\n&q02x&i];
len + 1);
 148  3     34      ;
;
i];
len + 1);
;
 149  3     34              return 1;
fprintf("kallsyms failur,t0xs\n&q02x&i];
sym[0] = ;
 150  3     35      fprintf("kallsyms failur);
 151  3     35scripts/kallsyms.c#L172" id="L172" 3lass="lin3" name="L152"> 152  3     35              return size_t" class="of>fprintf(ref=++= str" class="sres="srtable_size, i];
len + 1);
 153  3     35       154  3     3a href="+code=strcpy" class="sref">fprintf("kallsyms failur\;
 155  3     35     ts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L156"> 156
<3 href356 "kallsyms_addresses"span>,
 157  3     3eturn 0;
i = 0; i < table_cnt;
i;
 158}
3a hre35      fprintf("kallsyms failur\tPTR\ts\n&qd);
i];
 159
<3 href35      fprintf("kallsyms failur\;
 160st3tic i36scripts/kallsyms.c#L201" id="L201" 3lass="lin3" name="L161"> 161{
3a hre36pan class="com" class="sref"frertable_size,frercode=EXIT_FAILURE" cspan>,
len + 1);
,
ref=ppts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L162"> 162  3     36     ts/kallsyms.c#L206" id="L206" 3lass="lin3" name="L163"> 163  3     36             str" class="sreouuput_labeestrcp/a>       ouuput_labeecode=ring">"kallsyms_addresses"t;,
 164
<3 href36 href="+code=strcpy" class="of>fprintf(ref=+codets/kallsyms.c#L153" id="L153" 3lass="lin3" name="L165"> 165  3     36t i = 0; i < i;
 166  3     36        + 1);
i];
 167
<3 href36             excriass="srecode=read_symbol_tr"best_as="stable_size,best_as="sef=""i" class="sref">i];
len + 1);
ef=""i" class="sref">i];
fprintf(ef="ppts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L168"> 168  3     3       if (fprintf("kallsyms failur\t.asciz\t\failurs\n&q>\failur);
fprintf(ef="ppts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L169"> 169  3     3               return mize_t" class="of>fprintf(ref=++= str" class="sreallf">len + 1);
code=read_symbol_tr"bu>fprintf(ef="pf="+pts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L170"> 170  3     37       171
<3 href37pan class="com" class="sref"sref">fprintf("kallsyms failur\;
 172  3     37     ts/kallsyms.c#L206" id="L206" 3lass="lin3" name="L173"> 173}
3a hre37             str" class="sreouuput_labeestrcp/a>       ouuput_labeecode=ring">"kallsyms_addresses"t; 174
<3 href37             code=i" class="sref">i = 0; i < i;
 175st3tic i37              return offset" class="sref">fprintf("kallsyms failur\t.short\ts\n&qd);
i];
 176{
3a hre376 fprintf("kallsyms failur);
 177  3     37     pts/kallsyms.c#L159" id="L159" 3lass="lin3" name="L178"> 178 179 180               bolht. 181 182  3     38s="comment">         * and bolcountred e, sopo/ 183  3     38ruct ref="+ccode=usage" class="slearnss="srestrcp/a>       learnss="srecode=ong        s="srecode"+ode=symbol_valid" cf">len + 1);
 184  3     38scrippts/kallsyms.c#L94" id="L94" cl3lass="lin3" name="L185"> 185  3     3       i;
 186  3     38scripts/kallsyms.c#L197" id="L197" 3lass="lin3" name="L187"> 187  3     38turn 0;
i = 0; i < len + 1);
i;
 188  3     38      if (exit(ef=""+str" class="srefar" cstrcp/a>       s="srecode"i" class="sref">i];
       s="srecode"i" class="sref">i];
 189
<3 href38scrippts/kallsyms.c#L159" id="L159" 3lass="lin3" name="L190"> 190  3     39scripts/kallsyms.c#L201" id="L201" 3lass="lin3" name="L191"> 191  3     39s="comment">               /* decreasee, sothuntrcodeed e, sopo/ 192  3     3      ref="+ccode=usage" class="scodgetss="srestrcp/a>       codgetss="srecode=ong        s="srecode"+ode=symbol_valid" cf">len + 1);
 193  3     3      pts/kallsyms.c#L94" id="L94" cl3lass="lin3" name="L194"> 194  3     394     i;
 195  3     39     ts/kallsyms.c#L152" id="L152" 3lass="lin3" name="L196"> 196
<3 href396 i = 0; i < len + 1);
i;
 197  3     39      exit(ef=""+str" class="srefar" cstrcp/a>       s="srecode"i" class="sref">i];
       s="srecode"i" class="sref">i];
 198  3     39"scripts/kallsyms.c#L159" id="L159" 3lass="lin3" name="L199"> 199  3     39scripts/kallsyms.c#L190" id="L190" 4lass="lin4" name="L200"> 200
<4 href40s="comment">               bolremoveeed e, soinvalidare only froml
 191  4     4span cref="+ccode=usage" class="sbuild_initial;t;<_as="stable_size,build_initial;t;<_as="scode=codepts/kallsyms.c#L199" id="L199" 4lass="lin4" name="L202"> 202 193  4     40             ong i;
 204  4     40scripts/kallsyms.c#L175" id="L175" 4l5ss="lin4" name="L195"> 195  4     40t  196
<4     406 i = 0; i < table_cnt;
i;
 197  4an cl40             s="sre_validcode=code=text_ranges" clas="stable_size, i];
 198  4an cl40      special_symbolspo>ef="+!= str" class="sre>i];
 199  4an cl40              return 1;
, special_symbolspo>ef="]de=stype" class="sas="stable_size, i];
 210       learnss="srecode=rtrcpy" class="ts="stable_size, special_symbolspo>ef="].stderr" class="s">sym[0] = special_symbolspo>ef="].stderr" class="f">len + 1);
 211special_symbolspo>ef="ripts/kallsyms.c#L200" id="L200" 4lass="lin4" name="L212"> 212  4     41              return pts/kallsyms.c#L200" id="L200" 4l3ss="lin4" name="L213"> 213  4     41       114
<4 href41 href="+code=strcpy" class=""="sref">table_cnt;
 115  4     41     pts/kallsyms.c#L159" id="L159" 4l6ss="lin4" name="L116"> 116  4     41scripts/kallsyms.c#L197" id="L197" 4lass="lin4" name="L117"> 117  4     41     ref="+ccode==special_symbolsfind;t;       cind;t;stderr, len + 1);
       t; 118  4     41     pts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L119"> 119
<4 href41             ode=i" class="sref">i;
  20
 121  4     42      i = 0; i < len + 1);
i;
 122  4     42              return ode=str" class="sreft>stderr, i];
stderr, i];
 123  4     42      return -1;
stderr, i];
 124  4     4        125  4     42pan class="coef="scrtext_ranges" clNULLi];
 126  4     42s="copts/kallsyms.c#L159" id="L159" 4lass="lin4" name="L127"> 127  4     42scripts/kallsyms.c#L168" id="L168" 4lass="lin4" name="L128"> 128  4     42s="comment">               bolreplace a
gi 129  4     42s="comment">                *quirupdountt sothunty sf="scripts/kallsyms.c#L121" id="L121" 4        e4se if ( 130  4     430hrefref="+ccode=usage" class="sther */special_symbolsther */code=ong stderr,  + 1);
 131  4     43scrippts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L132"> 132  4     43      i;
len + 1);
,sizsscripts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L133"> 133
<4 href43             ong ,p1ref=, =special_symbolsp2table_size,p2scripts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L134"> 134  4     43scripts/kallsyms.c#L175" id="L175" 4lass="lin4" name="L135"> 135  4     43t i = 0; i < table_cnt;
i;
 136  4     43scripts/kallsyms.c#L197" id="L197" 4lass="lin4" name="L137"> 137  4     4       return -1;
len + 1);
, i];
len + 1);
 138  4     43      , i];
sym[0] =  139  4     43scripts/kallsyms.c#L190" id="L190" 4lass="lin4" name="L140"> 140  4     44                     bolcindl
 141  4     44              len + 1);
stderr,  142  4     44              return ode==all_symbols" clp2table_size,p2scri)wcontinuepts/kallsyms.c#L196" id="L196" 4lass="lin4" name="L143"> 143  4     44scripts/kallsyms.c#L134" id="L134" 4lass="lin4" name="L144"> 144
<4 href44                             /* decreasee, sothuntsccodet intThe kaa hresqui 145  4     44              return str" class="srefodgetss="srestrcp/a>       codgetss="srecode=str" class="sres="srtable_size, i];
sym[0] = len + 1);
 146 147  4     44      len + 1);
 148  4     44scripts/kallsyms.c#L99" id="L99" cl4lass="lin4" name="L149"> 149  4     44              return docpts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L150"> 150  4     45       151  4     45      ,p2scriripts/kallsyms.c#L200" id="L200" 4lass="lin4" name="L152"> 152  4     45              return lass="strtrcpy" class="sizstable_size,sizsscrif-=e=toupper" class=s2table_size,p2scrif-rer" class="srefp1table_size,p1ref=rpts/kallsyms.c#L196" id="L196" 4lass="lin4" name="L153"> 153  4     45      return -1;
,memmovecode=special_symbolsp2table_size,p2scri"+str" class="srep2table_size,p2scrif+ 1, special_symbolssizstable_size,sizsscrirpts/kallsyms.c#L196" id="L196" 4lass="lin4" name="L154"> 154  4     45              ,p1ref=f= str" class="srep2table_size,p2scripts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L155"> 155  4     45              return 0;
len + 1);
 156
<4 href45scripts/kallsyms.c#L197" id="L197" 4lass="lin4" name="L157"> 157  4     45      return -1;
 158}
4a hre45scripts/kallsyms.c#L99" id="L99" cl4lass="lin4" name="L159"> 159
<4 href45              return 1;
               bolcindl
 160st4tic i46           161{
4a hre46scripts/kallsyms.c#L172" id="L172" 4lass="lin4" name="L162"> 162  4     46              return pewhilee=toupper" class=s2table_size,p2scrirpts/kallsyms.c#L196" id="L196" 4lass="lin4" name="L163"> 163  4     46scripts/kallsyms.c#L134" id="L134" 4lass="lin4" name="L164"> 164
<4 href46              , i];
len + 1);
len + 1);
 165  4     46     ts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L166"> 166  4     46                      bolincreasee, sothuntsccodet intThe kaa hresqnewqui 167
<4 href46             learnss="srecode=rtrcpy" class="ts="stable_size, i];
sym[0] = len + 1);
 168  4     4       if ( 169  4     46scrippts/kallsyms.c#L159" id="L159" 4lass="lin4" name="L170"> 170  4     47scripts/kallsyms.c#L201" id="L201" 4lass="lin4" name="L171"> 171
<4 href47s="comment">               /* searchl
 sf="scripts/kallsyms.c#L121" id="L121" 4lass="lin4" name="L172"> 172  4     47     ref="+code=i" class="sref"cind;best_a;       cind;best_a; 173}
4a hre47     pts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L174"> 174
<4 href474     i;
exit(ref=pts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L175"> 175st4tic i47     ts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L176"> 176{
4a hre476 exit(ref==-10000pts/kallsyms.c#L152" id="L152" 4lass="lin4" name="L177"> 177  4     47 href="+code=s" class="sref"besti;
 178 179i = 0; i < i;
 180exit(ef=""i" class="sref">i];
exit(ref=pcpts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L181"> 181;
i];
 182  4     48              return lass="strtrcpy" class="bestprof">exit(ref=f= str" class="sressexit(ef=""i" class="sref">i];
 183  4     48      return -1;
 184  4     48       185  4     48pan class="coef="scrtext_ranges" clbesti;
 186  4     48s="copts/kallsyms.c#L159" id="L159" 4lass="lin4" name="L187"> 187  4     48scripts/kallsyms.c#L168" id="L168" 4lass="lin4" name="L188"> 188  4     48s="comment">               bolt intise, sothr/sof , soalgorithm: calculountt so
 189
<4 href48scripref="+ccode=usage" class="soptimize_resulti;
 190  4     49scrippts/kallsyms.c#L94" id="L94" cl4lass="lin4" name="L191"> 191  4     49      i;
 192  4     49     ts/kallsyms.c#L206" id="L206" 4lass="lin4" name="L193"> 193  4     49             sment">               boluspan>;he a hre\0a hreoThe kal   tred ows ther */quiruseerefndard="scripts/kallsyms.c#L121" id="L121" 4lass="lin4" name="L194"> 194  4     494    mment">                 */ 195  4     49t i = 0; i < i;
 196
<4 href49scripts/kallsyms.c#L197" id="L197" 4lass="lin4" name="L197"> 197  4     49                     boliflt intht. 198  4     49s="comment">                 * the k */ 199  4     49              return ode==all_symbols" clbest_as="s_f">len + 1);
ef=""i" class="sref">i];
 200
<5 href50scripts/kallsyms.c#L201" id="L201" 5l1ss="lin5" name="L191"> 191  5     50                     bolcindl
 valuf sf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L202"> 202       cind;best_a; 193  5     50      return -1;
exit(ef=""i" class="sref"besti;
 204  5     50               195  5     50     ts/kallsyms.c#L152" id="L152" 5l6ss="lin5" name="L196"> 196
<5     50                      bolplace if ame, so
 197  5an cl50      len + 1);
ef=""i" class="sref">i];
 198  5an cl50       + 1);
i];
;
 199  5an cl50              return 1;
 + 1);
i];
;
 210 211               bolreplace t inthi 212  5     51              return 1;
special_symbolsther */code=rtrcpy" class="best_as="slen + 1);
i];
 213  5     51      return -1;
 114
<5 href51       115  5     51     pts/kallsyms.c#L159" id="L159" 5l6ss="lin5" name="L116"> 116  5     51scripts/kallsyms.c#L197" id="L197" 5lass="lin5" name="L117"> 117  5     51     mment">               /* startpby placpan>;he s="sre>quan>
are"actuallyn syspome, soht. 118  5     51     ref="+ccode=usage" class="sinsert_realss="sre>_in_as="slen + 1);
_in_as="scode=codepts/kallsyms.c#L199" id="L199" 5lass="lin5" name="L119"> 119
<5 href51     pts/kallsyms.c#L94" id="L94" cl5ass="line5" name="L20">  20
i;
 121  5     52scripts/kallsyms.c#L172" id="L172" 5lass="lin5" name="L122"> 122  5     52             str" class="srememseti;
 + 1);
 + 1);
 123  5     52             str" class="srememseti;
len + 1);
ef=", 0, ef="of(rtrcpy" class="best_as="s_f">len + 1);
ef=")ipts/kallsyms.c#L152" id="L152" 5lass="lin5" name="L124"> 124  5     52scripts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L125"> 125  5     52t i = 0; i < table_cnt;
i;
 126  5     52       ;
;
i];
len + 1);
;
 127  5     52      , i];
sym[0] = ;
 128  5     52       + 1);
malloc( 129  5     52              return 1;
len + 1);
ef=""i" class="sref">malloc( 130  5     53           131  5     53       132  5     53     pts/kallsyms.c#L159" id="L159" 5lass="lin5" name="L133"> 133
<5 href53scripts/kallsyms.c#L134" id="L134" 5lass="lin5" name="L134"> 134  5     53scripref="+ccode=usage" class="soptimize_t;,
i;
,
code=codepts/kallsyms.c#L199" id="L199" 5lass="lin5" name="L135"> 135  5     53t  136  5     536 ,build_initial;t;<_as="scode=ipts/kallsyms.c#L152" id="L152" 5lass="lin5" name="L137"> 137  5     53scripts/kallsyms.c#L168" id="L168" 5lass="lin5" name="L138"> 138  5     53      _in_as="slen + 1);
_in_as="scode=ipts/kallsyms.c#L152" id="L152" 5lass="lin5" name="L139"> 139  5     53scripts/kallsyms.c#L190" id="L190" 5lass="lin5" name="L140"> 140  5     54                     /* Whenovalidare onltisethenregistered, exitquirerrodesf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L141"> 141  5     54             ode==all_symbols" cls="sref">table_cnt;
 142  5     54              return i" class="sref"csref">fprintf("kallsyms failurNoovalidare onl.);
 143  5     54      return -1;
 144
<5 href54       145  5     54     ts/kallsyms.c#L152" id="L152" 5lass="lin5" name="L146"> 146 147  5     54     pts/kallsyms.c#L159" id="L159" 5lass="lin5" name="L148"> 148  5     54scripts/kallsyms.c#L99" id="L99" cl5lass="lin5" name="L149"> 149  5     54s="comment">               /* guessccode
ker s.c#L9 provid
 150  5     550hrefref="+code=i" class="sref"may_bs_f">ker_s.c#L1_provid
ss="srestrcp/a>       may_bs_f">ker_s.c#L1_provid
ss="srecode=con tralluce=i" class="sref"s="_   rysym[0] = ,ssef=")ts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L151"> 151  5     55scrippts/kallsyms.c#L94" id="L94" cl5lass="lin5" name="L152"> 152  5     55             con tr+code=special_symbolss="srestrcp/a>       s="srecodedee=+code=)special_symbolssstable_size,ssef="-+codstderr" class="s">sym[0] =  153  5     55      return ode=symbol_valid" cf">len + 1);
len + 1);
 154  5     55scripts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L155"> 155  5     55             ode=toupper" class=f">len + 1);
 156
<5 href55        157  5     55scripts/kallsyms.c#L168" id="L168" 5lass="lin5" name="L158"> 158}
5a hre55             s="srecode"0]+!= sing">"kallsyms f hre_f hre="scrip ||+str" class="srefar" cstrcp/a>       s="srecode"1]+!= sing">"kallsyms f hre_f hre="scrip)ts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L159"> 159
<5 href55              return ef="scrdets/kallsyms.c#L153" id="L153" 5lass="lin5" name="L160"> 160st5tic i56scripts/kallsyms.c#L201" id="L201" 5lass="lin5" name="L161"> 161{
5a hre56pan class="comment">               /* __start_XXXXXlsf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L162"> 162  5     56             ode==all_symbols" clmemcmpi;
       s="srecoded+ 2"+sing">"kallsyms failurstart_
 163  5     56      return -1;
 164
<5 href56scripts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L165"> 165  5     56t                /* __stop_XXXXXlsf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L166"> 166  5     56       ;
       s="srecoded+ 2"+sing">"kallsyms failurstop_
 167
<5 href56       168  5     56scripts/kallsyms.c#L99" id="L99" cl5lass="lin5" name="L169"> 169  5     5              mment">               /* __end_XXXXXlsf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L170"> 170  5     57      ;
       s="srecoded+ 2"+sing">"kallsyms failurend_
 171
<5 href57       172  5     57     ts/kallsyms.c#L206" id="L206" 5lass="lin5" name="L173"> 173}
5a hre57             sment">               bol__XXXXX_startlsf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L174"> 174
<5 href574     ;
       s="srecoded+ stderr" class="f">len + 1);
"kallsyms failur_start
 175st5tic i57              return ef="scr+pts/kallsyms.c#L152" id="L152" 5lass="lin5" name="L176"> 176{
5a hre57scripts/kallsyms.c#L197" id="L197" 5lass="lin5" name="L177"> 177  5     57 href="+code=sment">               bol__XXXXX_endlsf="scripts/kallsyms.c#L121" id="L121" 5lass="lin5" name="L178"> 178;
       s="srecoded+ stderr" class="f">len + 1);
"kallsyms failur_end
 179 180 181 182  5     58     pts/kallsyms.c#L159" id="L159" 5lass="lin5" name="L183"> 183  5     58scripts/kallsyms.c#L134" id="L134" 5lass="lin5" name="L184"> 184  5     58scripref="+code=symbol_valid" cpol_ix_understhr/s_thuntlen + 1);
stderr,  185  5     58t  186  5     58              taieref=f= str" class="srest>stderr,  187  5     58scripts/kallsyms.c#L168" id="L168" 5lass="lin5" name="L188"> 188  5     58      if (       taieref=f== sing">"kallsyms f hre_f hre="scrip)ts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L189"> 189
<5 href58              return special_symbolstaiestrcp/a>       taieref=ripts/kallsyms.c#L200" id="L200" 5lass="lin5" name="L190"> 190  5     59scripts/kallsyms.c#L201" id="L201" 5lass="lin5" name="L191"> 191  5     59       192  5     59     pts/kallsyms.c#L159" id="L159" 5lass="lin5" name="L193"> 193  5     59scripts/kallsyms.c#L134" id="L134" 5lass="lin5" name="L194"> 194  5     59scripref="+code=symbol_valid" ctheraress="sre>special_symbolstheraress="sre>code=con trcode==special_symbolsaspecial_symbolsascri"+con trcode==special_symbolsbtable_size,bcode)ts/kallsyms.c#L175" id="L175" 5lass="lin5" name="L195"> 195  5     59t  196
<5 href59        197  5     59       198  5     59      ,wbcodeets/kallsyms.c#L153" id="L153" 5lass="lin5" name="L199"> 199  5     59scripts/kallsyms.c#L190" id="L190" 6lass="lin6" name="L200"> 200
<6 href60       191  6     60      ,sbcode coi" class="sref"btable_size,bcodeets/kallsyms.c#L153" id="L153" 6l2ss="lin6" name="L192"> 192  6an cl60     ts/kallsyms.c#L206" id="L206" 6l3ss="lin6" name="L193"> 193  6     60             sment">               bolsortpby addressccirstlsf="scripts/kallsyms.c#L121" id="L121" 6lass="lin6" name="L204"> 204  6     604      195  6     60              return ef="scr+pts/kallsyms.c#L152" id="L152" 6l6ss="lin6" name="L196"> 196
<6     60       ,sbcode-+codstderr" class="addrspecial_symbolsaddrref=)ts/kallsyms.c#L175" id="L175" 6l7ss="lin6" name="L197"> 197  6an cl60       198  6an cl60scripts/kallsyms.c#L99" id="L99" cl6l9ss="lin6" name="L199"> 199  6an cl60             mment">               /* sortpby 
 210sym[0] = "kallsyms f hrewf hre="scrip) ||+=toupper" class=saspecial_symbolssacode-+codstderr" class="s">sym[0] = "kallsyms f hreWf hre="scrip)pts/kallsyms.c#L152" id="L152" 6l1ss="lin6" name="L211"> 211,wbcodedee=toupper" class=sbtable_size,sbcode-+codstderr" class="s">sym[0] = "kallsyms f hrewf hre="scrip) ||+=toupper" class=sbtable_size,sbcode-+codstderr" class="s">sym[0] = "kallsyms f hreWf hre="scrip)pts/kallsyms.c#L152" id="L152" 6l2ss="lin6" name="L212"> 212  6     61             ode=mpecial_symbolswaspecial_symbolswascrid!= str" class="srewbtable_size,wbcode)ts/kallsyms.c#L175" id="L175" 6l3ss="lin6" name="L213"> 213  6     61      return -1;
 114
<6 href61scripts/kallsyms.c#L175" id="L175" 6lass="lin6" name="L115"> 115  6     61t                /* sortpby 
ker s.c#L9 provid
 116  6     616 ker_s.c#L1_provid
ss="srestrcp/a>       may_bs_f">ker_s.c#L1_provid
ss="srecode=toupper" class=saspecial_symbolssacode)pts/kallsyms.c#L152" id="L152" 6l7ss="lin6" name="L117"> 117  6     61 href="+code=s" class="sref"wbtable_size,wbcodedeeall_symbols" clmay_bs_f">ker_s.c#L1_provid
ss="srestrcp/a>       may_bs_f">ker_s.c#L1_provid
ss="srecode=toupper" class=sbtable_size,sbcode)pts/kallsyms.c#L152" id="L152" 6l8ss="lin6" name="L118"> 118  6     61       119
<6 href61              return ef="scrspecial_symbolswaspecial_symbolswascrid-rer" class="srefwbtable_size,wbcodeets/kallsyms.c#L153" id="L153" 6ass="line6" name="L20">  20
 121  6     62pan class="comment">               /* sortpby , sonumber of pol_ix understhr/sssf="scripts/kallsyms.c#L121" id="L121" 6lass="lin6" name="L122"> 122  6     62             str" class="srewaspecial_symbolswascrideeall_symbols" clpol_ix_understhr/s_thuntlen + 1);
sym[0] =  123  6     62             str" class="srewbtable_size,wbcodedeeall_symbols" clpol_ix_understhr/s_thuntlen + 1);
,sbcode-+codstderr" class="s">sym[0] =  124  6     624      125  6     62              return ef="scrspecial_symbolswaspecial_symbolswascrid-rer" class="srefwbtable_size,wbcodeets/kallsyms.c#L153" id="L153" 6a6ss="lin6" name="L126"> 126  6     62scripts/kallsyms.c#L197" id="L197" 6aass="lin6" name="L127"> 127  6     62 href="+code=sment">               bolsortpby initial order,lsoquan>
o, sr s="sre>qare"left undis="sbedlsf="scripts/kallsyms.c#L121" id="L121" 6lass="lin6" name="L128"> 128  6     62       129  6     62scrippts/kallsyms.c#L159" id="L159" 6        e6se if ( 130  6     63scripts/kallsyms.c#L201" id="L201" 6lass="lin6" name="L131"> 131  6     63     ref="+ccode=usage" class="ssortss="sre>special_symbolssortss="sre>code=codepts/kallsyms.c#L199" id="L199" 6lass="lin6" name="L132"> 132  6     63     pts/kallsyms.c#L94" id="L94" cl6lass="lin6" name="L133"> 133
<6 href63             str" class="sreqsortspecial_symbolsqsortcode=toupper" class=s="srtable_size, table_cnt;
special_symbolstheraress="sre>code)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L134"> 134  6     63scrippts/kallsyms.c#L159" id="L159" 6 ass="lin6" name="L135"> 135  6     63     ts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L136"> 136  6     636 len + 1);
code=ode=i" class="sref"arg>malloc(scri"+ccode==special_symbolsargvmalloc( 137  6     63scrippts/kallsyms.c#L94" id="L94" cl6lass="lin6" name="L138"> 138  6     63       139  6     63              return ode=i" class="sref">i;
 140  6     64      i = 0; i < i;
 141  6     64              (i];
"kallsyms failur--id=-s="sre>
 142  6     64              return                 toupper" class=allss="sre>special_symbolsallss="sre>ef="+co1ets/kallsyms.c#L205" id="L205" 6lass="lin6" name="L143"> 143  6     64      return -1;
;
(i];
"kallsyms failur--s="sre-pol_ix=
 144
<6 href64              ;
(i];
 145  6     64              return                 tment">               bolskip  146;
"kallsyms f hre
;
"kallsyms f hre
"kallsyms f hre\f hre
 hre="scrip ccodeccode=*=toupper" class=si;
"kallsyms f hre\f hre
 hre="scrip))ts/kallsyms.c#L175" id="L175" 6lass="lin6" name="L147"> 147  6     64      ;
 148  6     64      [0] =  149  6     64              return         }helsets/kallsyms.c#L200" id="L200" 6lass="lin6" name="L150"> 150  6     65      ,usagrcode=)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L151"> 151  6     65       152  6     65             }helseeode=mpecial_symbolsarg>malloc(scri+!co1)ts/kallsyms.c#L175" id="L175" 6lass="lin6" name="L153"> 153  6     65      return -1;
,usagrcode=)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L154"> 154  6     65scripts/kallsyms.c#L175" id="L175" 6lass="lin6" name="L155"> 155  6     65             toupper" class=read_mapi;
len + 1);
code)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L156"> 156
<6 href656 special_symbolssortss="sre>code=)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L157"> 157  6     65 href="+code=s" class="sref"optimize_t;,
i;
,
code=)pts/kallsyms.c#L152" id="L152" 6lass="lin6" name="L158"> 158}
6a hre65       159
<6 href65scripts/kallsyms.c#L190" id="L190" 6lass="lin6" name="L160"> 160st6tic i66           161{
6a hre66pan cpts/kallsyms.c#L159" id="L159" 6lass="lin6" name="L162"> 162  6     66     


The originalrLXR software"by , sos/kallsymhttp://sourcecodge.net/poojec159lxr">LXR unityscri"+t intexperi alrversion"by s/kallsymmailto:lxr@2">ux.no">lxr@2">ux.noscri.
lxr.2">ux.no kindly hostyspby s/kallsymhttp://www.redpid=-2">poo.no">Redpid= L">poo ASscri"+provid r of L">uxccon ultpan>and operardedy servicey since 1995.