162306a36Sopenharmony_ci#!/bin/sh 262306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci# Get a list of all the relocations, remove from it the relocations 562306a36Sopenharmony_ci# that are known to be legitimate and return this list to arch specific 662306a36Sopenharmony_ci# script that will look for suspicious relocations. 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciobjdump="$1" 962306a36Sopenharmony_cinm="$2" 1062306a36Sopenharmony_civmlinux="$3" 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci# Remove from the possible bad relocations those that match an undefined 1362306a36Sopenharmony_ci# weak symbol which will result in an absolute relocation to 0. 1462306a36Sopenharmony_ci# Weak unresolved symbols are of that form in nm output: 1562306a36Sopenharmony_ci# " w _binary__btf_vmlinux_bin_end" 1662306a36Sopenharmony_ciundef_weak_symbols=$($nm "$vmlinux" | awk '$1 ~ /w/ { print $2 }') 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci$objdump -R "$vmlinux" | 1962306a36Sopenharmony_ci grep -E '\<R_' | 2062306a36Sopenharmony_ci ([ "$undef_weak_symbols" ] && grep -F -w -v "$undef_weak_symbols" || cat) 21