mksysmap 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh -x
  2. # Based on the vmlinux file create the System.map file
  3. # System.map is used by module-init tools and some debugging
  4. # tools to retrieve the actual addresses of symbols in the kernel.
  5. #
  6. # Usage
  7. # mksysmap vmlinux System.map
  8. #####
  9. # Generate System.map (actual filename passed as second argument)
  10. # $NM produces the following output:
  11. # f0081e80 T alloc_vfsmnt
  12. # The second row specify the type of the symbol:
  13. # A = Absolute
  14. # B = Uninitialised data (.bss)
  15. # C = Comon symbol
  16. # D = Initialised data
  17. # G = Initialised data for small objects
  18. # I = Indirect reference to another symbol
  19. # N = Debugging symbol
  20. # R = Read only
  21. # S = Uninitialised data for small objects
  22. # T = Text code symbol
  23. # U = Undefined symbol
  24. # V = Weak symbol
  25. # W = Weak symbol
  26. # Corresponding small letters are local symbols
  27. # For System.map filter away:
  28. # a - local absolute symbols
  29. # U - undefined global symbols
  30. # w - local weak symbols
  31. # readprofile starts reading symbols when _stext is found, and
  32. # continue until it finds a symbol which is not either of 'T', 't',
  33. # 'W' or 'w'. __crc_ are 'A' and placed in the middle
  34. # so we just ignore them to let readprofile continue to work.
  35. # (At least sparc64 has __crc_ in the middle).
  36. $NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2