[v5,3/4] elf: Add tst-execstack-prog-static

Message ID 20241128173851.1920696-4-adhemerval.zanella@linaro.org
State New
Headers
Series Improve executable stack handling |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Adhemerval Zanella Nov. 28, 2024, 5:36 p.m. UTC
  Similar to tst-execstack-prog, check if executable stacks works for
statically linked programs.
---
 elf/Makefile                    | 7 +++++++
 elf/tst-execstack-prog-static.c | 1 +
 2 files changed, 8 insertions(+)
 create mode 100644 elf/tst-execstack-prog-static.c
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index ba6b022a2f..bdd169f4e8 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -553,6 +553,9 @@  tests-execstack-yes = \
   tst-execstack-needed \
   tst-execstack-prog \
   # tests-execstack-yes
+tests-execstack-static-yes = \
+  tst-execstack-prog-static
+  # tests-execstack-static-yes
 endif
 ifeq ($(have-depaudit),yes)
 tests += \
@@ -647,6 +650,7 @@  $(objpfx)tst-rtld-dash-dash.out: tst-rtld-dash-dash.sh $(objpfx)ld.so
 	$(evaluate-test)
 
 tests += $(tests-execstack-$(have-z-execstack))
+tests-static+= $(tests-execstack-static-$(have-z-execstack))
 ifeq ($(run-built-tests),yes)
 tests-special += \
   $(objpfx)tst-ldconfig-X.out \
@@ -1916,6 +1920,9 @@  LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
 LDFLAGS-tst-execstack-prog = -Wl,-z,execstack
 CFLAGS-tst-execstack-prog.c += -Wno-trampolines
 CFLAGS-tst-execstack-mod.c += -Wno-trampolines
+
+LDFLAGS-tst-execstack-prog-static = -Wl,-z,execstack
+CFLAGS-tst-execstack-prog-static.c += -Wno-trampolines
 endif
 
 LDFLAGS-tst-array2 = -Wl,--no-as-needed
diff --git a/elf/tst-execstack-prog-static.c b/elf/tst-execstack-prog-static.c
new file mode 100644
index 0000000000..328065dd9c
--- /dev/null
+++ b/elf/tst-execstack-prog-static.c
@@ -0,0 +1 @@ 
+#include <tst-execstack-prog.c>