about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-08-13 10:50:54 +0200
committerJakub Beránek <berykubik@gmail.com>2025-08-13 10:50:54 +0200
commit76bc558e7e043fe13630b5576665b4136209875d (patch)
treec409953335dea46bafcec66d9489b5f83f87ea84
parent6e5a6e0211677fe946b6123dfef4f39bbf576ccc (diff)
downloadrust-76bc558e7e043fe13630b5576665b4136209875d.tar.gz
rust-76bc558e7e043fe13630b5576665b4136209875d.zip
Make sure that we won't accidentally ship libgccjit.so in the dist component
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index f9cb300b68e..54234488649 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -478,7 +478,19 @@ impl Step for Rustc {
             if libdir_relative.to_str() != Some("bin") {
                 let libdir = builder.rustc_libdir(compiler);
                 for entry in builder.read_dir(&libdir) {
-                    if is_dylib(&entry.path()) {
+                    // A safeguard that we will not ship libgccjit.so from the libdir, in case the
+                    // GCC codegen backend is enabled by default.
+                    // Long-term we should probably split the config options for:
+                    // - Include cg_gcc in the rustc sysroot by default
+                    // - Run dist of a specific codegen backend in `x dist` by default
+                    if is_dylib(&entry.path())
+                        && !entry
+                            .path()
+                            .file_name()
+                            .and_then(|n| n.to_str())
+                            .map(|n| n.contains("libgccjit"))
+                            .unwrap_or(false)
+                    {
                         // Don't use custom libdir here because ^lib/ will be resolved again
                         // with installer
                         builder.install(&entry.path(), &image.join("lib"), FileType::NativeLibrary);