Skip to content

Commit 100cf3e

Browse files
committed
update
1 parent 425ff2a commit 100cf3e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crates/symbol-check/src/main.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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]
402404
fn 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")]
411421
fn 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();

0 commit comments

Comments
 (0)