From 3c99f5a38a47e4e10a0daab3a114b5e476fcacfa Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Tue, 9 Jul 2024 11:29:50 -0400 Subject: [PATCH] contrib: fix check-deps.sh to check for weak symbols Fix check-deps.sh to check for weak symbols so it can detect when an exported template function is used from another library. In a previous version of this commit, this change caused an invalid dependency in the consensus library on the TryParseHex template function from the util library to be detected, and a suppression was added here. But #30377 removed the invalid dependency so the suppression is no longer needed. The invalid dependency and problem detecting weak symbol usage was originally reported by Hennadii Stepanov in https://github.com/bitcoin/bitcoin/pull/29015#issuecomment-2209258843 --- contrib/devtools/check-deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/devtools/check-deps.sh b/contrib/devtools/check-deps.sh index f49e360d16..d3a76f0751 100755 --- a/contrib/devtools/check-deps.sh +++ b/contrib/devtools/check-deps.sh @@ -75,7 +75,7 @@ extract_symbols() { local temp_dir="$1" for lib in "${!LIBS[@]}"; do for lib_path in ${LIBS[$lib]}; do - nm -o "$lib_path" | grep ' T ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt" + nm -o "$lib_path" | grep ' T \| W ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt" nm -o "$lib_path" | grep ' U ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_imports.txt" awk '{print $1}' "${temp_dir}/${lib}_exports.txt" | sort -u > "${temp_dir}/${lib}_exported_symbols.txt" awk '{print $1}' "${temp_dir}/${lib}_imports.txt" | sort -u > "${temp_dir}/${lib}_imported_symbols.txt"