at commit 558c56d4
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # |
| 4 | # Certain function names are disallowed due to section name ambiguities |
| 5 | # introduced by -ffunction-sections. |
| 6 | # |
| 7 | # See the comment above TEXT_MAIN in include/asm-generic/vmlinux.lds.h. |
| 8 | |
| 9 | objfile="$1" |
| 10 | |
| 11 | if [ ! -f "$objfile" ]; then |
| 12 | echo "usage: $0 <file.o>" >&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | bad_symbols=$(${NM:-nm} "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' | grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)') |
| 17 | |
| 18 | if [ -n "$bad_symbols" ]; then |
| 19 | echo "$bad_symbols" | while read -r sym; do |
| 20 | echo "$objfile: error: $sym() function name creates ambiguity with -ffunction-sections" >&2 |
| 21 | done |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
| 25 | exit 0 |