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+
13fn main ( ) {
4+ let compiler = cc:: Build :: new ( ) . get_compiler ( ) ;
5+
26 let objs = cc:: Build :: new ( )
37 . file ( "tests/no_gnu_stack.S" )
48 . compile_intermediates ( ) ;
@@ -7,13 +11,14 @@ fn main() {
711 } ;
812 println ! ( "cargo::rustc-env=NO_GNU_STACK_OBJ={}" , obj. display( ) ) ;
913
10- let mut b = cc:: Build :: new ( ) ;
11- if !b. get_compiler ( ) . is_like_gnu ( ) {
14+ if !compiler. is_like_gnu ( ) {
1215 println ! ( "cargo::warning=Can't run execstack test; non-GNU compiler" ) ;
1316 return ;
1417 }
1518
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 ( ) ;
1722 let [ obj] = objs. as_slice ( ) else {
1823 panic ! ( ">1 output" )
1924 } ;
Original file line number Diff line number Diff line change @@ -406,6 +406,12 @@ fn check_no_gnu_stack_obj() {
406406 let p = env ! ( "NO_GNU_STACK_OBJ" ) ;
407407 let f = fs:: read ( p) . unwrap ( ) ;
408408 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+ ) ;
409415 let has_exe_stack = obj_requires_exe_stack ( & obj) ;
410416
411417 if cfg ! ( target_os = "windows" ) || cfg ! ( target_vendor = "apple" ) {
@@ -422,5 +428,11 @@ fn check_obj() {
422428 let p = option_env ! ( "HAS_EXE_STACK_OBJ" ) . expect ( "has_exe_stack.o not present" ) ;
423429 let f = fs:: read ( p) . unwrap ( ) ;
424430 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+ ) ;
425437 assert ! ( obj_requires_exe_stack( & obj) ) ;
426438}
You can’t perform that action at this time.
0 commit comments