]> asedeno.scripts.mit.edu Git - linux.git/blob - arch/powerpc/tools/relocs_check.sh
ASoC: max98090: fix incorrect helper in max98090_dapm_put_enum_double()
[linux.git] / arch / powerpc / tools / relocs_check.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-or-later
3
4 # Copyright © 2015 IBM Corporation
5
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
13 if [ $# -lt 2 ]; then
14         echo "$0 [path to objdump] [path to vmlinux]" 1>&2
15         exit 1
16 fi
17
18 # Have Kbuild supply the path to objdump so we handle cross compilation.
19 objdump="$1"
20 vmlinux="$2"
21
22 bad_relocs=$(
23 $objdump -R "$vmlinux" |
24         # Only look at relocation lines.
25         grep -E '\<R_' |
26         # These relocations are okay
27         # On PPC64:
28         #       R_PPC64_RELATIVE, R_PPC64_NONE
29         #       R_PPC64_ADDR64 mach_<name>
30         #       R_PPC64_ADDR64 __crc_<name>
31         # On PPC:
32         #       R_PPC_RELATIVE, R_PPC_ADDR16_HI,
33         #       R_PPC_ADDR16_HA,R_PPC_ADDR16_LO,
34         #       R_PPC_NONE
35         grep -F -w -v 'R_PPC64_RELATIVE
36 R_PPC64_NONE
37 R_PPC_ADDR16_LO
38 R_PPC_ADDR16_HI
39 R_PPC_ADDR16_HA
40 R_PPC_RELATIVE
41 R_PPC_NONE' |
42         grep -E -v '\<R_PPC64_ADDR64[[:space:]]+mach_' |
43         grep -E -v '\<R_PPC64_ADDR64[[:space:]]+__crc_'
44 )
45
46 if [ -z "$bad_relocs" ]; then
47         exit 0
48 fi
49
50 num_bad=$(echo "$bad_relocs" | wc -l)
51 echo "WARNING: $num_bad bad relocations"
52 echo "$bad_relocs"
53
54 # If we see this type of relocation it's an idication that
55 # we /may/ be using an old version of binutils.
56 if echo "$bad_relocs" | grep -q -F -w R_PPC64_UADDR64; then
57         echo "WARNING: You need at least binutils >= 2.19 to build a CONFIG_RELOCATABLE kernel"
58 fi