File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ //! Compile test sources to object files.
2
+
1
3
fn main ( ) {
4
+ let compiler = cc:: Build :: new ( ) . get_compiler ( ) ;
5
+
2
6
let objs = cc:: Build :: new ( )
3
7
. file ( "tests/no_gnu_stack.S" )
4
8
. compile_intermediates ( ) ;
@@ -7,13 +11,14 @@ fn main() {
7
11
} ;
8
12
println ! ( "cargo::rustc-env=NO_GNU_STACK_OBJ={}" , obj. display( ) ) ;
9
13
10
- let mut b = cc:: Build :: new ( ) ;
11
- if !b. get_compiler ( ) . is_like_gnu ( ) {
14
+ if !compiler. is_like_gnu ( ) {
12
15
println ! ( "cargo::warning=Can't run execstack test; non-GNU compiler" ) ;
13
16
return ;
14
17
}
15
18
16
- let objs = b. file ( "tests/has_exe_stack.c" ) . compile_intermediates ( ) ;
19
+ let objs = cc:: Build :: new ( )
20
+ . file ( "tests/has_exe_stack.c" )
21
+ . compile_intermediates ( ) ;
17
22
let [ obj] = objs. as_slice ( ) else {
18
23
panic ! ( ">1 output" )
19
24
} ;
Original file line number Diff line number Diff line change @@ -406,6 +406,12 @@ fn check_no_gnu_stack_obj() {
406
406
let p = env ! ( "NO_GNU_STACK_OBJ" ) ;
407
407
let f = fs:: read ( p) . unwrap ( ) ;
408
408
let obj = ObjFile :: parse ( f. as_slice ( ) ) . unwrap ( ) ;
409
+ dbg ! (
410
+ obj. format( ) ,
411
+ obj. architecture( ) ,
412
+ obj. sub_architecture( ) ,
413
+ obj. is_64( )
414
+ ) ;
409
415
let has_exe_stack = obj_requires_exe_stack ( & obj) ;
410
416
411
417
if cfg ! ( target_os = "windows" ) || cfg ! ( target_vendor = "apple" ) {
@@ -422,5 +428,11 @@ fn check_obj() {
422
428
let p = option_env ! ( "HAS_EXE_STACK_OBJ" ) . expect ( "has_exe_stack.o not present" ) ;
423
429
let f = fs:: read ( p) . unwrap ( ) ;
424
430
let obj = ObjFile :: parse ( f. as_slice ( ) ) . unwrap ( ) ;
431
+ dbg ! (
432
+ obj. format( ) ,
433
+ obj. architecture( ) ,
434
+ obj. sub_architecture( ) ,
435
+ obj. is_64( )
436
+ ) ;
425
437
assert ! ( obj_requires_exe_stack( & obj) ) ;
426
438
}
You can’t perform that action at this time.
0 commit comments