summaryrefslogtreecommitdiff
path: root/sys-apps/fix-gnustack/files
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/fix-gnustack/files')
-rw-r--r--sys-apps/fix-gnustack/files/0.1/0001-fix-gnustack-respect-CFLAGS-LDFLAGS-for-tests.patch28
-rw-r--r--sys-apps/fix-gnustack/files/0.1/0002-fix-gnustack-add-set-x-in-tests-for-easier-debugging.patch22
-rw-r--r--sys-apps/fix-gnustack/files/0.1/0003-fix-gnustack-pass-Wl-z-execstack-for-tests-with-Clan.patch26
3 files changed, 76 insertions, 0 deletions
diff --git a/sys-apps/fix-gnustack/files/0.1/0001-fix-gnustack-respect-CFLAGS-LDFLAGS-for-tests.patch b/sys-apps/fix-gnustack/files/0.1/0001-fix-gnustack-respect-CFLAGS-LDFLAGS-for-tests.patch
new file mode 100644
index 000000000000..f0c786abf183
--- /dev/null
+++ b/sys-apps/fix-gnustack/files/0.1/0001-fix-gnustack-respect-CFLAGS-LDFLAGS-for-tests.patch
@@ -0,0 +1,28 @@
+From 4fb8a9cb2a5410aa565d028bd8deb53d8682da62 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 6 Jan 2023 05:39:13 +0000
+Subject: [PATCH 1/3] fix-gnustack: respect CFLAGS, LDFLAGS for tests
+
+Needed to correctly run tests with Clang, as Clang doesn't create
+executable stacks by default.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -5,11 +5,11 @@ noinst_PROGRAMS = bad-gnustack
+ EXTRA_DIST = gnustacktest.sh
+
+ bad-gnustack.s: bad-gnustack.c
+- $(CC) -S $<
++ $(CC) $(CPPFLAGS) $(CFLAGS) -S $<
+ $(SED) -i -e 's/GNU-stack,"",/GNU-stack,"x",/' $@
+
+ bad-gnustack$(EXEEXT): bad-gnustack.s
+- $(CC) -o $@ $<
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
+
+ check_SCRIPTS = gnustacktest
+ TEST = $(check_SCRIPTS)
+--
+2.39.0
+
diff --git a/sys-apps/fix-gnustack/files/0.1/0002-fix-gnustack-add-set-x-in-tests-for-easier-debugging.patch b/sys-apps/fix-gnustack/files/0.1/0002-fix-gnustack-add-set-x-in-tests-for-easier-debugging.patch
new file mode 100644
index 000000000000..16ade32c2bd1
--- /dev/null
+++ b/sys-apps/fix-gnustack/files/0.1/0002-fix-gnustack-add-set-x-in-tests-for-easier-debugging.patch
@@ -0,0 +1,22 @@
+From 87ca5c5bbe63ea3c9227fdd4a01ccdc1ce723323 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Fri, 6 Jan 2023 05:39:43 +0000
+Subject: [PATCH 2/3] fix-gnustack: add 'set -x' in tests for easier debugging
+
+It's hard to see why something failed otherwise, as we only have the
+exit code.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/tests/gnustacktest.sh
++++ b/tests/gnustacktest.sh
+@@ -16,6 +16,7 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #
++set -x
+
+ before=$(../fix-gnustack -f bad-gnustack)
+ before=$(echo ${before} | awk '{ print $2 }')
+--
+2.39.0
+
diff --git a/sys-apps/fix-gnustack/files/0.1/0003-fix-gnustack-pass-Wl-z-execstack-for-tests-with-Clan.patch b/sys-apps/fix-gnustack/files/0.1/0003-fix-gnustack-pass-Wl-z-execstack-for-tests-with-Clan.patch
new file mode 100644
index 000000000000..66ffa5e5136d
--- /dev/null
+++ b/sys-apps/fix-gnustack/files/0.1/0003-fix-gnustack-pass-Wl-z-execstack-for-tests-with-Clan.patch
@@ -0,0 +1,26 @@
+From c8a1d365ff1349cc438352917863ed98ee34a80f Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 11 Jan 2023 07:09:53 +0000
+Subject: [PATCH 3/3] fix-gnustack: pass -Wl,-z,execstack for tests with Clang
+
+Clang doesn't create executable stacks by default, so we need to force it
+for the purposes of the tests.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -8,8 +8,10 @@ bad-gnustack.s: bad-gnustack.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -S $<
+ $(SED) -i -e 's/GNU-stack,"",/GNU-stack,"x",/' $@
+
++# Clang doesn't create executable stacks by default, so
++# tests for fix-gnustack fail without this.
+ bad-gnustack$(EXEEXT): bad-gnustack.s
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
++ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,execstack -o $@ $<
+
+ check_SCRIPTS = gnustacktest
+ TEST = $(check_SCRIPTS)
+--
+2.39.0
+