about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-07 07:31:34 +0000
committerbors <bors@rust-lang.org>2024-03-07 07:31:34 +0000
commit51f483944db3675eba6fd82e0c2cc2b57b04a4e0 (patch)
treef89902fc09d9a25d24f52776f019ed8e634e3a5e
parent1508a031fbfa55d11f1e30b2cb4d956554937f78 (diff)
parent31ae82395c5e28a80c1e5633b8bc68d0ff33a974 (diff)
downloadrust-51f483944db3675eba6fd82e0c2cc2b57b04a4e0.tar.gz
rust-51f483944db3675eba6fd82e0c2cc2b57b04a4e0.zip
Auto merge of #121866 - Kobzol:opt-dist-find-llvm, r=Mark-Simulacrum
Modify opt-dist logic for finding LLVM artifacts

This is the `rustc` side of fixing https://github.com/rust-lang/rust/pull/121395#issuecomment-1973572885.
-rw-r--r--src/tools/opt-dist/src/utils/artifact_size.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/opt-dist/src/utils/artifact_size.rs b/src/tools/opt-dist/src/utils/artifact_size.rs
index eb1f6bcf21d..757f6d49709 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.<suffix>, 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