File tree Expand file tree Collapse file tree 4 files changed +33
-13
lines changed 
run-make-support/src/external_deps 
tests/run-make/foreign-exceptions Expand file tree Collapse file tree 4 files changed +33
-13
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,21 @@ impl Rustc {
344344        // endif 
345345        // ``` 
346346        let  flag = if  is_windows ( )  { 
347+             // So this is a bit hacky: we can't use the DLL version of libstdc++ because 
348+             // it pulls in the DLL version of libgcc, which means that we end up with 2 
349+             // instances of the DW2 unwinding implementation. This is a problem on 
350+             // i686-pc-windows-gnu because each module (DLL/EXE) needs to register its 
351+             // unwind information with the unwinding implementation, and libstdc++'s 
352+             // __cxa_throw won't see the unwinding info we registered with our statically 
353+             // linked libgcc. 
354+             // 
355+             // Now, simply statically linking libstdc++ would fix this problem, except 
356+             // that it is compiled with the expectation that pthreads is dynamically 
357+             // linked as a DLL and will fail to link with a statically linked libpthread. 
358+             // 
359+             // So we end up with the following hack: we link use static:-bundle to only 
360+             // link the parts of libstdc++ that we actually use, which doesn't include 
361+             // the dependency on the pthreads DLL. 
347362            if  is_msvc ( )  {  None  }  else  {  Some ( "-lstatic:-bundle=stdc++" )  } 
348363        }  else  { 
349364            match  & uname ( ) [ ..]  { 
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ run-make/extern-fn-with-union/Makefile
2929run-make/extern-multiple-copies/Makefile
3030run-make/extern-multiple-copies2/Makefile
3131run-make/fmt-write-bloat/Makefile
32- run-make/foreign-exceptions/Makefile
3332run-make/foreign-rust-exceptions/Makefile
3433run-make/incr-add-rust-src-component/Makefile
3534run-make/incr-foreign-head-span/Makefile
  Load Diff This file was deleted. 
Original file line number Diff line number Diff line change 1+ // This test was created to check that compilation and execution still works 
2+ // after the addition of a new feature, in #65646: the ability to unwind panics 
3+ // and exceptions back and forth between Rust and C++. Should this feature be broken, 
4+ // the test should fail. 
5+ // See https://github.com/rust-lang/rust/pull/65646 
6+ 
7+ //@ needs-unwind 
8+ // Reason: this test exercises panic unwinding 
9+ //@ ignore-cross-compile 
10+ // Reason: the compiled binary is executed 
11+ 
12+ use  run_make_support:: { build_native_static_lib_cxx,  run,  rustc} ; 
13+ 
14+ fn  main ( )  { 
15+     build_native_static_lib_cxx ( "foo" ) ; 
16+     rustc ( ) . input ( "foo.rs" ) . arg ( "-lfoo" ) . extra_rs_cxx_flags ( ) . run ( ) ; 
17+     run ( "foo" ) ; 
18+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments