Skip to content

Commit

Permalink
contrib: fix check-deps.sh to check for weak symbols
Browse files Browse the repository at this point in the history
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 bitcoin#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
bitcoin#29015 (comment)
  • Loading branch information
ryanofsky committed Sep 4, 2024
1 parent 2ea8b7b commit 3a90dd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/devtools/check-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3a90dd0

Please sign in to comment.