Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 1 | #!/bin/sh |
Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 3 | |
| 4 | # Copyright © 2015 IBM Corporation |
| 5 | |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 6 | |
| 7 | # This script checks the relocations of a vmlinux for "suspicious" |
| 8 | # relocations. |
| 9 | |
| 10 | # based on relocs_check.pl |
| 11 | # Copyright © 2009 IBM Corporation |
| 12 | |
Alexandre Ghiti | 43e76cd | 2020-01-18 12:03:35 -0500 | [diff] [blame] | 13 | if [ $# -lt 3 ]; then |
| 14 | echo "$0 [path to objdump] [path to nm] [path to vmlinux]" 1>&2 |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 15 | exit 1 |
| 16 | fi |
| 17 | |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 18 | bad_relocs=$( |
Alexandre Ghiti | 47981b5 | 2023-03-29 06:53:27 +0200 | [diff] [blame] | 19 | ${srctree}/scripts/relocs_check.sh "$@" | |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 20 | # These relocations are okay |
| 21 | # On PPC64: |
| 22 | # R_PPC64_RELATIVE, R_PPC64_NONE |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 23 | # On PPC: |
| 24 | # R_PPC_RELATIVE, R_PPC_ADDR16_HI, |
| 25 | # R_PPC_ADDR16_HA,R_PPC_ADDR16_LO, |
| 26 | # R_PPC_NONE |
| 27 | grep -F -w -v 'R_PPC64_RELATIVE |
| 28 | R_PPC64_NONE |
Alexey Kardashevskiy | d799769 | 2022-03-09 17:18:22 +1100 | [diff] [blame] | 29 | R_PPC64_UADDR64 |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 30 | R_PPC_ADDR16_LO |
| 31 | R_PPC_ADDR16_HI |
| 32 | R_PPC_ADDR16_HA |
| 33 | R_PPC_RELATIVE |
Alexandre Ghiti | 47981b5 | 2023-03-29 06:53:27 +0200 | [diff] [blame] | 34 | R_PPC_NONE' |
Stephen Rothwell | a71aa05 | 2015-03-18 16:46:16 +1100 | [diff] [blame] | 35 | ) |
| 36 | |
| 37 | if [ -z "$bad_relocs" ]; then |
| 38 | exit 0 |
| 39 | fi |
| 40 | |
| 41 | num_bad=$(echo "$bad_relocs" | wc -l) |
| 42 | echo "WARNING: $num_bad bad relocations" |
| 43 | echo "$bad_relocs" |