aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom_init_check.sh
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-10-15 13:49:59 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2018-10-19 00:56:17 +1100
commit2c51d97ee88da897db8405f659d1735ffe86ad7c (patch)
treefd8503757d401435b6c6b6c182091129b477123e /arch/powerpc/kernel/prom_init_check.sh
parentpowerpc/prom_init: Move __prombss to it's own section and store it in .bss (diff)
downloadlinux-dev-2c51d97ee88da897db8405f659d1735ffe86ad7c.tar.xz
linux-dev-2c51d97ee88da897db8405f659d1735ffe86ad7c.zip
powerpc: Check prom_init for disallowed sections
prom_init.c must not modify the kernel image outside of the .bss.prominit section. Thus make sure that prom_init.o doesn't have anything in any of these: .data .bss .init.data Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to '')
-rw-r--r--arch/powerpc/kernel/prom_init_check.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index acb6b9226352..667df97d2595 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -28,6 +28,18 @@ OBJ="$2"
ERROR=0
+function check_section()
+{
+ file=$1
+ section=$2
+ size=$(objdump -h -j $section $file 2>/dev/null | awk "\$2 == \"$section\" {print \$3}")
+ size=${size:-0}
+ if [ $size -ne 0 ]; then
+ ERROR=1
+ echo "Error: Section $section not empty in prom_init.c" >&2
+ fi
+}
+
for UNDEF in $($NM -u $OBJ | awk '{print $2}')
do
# On 64-bit nm gives us the function descriptors, which have
@@ -66,4 +78,8 @@ do
fi
done
+check_section $OBJ .data
+check_section $OBJ .bss
+check_section $OBJ .init.data
+
exit $ERROR