Skip to content

Commit 114b2a4

Browse files
committed
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 like TryParseHex is used from another library. Also add suppression because consensus library is currently using the TryParseHex function from util, when the consensus library is not supposed to depend on the util library. Problem was reported by Hennadii Stepanov in #29015 (comment)
1 parent a83f050 commit 114b2a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

contrib/devtools/check-deps.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ SUPPRESS["libbitcoin_common_a-common.o libbitcoin_node_a-interface_ui.o _Z9InitE
5858
# rpc/external_signer.cpp adds defines node RPC methods but is built as part of the
5959
# common library. It should be moved to the node library instead.
6060
SUPPRESS["libbitcoin_common_a-external_signer.o libbitcoin_node_a-server.o _ZN9CRPCTable13appendCommandERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPK11CRPCCommand"]=1
61+
# pubkey.cpp in consensus library currently calls ParseHex in util to set
62+
# NUMS_H_DATA constant, but this suppression can be dropped when runtime
63+
# dependency is dropped in https://github.com/bitcoin/bitcoin/issues/30377
64+
SUPPRESS["libbitcoin_consensus_a-pubkey.o libbitcoin_util_a-strencodings.o _Z11TryParseHexIhESt8optionalISt6vectorIT_SaIS2_EEESt17basic_string_viewIcSt11char_traitsIcEE"]=1
6165

6266
usage() {
6367
echo "Usage: $(basename "${BASH_SOURCE[0]}") [BUILD_DIR]"
@@ -78,7 +82,7 @@ extract_symbols() {
7882
local temp_dir="$1"
7983
for lib in "${!LIBS[@]}"; do
8084
for lib_path in ${LIBS[$lib]}; do
81-
nm -o "$lib_path" | grep ' T ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt"
85+
nm -o "$lib_path" | grep ' T \| W ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt"
8286
nm -o "$lib_path" | grep ' U ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_imports.txt"
8387
awk '{print $1}' "${temp_dir}/${lib}_exports.txt" | sort -u > "${temp_dir}/${lib}_exported_symbols.txt"
8488
awk '{print $1}' "${temp_dir}/${lib}_imports.txt" | sort -u > "${temp_dir}/${lib}_imported_symbols.txt"

0 commit comments

Comments
 (0)