home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / LINUX-1.0 / LINUX-1 / linux / kernel / ksyms.sh < prev    next >
Encoding:
Text File  |  1994-02-18  |  1.0 KB  |  38 lines

  1. # This program will construct ksyms.s.  Ksyms.s contains a symbol table
  2. # for all the kernel symbols included in the file ksyms.lst.  The following
  3. # variables are defined in ksym.s:
  4. #
  5. #    int symbol_table_size;        /* number of symbols */
  6. #    struct {
  7. #        void *value;        /* value of symbol */
  8. #        char *name;        /* name of symbol */
  9. #    } symbol_table[];
  10. #
  11. #
  12.  
  13. trap "rm -f ksyms.tmp ksyms.lst ; exit 1" 1 2 
  14.  
  15. sed -e '/^#/d' -e '/^[     ]*$/d' ksyms.lst | sort > ksyms.tmp
  16.  
  17. echo '    .data
  18.     .globl    _symbol_table_size, _symbol_table
  19.  
  20. _symbol_table_size:'
  21. echo "    .long" `wc -l < ksyms.tmp`
  22. echo '
  23. _symbol_table:'
  24. awk 'BEGIN {stringloc = 0}
  25. {print "    .long " $1; print "    .long strings+" stringloc; \
  26.         stringloc += length($1) + 1;}' ksyms.tmp
  27. echo '
  28. strings:'
  29. awk '{print "    .ascii \"" $1 "\\0\""}' ksyms.tmp
  30. rm -f ksyms.tmp
  31.  
  32.  
  33. #
  34. # Alternativly, if the kernel is c++ compiled:
  35. # By using gsub() we can forse all function names to appear as extern "C".
  36. # This allows linkable drivers written in C or C++ - Jon
  37. # awk '{gsub(/__F.*/, "") ; print "    .ascii \"" $0 "\\0\""}' ksyms.tmp
  38.