From 31ae82395c5e28a80c1e5633b8bc68d0ff33a974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 1 Mar 2024 19:46:14 +0100 Subject: [PATCH] Modify opt-dist logic for finding LLVM artifacts --- src/tools/opt-dist/src/utils/artifact_size.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tools/opt-dist/src/utils/artifact_size.rs b/src/tools/opt-dist/src/utils/artifact_size.rs index eb1f6bcf21df8..757f6d497095c 100644 --- a/src/tools/opt-dist/src/utils/artifact_size.rs +++ b/src/tools/opt-dist/src/utils/artifact_size.rs @@ -15,8 +15,21 @@ pub fn print_binary_sizes(env: &Environment) -> anyhow::Result<()> { let root = env.build_artifacts().join("stage2"); + let all_lib_files = get_files_from_dir(&root.join("lib"), None)?; + let mut files = get_files_from_dir(&root.join("bin"), None)?; files.extend(get_files_from_dir(&root.join("lib"), Some(".so"))?); + + // libLLVM.so can be named libLLVM.so., so we try to explicitly add it here if it + // wasn't found by the above call. + if !files.iter().any(|f| f.file_name().unwrap_or_default().starts_with("libLLVM")) { + if let Some(llvm_lib) = + all_lib_files.iter().find(|f| f.file_name().unwrap_or_default().starts_with("libLLVM")) + { + files.push(llvm_lib.clone()); + } + } + files.sort_unstable(); let items: Vec<_> = files