File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -1434,10 +1434,10 @@ impl Build {
1434
1434
. arg ( dst. join ( dynlib_name) )
1435
1435
. args ( & objects) ;
1436
1436
run ( cmd, & self . cargo_output ) ?;
1437
+ } else {
1438
+ self . assemble ( lib_name, & dst. join ( static_name) , & objects) ?;
1437
1439
}
1438
1440
1439
- self . assemble ( lib_name, & dst. join ( static_name) , & objects) ?;
1440
-
1441
1441
let target = self . get_target ( ) ?;
1442
1442
if target. env == "msvc" {
1443
1443
let compiler = self . get_base_compiler ( ) ?;
Original file line number Diff line number Diff line change @@ -354,6 +354,29 @@ fn gnu_shared() {
354
354
test. cmd ( 0 ) . must_have ( "-shared" ) . must_not_have ( "-static" ) ;
355
355
}
356
356
357
+ #[ test]
358
+ fn gnu_link_shared ( ) {
359
+ reset_env ( ) ;
360
+ let test = Test :: gnu ( ) ;
361
+
362
+ let root_dir = env ! ( "CARGO_MANIFEST_DIR" ) ;
363
+ let src = format ! ( "{root_dir}/dev-tools/cc-test/src/foo.c" ) ;
364
+ let target = "x86_64-unknown-linux-gnu" ;
365
+
366
+ cc:: Build :: new ( )
367
+ . host ( target)
368
+ . target ( target)
369
+ . opt_level ( 2 )
370
+ . out_dir ( test. td . path ( ) )
371
+ . file ( & src)
372
+ . shared_flag ( true )
373
+ . static_flag ( false )
374
+ . link_shared_flag ( true )
375
+ . compile ( "foo" ) ;
376
+
377
+ assert ! ( test. td. path( ) . join( "libfoo.so" ) . exists( ) ) ;
378
+ }
379
+
357
380
#[ test]
358
381
fn gnu_flag_if_supported ( ) {
359
382
reset_env ( ) ;
You can’t perform that action at this time.
0 commit comments