ld testsuite add test for noexecstack

Message ID 20180517203527.9778-1-flavio.ceolin@intel.com
State New
Headers show
Series
  • ld testsuite add test for noexecstack
Related show

Commit Message

Ceolin, Flavio May 17, 2018, 8:35 p.m.
Add a test similar to "execstack" flag but for "noexecstack".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>

---
 ld/ChangeLog                        | 5 +++++
 ld/testsuite/ld-elf/elf.exp         | 2 ++
 ld/testsuite/ld-elf/stack-noexec.rd | 3 +++
 3 files changed, 10 insertions(+)
 create mode 100644 ld/testsuite/ld-elf/stack-noexec.rd

-- 
2.14.3

Comments

Ceolin, Flavio May 30, 2018, 10:34 p.m. | #1
ping :)
________________________________________
From: Ceolin, Flavio

Sent: Thursday, May 17, 2018 13:35
To: binutils@sourceware.org
Cc: Ceolin, Flavio
Subject: [PATCH] ld testsuite add test for noexecstack

Add a test similar to "execstack" flag but for "noexecstack".

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>

---
 ld/ChangeLog                        | 5 +++++
 ld/testsuite/ld-elf/elf.exp         | 2 ++
 ld/testsuite/ld-elf/stack-noexec.rd | 3 +++
 3 files changed, 10 insertions(+)
 create mode 100644 ld/testsuite/ld-elf/stack-noexec.rd

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 78c0d265e2..203d3871dd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-16  Flavio Ceolin  <flavio.ceolin@intel.com>
+
+       * testsuite/ld-elf/elf.exp Run new test.
+       * testsuite/ld-elf/stack-noexec.rd New file: Expected readelf output.
+
 2018-05-15  Alan Modra  <amodra@gmail.com>

        * testsuite/ld-elf/notes.exp: Restore LDFLAGS.
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index b74b82ceab..b3223cf721 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -165,6 +165,8 @@ if { [istarget *-*-*linux*]
     run_ld_link_tests {
        {"stack exec" "-z execstack" "" "" {stack.s}
            {{readelf {-Wl} stack-exec.rd}} "stack-exec.exe"}
+       {"stack noexec" "-z noexecstack" "" "" {stack.s}
+           {{readelf {-Wl} stack-noexec.rd}} "stack-noexec.exe"}
        {"stack size" "-z stack-size=0x123400" "" "" {stack.s}
            {{readelf {-Wl} stack-size.rd}} "stack-size.exe"}
     }
diff --git a/ld/testsuite/ld-elf/stack-noexec.rd b/ld/testsuite/ld-elf/stack-noexec.rd
new file mode 100644
index 0000000000..96afb07d40
--- /dev/null
+++ b/ld/testsuite/ld-elf/stack-noexec.rd
@@ -0,0 +1,3 @@
+#...
+  GNU_STACK      0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RW  0x[0-9a-f]+
+#pass
--
2.14.3
Nick Clifton June 5, 2018, 11:41 a.m. | #2
Hi Flavio,

> ping :)


Sorry sorry sorry - this one completely slipped through my fingers.


> +2018-05-16  Flavio Ceolin  <flavio.ceolin@intel.com>

> +

> +       * testsuite/ld-elf/elf.exp Run new test.

> +       * testsuite/ld-elf/stack-noexec.rd New file: Expected readelf output.

> +


Approved and applied.

Cheers
  Nick

Patch

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 78c0d265e2..203d3871dd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-05-16  Flavio Ceolin  <flavio.ceolin@intel.com>
+
+	* testsuite/ld-elf/elf.exp Run new test.
+	* testsuite/ld-elf/stack-noexec.rd New file: Expected readelf output.
+
 2018-05-15  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/ld-elf/notes.exp: Restore LDFLAGS.
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index b74b82ceab..b3223cf721 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -165,6 +165,8 @@  if { [istarget *-*-*linux*]
     run_ld_link_tests {
 	{"stack exec" "-z execstack" "" "" {stack.s}
 	    {{readelf {-Wl} stack-exec.rd}} "stack-exec.exe"}
+	{"stack noexec" "-z noexecstack" "" "" {stack.s}
+	    {{readelf {-Wl} stack-noexec.rd}} "stack-noexec.exe"}
 	{"stack size" "-z stack-size=0x123400" "" "" {stack.s}
 	    {{readelf {-Wl} stack-size.rd}} "stack-size.exe"}
     }
diff --git a/ld/testsuite/ld-elf/stack-noexec.rd b/ld/testsuite/ld-elf/stack-noexec.rd
new file mode 100644
index 0000000000..96afb07d40
--- /dev/null
+++ b/ld/testsuite/ld-elf/stack-noexec.rd
@@ -0,0 +1,3 @@ 
+#...
+  GNU_STACK      0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RW  0x[0-9a-f]+
+#pass