3 # Copyright © 2009 IBM Corporation
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version
8 # 2 of the License, or (at your option) any later version.
10 # This script checks the relocations of a vmlinux for "suspicious"
17 die "$0 [path to objdump] [path to vmlinux]\n";
20 # Have Kbuild supply the path to objdump so we handle cross compilation.
23 my $bad_relocs_count = 0;
27 open(FD
, "$objdump -R $vmlinux|") or die;
31 # Only look at relocation lines.
34 # These relocations are okay
36 # R_PPC64_RELATIVE, R_PPC64_NONE, R_PPC64_ADDR64
38 # R_PPC_RELATIVE, R_PPC_ADDR16_HI,
39 # R_PPC_ADDR16_HA,R_PPC_ADDR16_LO,
42 next if (/\bR_PPC64_RELATIVE\b/ or /\bR_PPC64_NONE\b/ or
43 /\bR_PPC64_ADDR64\s+mach_/);
44 next if (/\bR_PPC_ADDR16_LO\b/ or /\bR_PPC_ADDR16_HI\b/ or
45 /\bR_PPC_ADDR16_HA\b/ or /\bR_PPC_RELATIVE\b/ or
48 # If we see this type of relocation it's an idication that
49 # we /may/ be using an old version of binutils.
50 if (/R_PPC64_UADDR64/) {
58 if ($bad_relocs_count) {
59 print "WARNING: $bad_relocs_count bad relocations\n";
64 print "WARNING: You need at least binutils >= 2.19 to build a ".
65 "CONFIG_RELOCATABLE kernel\n";