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 9objfile="$1" 10 11if [ ! -f "$objfile" ]; then 12 echo "usage: $0 <file.o>" >&2 13 exit 1 14fi 15 16bad_symbols=$(nm "$objfile" | awk '$2 ~ /^[TtWw]$/ {print $3}' | grep -E '^(startup|exit|split|unlikely|hot|unknown)(\.|$)') 17 18if [ -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 23fi 24 25exit 0 26