kallsyms.c (6e8c5bbd5e83e649251c198e743c8b9e7c48372b) kallsyms.c (73bbb94466fd3f8b313eeb0b0467314a262dddb3)
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

--- 473 unchanged lines hidden (view full) ---

482 }
483
484 output_label("kallsyms_names");
485 off = 0;
486 for (i = 0; i < table_cnt; i++) {
487 if ((i & 0xFF) == 0)
488 markers[i >> 8] = off;
489
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

--- 473 unchanged lines hidden (view full) ---

482 }
483
484 output_label("kallsyms_names");
485 off = 0;
486 for (i = 0; i < table_cnt; i++) {
487 if ((i & 0xFF) == 0)
488 markers[i >> 8] = off;
489
490 printf("\t.byte 0x%02x", table[i]->len);
490 /* There cannot be any symbol of length zero. */
491 if (table[i]->len == 0) {
492 fprintf(stderr, "kallsyms failure: "
493 "unexpected zero symbol length\n");
494 exit(EXIT_FAILURE);
495 }
496
497 /* Only lengths that fit in up-to-two-byte ULEB128 are supported. */
498 if (table[i]->len > 0x3FFF) {
499 fprintf(stderr, "kallsyms failure: "
500 "unexpected huge symbol length\n");
501 exit(EXIT_FAILURE);
502 }
503
504 /* Encode length with ULEB128. */
505 if (table[i]->len <= 0x7F) {
506 /* Most symbols use a single byte for the length. */
507 printf("\t.byte 0x%02x", table[i]->len);
508 off += table[i]->len + 1;
509 } else {
510 /* "Big" symbols use two bytes. */
511 printf("\t.byte 0x%02x, 0x%02x",
512 (table[i]->len & 0x7F) | 0x80,
513 (table[i]->len >> 7) & 0x7F);
514 off += table[i]->len + 2;
515 }
491 for (k = 0; k < table[i]->len; k++)
492 printf(", 0x%02x", table[i]->sym[k]);
493 printf("\n");
516 for (k = 0; k < table[i]->len; k++)
517 printf(", 0x%02x", table[i]->sym[k]);
518 printf("\n");
494
495 off += table[i]->len + 1;
496 }
497 printf("\n");
498
499 output_label("kallsyms_markers");
500 for (i = 0; i < ((table_cnt + 255) >> 8); i++)
501 printf("\t.long\t%u\n", markers[i]);
502 printf("\n");
503

--- 307 unchanged lines hidden ---
519 }
520 printf("\n");
521
522 output_label("kallsyms_markers");
523 for (i = 0; i < ((table_cnt + 255) >> 8); i++)
524 printf("\t.long\t%u\n", markers[i]);
525 printf("\n");
526

--- 307 unchanged lines hidden ---