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 {
398
398
}
399
399
}
400
400
401
+ /// Check with a binary that has no `.note.GNU-stack` section, indicating platform-default stack
402
+ /// writeability.
401
403
#[ test]
402
404
fn check_no_gnu_stack_obj ( ) {
403
405
// Should be supported on all Unix platforms
404
406
let p = env ! ( "NO_GNU_STACK_OBJ" ) ;
405
407
let f = fs:: read ( p) . unwrap ( ) ;
406
408
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
+ }
408
417
}
409
418
410
419
#[ test]
420
+ #[ cfg_attr( not( target_env = "gnu" ) , ignore = "requires a gnu toolchain to build" ) ]
411
421
fn check_obj ( ) {
412
422
let p = option_env ! ( "HAS_EXE_STACK_OBJ" ) . expect ( "has_exe_stack.o not present" ) ;
413
423
let f = fs:: read ( p) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments