File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -398,16 +398,26 @@ impl Archive {
398398 }
399399}
400400
401+ /// Check with a binary that has no `.note.GNU-stack` section, indicating platform-default stack
402+ /// writeability.
401403#[ test]
402404fn check_no_gnu_stack_obj ( ) {
403405 // Should be supported on all Unix platforms
404406 let p = env ! ( "NO_GNU_STACK_OBJ" ) ;
405407 let f = fs:: read ( p) . unwrap ( ) ;
406408 let obj = ObjFile :: parse ( f. as_slice ( ) ) . unwrap ( ) ;
407- assert ! ( obj_requires_exe_stack( & obj) ) ;
409+ let has_exe_stack = obj_requires_exe_stack ( & obj) ;
410+
411+ if cfg ! ( target_os = "windows" ) || cfg ! ( target_vendor = "apple" ) {
412+ // Non-ELF targets don't have executable stacks marked in the same way
413+ assert ! ( !has_exe_stack) ;
414+ } else {
415+ assert ! ( has_exe_stack) ;
416+ }
408417}
409418
410419#[ test]
420+ #[ cfg_attr( not( target_env = "gnu" ) , ignore = "requires a gnu toolchain to build" ) ]
411421fn check_obj ( ) {
412422 let p = option_env ! ( "HAS_EXE_STACK_OBJ" ) . expect ( "has_exe_stack.o not present" ) ;
413423 let f = fs:: read ( p) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments