bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 1) #!/bin/sh
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 2) # SPDX-License-Identifier: GPL-2.0
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 3)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 4) set -e
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 5)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 6) # List of exported symbols
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 7) #
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 8) # If the object has no symbol, $NM warns 'no symbols'.
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 9) # Suppress the stderr.
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 10) # TODO:
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 11) # Use -q instead of 2>/dev/null when we upgrade the minimum version of
52d83df682c82 (Masahiro Yamada 2021-08-19 09:01:14 +0900 12) # binutils to 2.37, llvm to 13.0.0.
bc7cd2dd1f8e5 (Masahiro Yamada 2021-08-30 17:20:33 +0900 13) ksyms=$($NM $1 2>/dev/null | sed -n 's/.*__ksym_marker_\(.*\)/\1/p')
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 14)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 15) if [ -z "$ksyms" ]; then
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 16) exit 0
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 17) fi
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 18)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 19) echo
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 20) echo "ksymdeps_$1 := \\"
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 21)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 22) for s in $ksyms
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 23) do
bc7cd2dd1f8e5 (Masahiro Yamada 2021-08-30 17:20:33 +0900 24) printf ' $(wildcard include/ksym/%s) \\\n' "$s"
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 25) done
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 26)
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 27) echo
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 28) echo "$1: \$(ksymdeps_$1)"
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 29) echo
bbda5ec671d3f (Masahiro Yamada 2018-11-30 10:05:26 +0900 30) echo "\$(ksymdeps_$1):"