aboutsummaryrefslogtreecommitdiff
path: root/scripts/is_rust_module.sh
blob: 277a64d07f22c1c98a32393a88d1bbbda3b7486e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
# is_rust_module.sh module.ko
#
# Returns `0` if `module.ko` is a Rust module, `1` otherwise.

set -e

# Using the `16_` prefix ensures other symbols with the same substring
# are not picked up (even if it would be unlikely). The last part is
# used just in case LLVM decides to use the `.` suffix.
${NM} "$*" | grep -qE '^[0-9a-fA-F]+ r _R[^[:space:]]+16___IS_RUST_MODULE[^[:space:]]*$'