Files
build_toochain/linux_shell/build_script/base/show.bash
T
2026-07-07 15:23:39 +08:00

43 lines
1.1 KiB
Bash

#!/bin/bash
# shellcheck disable=SC2155
if ! type "include" > /dev/null 2>&1; then
include() {
. "$(cd "$(dirname "$1")" && pwd)/${2}";
};
fi
include "${BASH_SOURCE[0]}" ../pragma_once.bash
if ! pragma_once ${BASH_SOURCE[0]}; then return 0; fi
include "${BASH_SOURCE[0]}" ./global_rely/export.bash
# shellcheck source=./global_rely/export.bash
# 遍历当前目录下的所有文件
check_rpath_runpath() {
local dir="$1"
# 遍历当前目录下的所有文件
find "$dir" -type f -executable | while read -r file; do
# 检查是否为可执行文件且不是目录
if [[ -x "$file" && ! -d "$file" ]]; then
echo "File: $file"
# 查看 RPATH
rpath=$(readelf -d "$file" | grep -E 'RPATH')
runpath=$(readelf -d "$file" | grep -E 'RUNPATH')
# 打印结果
if [ -n "$rpath" ]; then
echo " RPATH: $rpath"
else
echo " RPATH: Not set"
fi
if [ -n "$runpath" ]; then
echo " RUNPATH: $runpath"
else
echo " RUNPATH: Not set"
fi
echo ""
fi
done
}
# 调用函数
#check_rpath_runpath "/ae/bbb"
#check_rpath_runpath "./"
return 0