From c2de45cbdaee1a8c81b2d65f6bced1439a738e00 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Mon, 20 Dec 2021 01:48:49 +0100
Subject: [PATCH 07/15] link stage 2 tools dynamically to libstd

stage 2 tools are the ones that are distributed, and we distribute
them together with the rust libs so there is no need to worry
about unstable ABI
---
 src/bootstrap/builder.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 62b5416ce..554dd4188 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -2066,6 +2066,8 @@ impl<'a> Builder<'a> {
         // linking all deps statically into the dylib.
         if matches!(mode, Mode::Std | Mode::Rustc) {
             rustflags.arg("-Cprefer-dynamic");
+        } else if stage >= 2 {
+            rustflags.arg("-Cprefer-dynamic");
         }
 
         // When building incrementally we default to a lower ThinLTO import limit
-- 
2.37.2

