~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/tools/head_check.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # Copyright © 2016 IBM Corporation
  2 
  3 # This program is free software; you can redistribute it and/or
  4 # modify it under the terms of the GNU General Public License
  5 # as published by the Free Software Foundation; either version
  6 # 2 of the License, or (at your option) any later version.
  7 
  8 # This script checks the head of a vmlinux for linker stubs that
  9 # break our placement of fixed-location code for 64-bit.
 10 
 11 # based on relocs_check.pl
 12 # Copyright © 2009 IBM Corporation
 13 
 14 # NOTE!
 15 #
 16 # If the build dies here, it's likely code in head_64.S/exception-64*.S or
 17 # nearby, is branching to labels it can't reach directly, which results in the
 18 # linker inserting branch stubs. This can move code around in ways that break
 19 # the fixed section calculations (head-64.h). To debug this, disassemble the
 20 # vmlinux and look for branch stubs (long_branch, plt_branch, etc.) in the
 21 # fixed section region (0 - 0x8000ish). Check what code is calling those stubs,
 22 # and perhaps change so a direct branch can reach.
 23 #
 24 # A ".linker_stub_catch" section is used to catch some stubs generated by
 25 # early .text code, which tend to get placed at the start of the section.
 26 # If there are too many such stubs, they can overflow this section. Expanding
 27 # it may help (or reducing the number of stub branches).
 28 #
 29 # Linker stubs use the TOC pointer, so even if fixed section code could
 30 # tolerate them being inserted into head code, they can't be allowed in low
 31 # level entry code (boot, interrupt vectors, etc) until r2 is set up. This
 32 # could cause the kernel to die in early boot.
 33 
 34 # Allow for verbose output
 35 if [ "$V" = "1" ]; then
 36         set -x
 37 fi
 38 
 39 if [ $# -lt 2 ]; then
 40         echo "$0 [path to nm] [path to vmlinux]" 1>&2
 41         exit 1
 42 fi
 43 
 44 # Have Kbuild supply the path to nm so we handle cross compilation.
 45 nm="$1"
 46 vmlinux="$2"
 47 
 48 # gcc-4.6-era toolchain make _stext an A (absolute) symbol rather than T
 49 $nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" > .tmp_symbols.txt
 50 
 51 
 52 vma=$(grep -e " [TA] _stext$" .tmp_symbols.txt | cut -d' ' -f1)
 53 
 54 expected_start_head_addr="$vma"
 55 
 56 start_head_addr=$(grep " t start_first_256B$" .tmp_symbols.txt | cut -d' ' -f1)
 57 
 58 if [ "$start_head_addr" != "$expected_start_head_addr" ]; then
 59         echo "ERROR: head code starts at $start_head_addr, should be $expected_start_head_addr" 1>&2
 60         echo "ERROR: try to enable LD_HEAD_STUB_CATCH config option" 1>&2
 61         echo "ERROR: see comments in arch/powerpc/tools/head_check.sh" 1>&2
 62 
 63         exit 1
 64 fi
 65 
 66 top_vma=$(echo "$vma" | cut -d'0' -f1)
 67 
 68 expected_start_text_addr=$(grep " a text_start$" .tmp_symbols.txt | cut -d' ' -f1 | sed "s/^0/$top_vma/")
 69 
 70 start_text_addr=$(grep " t start_text$" .tmp_symbols.txt | cut -d' ' -f1)
 71 
 72 if [ "$start_text_addr" != "$expected_start_text_addr" ]; then
 73         echo "ERROR: start_text address is $start_text_addr, should be $expected_start_text_addr" 1>&2
 74         echo "ERROR: try to enable LD_HEAD_STUB_CATCH config option" 1>&2
 75         echo "ERROR: see comments in arch/powerpc/tools/head_check.sh" 1>&2
 76 
 77         exit 1
 78 fi
 79 
 80 rm -f .tmp_symbols.txt

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php