relocs_check.sh 849 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # Copyright © 2015 IBM Corporation
  4. # This script checks the relocations of a vmlinux for "suspicious"
  5. # relocations.
  6. # based on relocs_check.pl
  7. # Copyright © 2009 IBM Corporation
  8. if [ $# -lt 3 ]; then
  9. echo "$0 [path to objdump] [path to nm] [path to vmlinux]" 1>&2
  10. exit 1
  11. fi
  12. bad_relocs=$(
  13. ${srctree}/scripts/relocs_check.sh "$@" |
  14. # These relocations are okay
  15. # On PPC64:
  16. # R_PPC64_RELATIVE, R_PPC64_NONE
  17. # On PPC:
  18. # R_PPC_RELATIVE, R_PPC_ADDR16_HI,
  19. # R_PPC_ADDR16_HA,R_PPC_ADDR16_LO,
  20. # R_PPC_NONE
  21. grep -F -w -v 'R_PPC64_RELATIVE
  22. R_PPC64_NONE
  23. R_PPC64_UADDR64
  24. R_PPC_ADDR16_LO
  25. R_PPC_ADDR16_HI
  26. R_PPC_ADDR16_HA
  27. R_PPC_RELATIVE
  28. R_PPC_NONE'
  29. )
  30. if [ -z "$bad_relocs" ]; then
  31. exit 0
  32. fi
  33. num_bad=$(echo "$bad_relocs" | wc -l)
  34. echo "WARNING: $num_bad bad relocations"
  35. echo "$bad_relocs"