forked from Imagelibrary/binutils-gdb
Add tests of the linker's --errror-execstack and --error-rwx-segments options
This commit is contained in:
@@ -285,6 +285,13 @@ if { [istarget *-*-*linux*]
|
|||||||
{pr29072-a.s} \
|
{pr29072-a.s} \
|
||||||
{{ld pr29072.a.warn}} \
|
{{ld pr29072.a.warn}} \
|
||||||
"pr29072-a.exe"] \
|
"pr29072-a.exe"] \
|
||||||
|
[list "Test --error-execstack with an executable .note.GNU-stack" \
|
||||||
|
"--warn-execstack --error-execstack" \
|
||||||
|
"" \
|
||||||
|
"" \
|
||||||
|
{pr29072-a.s} \
|
||||||
|
{{ld gnu_execstack.err}} \
|
||||||
|
"gnu_execstack.exe"] \
|
||||||
[list "PR 29072 (warn about -z execstack)" \
|
[list "PR 29072 (warn about -z execstack)" \
|
||||||
"-z execstack --warn-execstack --no-error-execstack" \
|
"-z execstack --warn-execstack --no-error-execstack" \
|
||||||
"" \
|
"" \
|
||||||
@@ -292,6 +299,13 @@ if { [istarget *-*-*linux*]
|
|||||||
{stack.s} \
|
{stack.s} \
|
||||||
{{ld pr29072.c.warn}} \
|
{{ld pr29072.c.warn}} \
|
||||||
"pr29072-c.exe"] \
|
"pr29072-c.exe"] \
|
||||||
|
[list "Test --error-execstack with -z execstack" \
|
||||||
|
"-z execstack --warn-execstack --error-execstack" \
|
||||||
|
"" \
|
||||||
|
"" \
|
||||||
|
{stack.s} \
|
||||||
|
{{ld z_execstack.err}} \
|
||||||
|
"execstack.exe"] \
|
||||||
[list "PR ld/29072 (suppress warnings about executable stack)" \
|
[list "PR ld/29072 (suppress warnings about executable stack)" \
|
||||||
"-e 0 --no-warn-execstack" \
|
"-e 0 --no-warn-execstack" \
|
||||||
"" \
|
"" \
|
||||||
@@ -299,13 +313,20 @@ if { [istarget *-*-*linux*]
|
|||||||
{pr29072-a.s} \
|
{pr29072-a.s} \
|
||||||
{} \
|
{} \
|
||||||
"pr29072-d.exe"] \
|
"pr29072-d.exe"] \
|
||||||
[list "Ensure that a warning issued when creating a segment with RWX permissions" \
|
[list "Ensure that a warning is issued when creating a segment with RWX permissions" \
|
||||||
"-e 0 -Tnobits-1.t --warn-rwx-segments --no-error-rwx-segments" \
|
"-e 0 -Tnobits-1.t --warn-rwx-segments --no-error-rwx-segments" \
|
||||||
"" \
|
"" \
|
||||||
"" \
|
"" \
|
||||||
{nobits-1.s} \
|
{nobits-1.s} \
|
||||||
{{ld rwx-segments-1.l}} \
|
{{ld rwx-segments-1.l}} \
|
||||||
"rwx-segments-1.exe"] \
|
"rwx-segments-1.exe"] \
|
||||||
|
[list "Ensure that a error can be issued when creating a segment with RWX permissions" \
|
||||||
|
"-e 0 -Tnobits-1.t --warn-rwx-segments --error-rwx-segments" \
|
||||||
|
"" \
|
||||||
|
"" \
|
||||||
|
{nobits-1.s} \
|
||||||
|
{{ld rwx-segments-3.err}} \
|
||||||
|
"rwx-segments-3.exe"] \
|
||||||
[list "Ensure that a warning issued when creating a TLS segment with execute permission" \
|
[list "Ensure that a warning issued when creating a TLS segment with execute permission" \
|
||||||
"-e 0 -T rwx-segments-2.t --warn-rwx-segments --no-error-rwx-segments" \
|
"-e 0 -T rwx-segments-2.t --warn-rwx-segments --no-error-rwx-segments" \
|
||||||
"" \
|
"" \
|
||||||
@@ -313,6 +334,13 @@ if { [istarget *-*-*linux*]
|
|||||||
{size-2.s} \
|
{size-2.s} \
|
||||||
{{ld rwx-segments-2.l}} \
|
{{ld rwx-segments-2.l}} \
|
||||||
"rwx-segments-2.exe"] \
|
"rwx-segments-2.exe"] \
|
||||||
|
[list "Ensure that an error cn be issued when creating a TLS segment with execute permission" \
|
||||||
|
"-e 0 -T rwx-segments-2.t --warn-rwx-segments --error-rwx-segments" \
|
||||||
|
"" \
|
||||||
|
"" \
|
||||||
|
{size-2.s} \
|
||||||
|
{{ld rwx-segments-4.err}} \
|
||||||
|
"rwx-segments-4.exe"] \
|
||||||
[list "Ensure that the RWX warning can be suppressed" \
|
[list "Ensure that the RWX warning can be suppressed" \
|
||||||
"-e 0 -Tnobits-1.t --no-warn-rwx-segments" \
|
"-e 0 -Tnobits-1.t --no-warn-rwx-segments" \
|
||||||
"" \
|
"" \
|
||||||
@@ -334,6 +362,16 @@ if { [istarget *-*-*linux*]
|
|||||||
{{ld pr29072.b.warn}} \
|
{{ld pr29072.b.warn}} \
|
||||||
"pr29072-b.exe"] \
|
"pr29072-b.exe"] \
|
||||||
]
|
]
|
||||||
|
|
||||||
|
run_ld_link_tests [list \
|
||||||
|
[list "error when .note.GNU-stack is absent" \
|
||||||
|
"-e 0 -z stack-size=0x123400 --warn-execstack --error-execstack" \
|
||||||
|
"" \
|
||||||
|
"" \
|
||||||
|
{pr29072-b.s} \
|
||||||
|
{{ld missing-execstack.err}} \
|
||||||
|
"missing-execstack.exe"] \
|
||||||
|
]
|
||||||
} else {
|
} else {
|
||||||
run_ld_link_tests [list \
|
run_ld_link_tests [list \
|
||||||
[list "PR ld/29072 (ignore absent .note.GNU-stack)" \
|
[list "PR ld/29072 (ignore absent .note.GNU-stack)" \
|
||||||
|
|||||||
3
ld/testsuite/ld-elf/gnu_execstack.err
Normal file
3
ld/testsuite/ld-elf/gnu_execstack.err
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#...
|
||||||
|
.*: error: .*: is triggering the generation of an executable stack \(because it has an executable .note.GNU-stack section\)
|
||||||
|
#...
|
||||||
3
ld/testsuite/ld-elf/missing-execstack.err
Normal file
3
ld/testsuite/ld-elf/missing-execstack.err
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#...
|
||||||
|
.*: error: .*\.o: is triggering the generation of an executable stack because it does not have a .note.GNU-stack section
|
||||||
|
#...
|
||||||
3
ld/testsuite/ld-elf/rwx-segments-3.err
Normal file
3
ld/testsuite/ld-elf/rwx-segments-3.err
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#...
|
||||||
|
.* error: .* has a LOAD segment with RWX permissions
|
||||||
|
#...
|
||||||
3
ld/testsuite/ld-elf/rwx-segments-4.err
Normal file
3
ld/testsuite/ld-elf/rwx-segments-4.err
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#...
|
||||||
|
.*: error: .* has a TLS segment with execute permission
|
||||||
|
#...
|
||||||
4
ld/testsuite/ld-elf/z_execstack.err
Normal file
4
ld/testsuite/ld-elf/z_execstack.err
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#...
|
||||||
|
.*: error: creating an executable stack because of -z execstack command line option
|
||||||
|
#...
|
||||||
|
|
||||||
Reference in New Issue
Block a user