File tree Expand file tree Collapse file tree 3 files changed +24
-12
lines changed Expand file tree Collapse file tree 3 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -1924,16 +1924,27 @@ impl Step for LlvmTools {
1924
1924
drop ( fs:: remove_dir_all ( & image) ) ;
1925
1925
1926
1926
// Prepare the image directory
1927
- let bindir = builder
1927
+ let src_bindir = builder
1928
1928
. llvm_out ( target)
1929
1929
. join ( "bin" ) ;
1930
- let dst = image. join ( "lib/rustlib" )
1930
+ let dst_bindir = image. join ( "lib/rustlib" )
1931
1931
. join ( target)
1932
1932
. join ( "bin" ) ;
1933
- t ! ( fs:: create_dir_all( & dst ) ) ;
1933
+ t ! ( fs:: create_dir_all( & dst_bindir ) ) ;
1934
1934
for tool in LLVM_TOOLS {
1935
- let exe = bindir. join ( exe ( tool, & target) ) ;
1936
- builder. install ( & exe, & dst, 0o755 ) ;
1935
+ let exe = src_bindir. join ( exe ( tool, & target) ) ;
1936
+ builder. install ( & exe, & dst_bindir, 0o755 ) ;
1937
+ }
1938
+
1939
+ if builder. llvm_link_tools_dynamically ( target) {
1940
+ let src_libdir = builder
1941
+ . llvm_out ( target)
1942
+ . join ( "lib" ) ;
1943
+ let dst_libdir = image. join ( "lib/rustlib" )
1944
+ . join ( target)
1945
+ . join ( "lib" ) ;
1946
+ t ! ( fs:: create_dir_all( & dst_libdir) ) ;
1947
+ builder. install ( & src_libdir. join ( "libLLVM.so" ) , & dst_libdir, 0o644 ) ;
1937
1948
}
1938
1949
1939
1950
// Prepare the overlay
Original file line number Diff line number Diff line change @@ -1012,6 +1012,10 @@ impl Build {
1012
1012
self . rust_version ( )
1013
1013
}
1014
1014
1015
+ fn llvm_link_tools_dynamically ( & self , target : Interned < String > ) -> bool {
1016
+ target. contains ( "linux-gnu" ) || target. contains ( "apple-darwin" )
1017
+ }
1018
+
1015
1019
/// Returns the `version` string associated with this compiler for Rust
1016
1020
/// itself.
1017
1021
///
Original file line number Diff line number Diff line change @@ -170,13 +170,10 @@ impl Step for Llvm {
170
170
171
171
// This setting makes the LLVM tools link to the dynamic LLVM library,
172
172
// which saves both memory during parallel links and overall disk space
173
- // for the tools. We don't distribute any of those tools, so this is
174
- // just a local concern. However, it doesn't work well everywhere.
175
- //
176
- // If we are shipping llvm tools then we statically link them LLVM
177
- if ( target. contains ( "linux-gnu" ) || target. contains ( "apple-darwin" ) ) &&
178
- !builder. config . llvm_tools_enabled {
179
- cfg. define ( "LLVM_LINK_LLVM_DYLIB" , "ON" ) ;
173
+ // for the tools. We don't do this on every platform as it doesn't work
174
+ // equally well everywhere.
175
+ if builder. llvm_link_tools_dynamically ( target) {
176
+ cfg. define ( "LLVM_LINK_LLVM_DYLIB" , "ON" ) ;
180
177
}
181
178
182
179
// For distribution we want the LLVM tools to be *statically* linked to libstdc++
You can’t perform that action at this time.
0 commit comments