mksysmap 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 = Common 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. # N - debugging symbols
  31. # w - local weak symbols
  32. # readprofile starts reading symbols when _stext is found, and
  33. # continue until it finds a symbol which is not either of 'T', 't',
  34. # 'W' or 'w'. __crc_ are 'A' and placed in the middle
  35. # so we just ignore them to let readprofile continue to work.
  36. # (At least sparc64 has __crc_ in the middle).
  37. $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2