| .. | .. |
|---|
| 1 | 1 | #!/bin/sh |
|---|
| 2 | +# SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 2 | 3 | # |
|---|
| 3 | 4 | # Copyright © 2008 IBM Corporation |
|---|
| 4 | 5 | # |
|---|
| 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. |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | # This script checks prom_init.o to see what external symbols it |
|---|
| 11 | 8 | # is using, if it finds symbols not in the whitelist it returns |
|---|
| .. | .. |
|---|
| 16 | 13 | # If you really need to reference something from prom_init.o add |
|---|
| 17 | 14 | # it to the list below: |
|---|
| 18 | 15 | |
|---|
| 16 | +grep "^CONFIG_KASAN=y$" ${KCONFIG_CONFIG} >/dev/null |
|---|
| 17 | +if [ $? -eq 0 ] |
|---|
| 18 | +then |
|---|
| 19 | + MEM_FUNCS="__memcpy __memset" |
|---|
| 20 | +else |
|---|
| 21 | + MEM_FUNCS="memcpy memset" |
|---|
| 22 | +fi |
|---|
| 23 | + |
|---|
| 19 | 24 | WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush |
|---|
| 20 | | -_end enter_prom memcpy memset reloc_offset __secondary_hold |
|---|
| 25 | +_end enter_prom $MEM_FUNCS reloc_offset __secondary_hold |
|---|
| 21 | 26 | __secondary_hold_acknowledge __secondary_hold_spinloop __start |
|---|
| 22 | | -strcmp strcpy strlcpy strlen strncmp strstr kstrtobool logo_linux_clut224 |
|---|
| 27 | +logo_linux_clut224 btext_prepare_BAT |
|---|
| 23 | 28 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext |
|---|
| 24 | | -__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." |
|---|
| 29 | +__prom_init_toc_start __prom_init_toc_end btext_setup_display TOC. |
|---|
| 30 | +relocate" |
|---|
| 25 | 31 | |
|---|
| 26 | 32 | NM="$1" |
|---|
| 27 | 33 | OBJ="$2" |
|---|
| 28 | 34 | |
|---|
| 29 | 35 | ERROR=0 |
|---|
| 36 | + |
|---|
| 37 | +check_section() |
|---|
| 38 | +{ |
|---|
| 39 | + file=$1 |
|---|
| 40 | + section=$2 |
|---|
| 41 | + size=$(objdump -h -j $section $file 2>/dev/null | awk "\$2 == \"$section\" {print \$3}") |
|---|
| 42 | + size=${size:-0} |
|---|
| 43 | + if [ $size -ne 0 ]; then |
|---|
| 44 | + ERROR=1 |
|---|
| 45 | + echo "Error: Section $section not empty in prom_init.c" >&2 |
|---|
| 46 | + fi |
|---|
| 47 | +} |
|---|
| 30 | 48 | |
|---|
| 31 | 49 | for UNDEF in $($NM -u $OBJ | awk '{print $2}') |
|---|
| 32 | 50 | do |
|---|
| .. | .. |
|---|
| 66 | 84 | fi |
|---|
| 67 | 85 | done |
|---|
| 68 | 86 | |
|---|
| 87 | +check_section $OBJ .data |
|---|
| 88 | +check_section $OBJ .bss |
|---|
| 89 | +check_section $OBJ .init.data |
|---|
| 90 | + |
|---|
| 69 | 91 | exit $ERROR |
|---|