File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,29 @@ impl Step for Llvm {
515
515
}
516
516
}
517
517
518
+ // When building LLVM as a shared library on linux, it can contain debuginfo even when
519
+ // `llvm.release-debuginfo` is false: some debuginfo can come from the C++ standard library.
520
+ // If we're asked to do so, strip this debuginfo away.
521
+ if builder. llvm_link_shared ( )
522
+ && target. contains ( "linux" )
523
+ && builder. config . llvm_strip_debuginfo
524
+ {
525
+ // Find the name of the LLVM shared library that we just built.
526
+ let lib_name = find_llvm_lib_name ( "so" ) ;
527
+
528
+ // If the shared library exists in LLVM's `/build/lib/` or `/lib/` folders, strip its
529
+ // debuginfo. Note: `output` will propagate any errors here.
530
+ let strip_if_possible = |path : PathBuf | {
531
+ if path. exists ( ) {
532
+ let mut cmd = Command :: new ( "strip" ) ;
533
+ cmd. arg ( "--strip-debug" ) . arg ( path) ;
534
+ output ( & mut cmd) ;
535
+ }
536
+ } ;
537
+ strip_if_possible ( out_dir. join ( "lib" ) . join ( & lib_name) ) ;
538
+ strip_if_possible ( out_dir. join ( "build" ) . join ( "lib" ) . join ( & lib_name) ) ;
539
+ }
540
+
518
541
t ! ( stamp. write( ) ) ;
519
542
520
543
res
You can’t perform that action at this time.
0 commit comments