Better script to collect symbols statistics

This commit is contained in:
Alexey Milovidov 2024-05-17 06:26:02 +02:00
parent 4021e9a507
commit c6e40a9288

View File

@ -109,8 +109,19 @@ ENGINE = MergeTree
ORDER BY (date, file, symbol, pull_request_number, commit_sha, check_name); ORDER BY (date, file, symbol, pull_request_number, commit_sha, check_name);
/// ///
find "$INPUT_DIR" -type f -name '*.o' | grep -v cargo | find . -name '*.o' | xargs -P $(nproc) -I {} bash -c " # nm does not work with LTO
nm --demangle --defined-only --print-size '{}' | grep -v -P '[0-9a-zA-Z] r ' | sed 's@^@{} @' > '{}.symbols' if ! grep -q -- '-flto' compile_commands.json
" then
# Find the best alternative of nm
for name in llvm-nm-{30..18} llvm-nm nm
do
NM=$(command -v ${name})
[[ -n "${NM}" ]] && break
done
find "$INPUT_DIR" -type f -name '*.o.symbols' | xargs cat > "${OUTPUT_DIR}/binary_symbols.txt" find "$INPUT_DIR" -type f -name '*.o' | grep -v cargo | find . -name '*.o' | xargs -P $(nproc) -I {} bash -c "
${NM} --demangle --defined-only --print-size '{}' | grep -v -P '[0-9a-zA-Z] r ' | sed 's@^@{} @' > '{}.symbols'
"
find "$INPUT_DIR" -type f -name '*.o.symbols' | xargs cat > "${OUTPUT_DIR}/binary_symbols.txt"
fi