diff options
Diffstat (limited to 'ld/testsuite/ld-elf/elf.exp')
-rw-r--r-- | ld/testsuite/ld-elf/elf.exp | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 119908cda4..ec61e659e0 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -180,9 +180,24 @@ if { [check_gc_sections_available] && ![istarget "v850-*-*"] } { } } -if { [istarget *-*-*linux*] - || [istarget *-*-nacl*] - || [istarget *-*-gnu*] } { +proc target_defaults_to_execstack {} { + if { [istarget "aarch64*-*-*"] + || [istarget "arc*-*-*"] + || [istarget "ia64*-*-*"] + || [istarget "loongarch*-*-*"] + || [istarget "nios2*-*-*"] + || [istarget "powerpc64*-*-*"] + || [istarget "riscv*-*-*"] + || [istarget "tilegx*-*-*"] + || [istarget "tilepro*-*-*"] } { + return 0 + } + return 1 +} + +if { [istarget *-*-*linux*] + || [istarget *-*-nacl*] + || [istarget *-*-gnu*] } { run_ld_link_tests [list \ [list "stack exec" \ "-z execstack" \ @@ -199,7 +214,7 @@ if { [istarget *-*-*linux*] {{readelf {-Wl} stack-noexec.rd}} \ "stack-noexec.exe"] \ [list "stack size" \ - "-z stack-size=0x123400" \ + "-z stack-size=0x123400 -z noexecstack" \ "" \ "" \ {stack.s} \ @@ -212,7 +227,49 @@ if { [istarget *-*-*linux*] {pr23900-1.s} \ [list [list "readelf" {-Wl} $pr23900_1_exp]] \ "pr23900-1.exe"] \ + [list "PR ld/29072 (warn about an executable .note-GNU-stack)" \ + "-e 0" \ + "" \ + "" \ + {pr29072-a.s} \ + {{ld pr29072.a.warn}} \ + "pr29072-a.exe"] \ + [list "PR 29072 (warn about -z execstack)" \ + "-z execstack --warn-execstack" \ + "" \ + "" \ + {stack.s} \ + {{ld pr29072.c.warn}} \ + "pr29072-c.exe"] \ + [list "PR ld/29072 (suppress warnings about executable stack)" \ + "-e 0 --no-warn-execstack" \ + "" \ + "" \ + {pr29072-a.s} \ + {} \ + "pr29072-d.exe"] \ + ] + if { [target_defaults_to_execstack] } { + run_ld_link_tests [list \ + [list "PR ld/29072 (warn about absent .note-GNU-stack)" \ + "-e 0 -z stack-size=0x123400" \ + "" \ + "" \ + {pr29072-b.s} \ + {{ld pr29072.b.warn}} \ + "pr29072-b.exe"] \ ] + } else { + run_ld_link_tests [list \ + [list "PR ld/29072 (ignore absent .note-GNU-stackk)" \ + "-e 0 -z stack-size=0x123400" \ + "" \ + "" \ + {pr29072-b.s} \ + {} \ + "pr29072-b.exe"] \ + ] + } } if [check_gc_sections_available] { @@ -365,7 +422,7 @@ if { [istarget *-*-linux*] run_ld_link_exec_tests [list \ [list \ "Run mbind2a" \ - "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000" \ + "$NOPIE_LDFLAGS -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2a" \ @@ -374,7 +431,7 @@ if { [istarget *-*-linux*] ] \ [list \ "Run mbind2b" \ - "-static -Wl,-z,common-page-size=0x4000" \ + "-static -Wl,-z,common-page-size=0x4000 -Wl,-z,noexecstack" \ "" \ { mbind2a.s mbind2b.c } \ "mbind2b" \ |