summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-11 07:20:42 +0000
committerSam James <sam@gentoo.org>2023-01-11 07:48:29 +0000
commitcc554dfa5dc6d0a41fc5cdf0c999618b6a379518 (patch)
tree6e200dc11bc420ea759240062de3aabdaf4b09c9 /sys-apps/fix-gnustack
parentnet-misc/rsync: backport UB fix (diff)
downloadgentoo-cc554dfa5dc6d0a41fc5cdf0c999618b6a379518.tar.gz
gentoo-cc554dfa5dc6d0a41fc5cdf0c999618b6a379518.tar.bz2
gentoo-cc554dfa5dc6d0a41fc5cdf0c999618b6a379518.zip
sys-apps/fix-gnustack: update EAPI 7 -> 8
Closes: https://bugs.gentoo.org/741816 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-apps/fix-gnustack')
-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
-rw-r--r--sys-apps/fix-gnustack/fix-gnustack-0.1-r1.ebuild30
4 files changed, 106 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
+
diff --git a/sys-apps/fix-gnustack/fix-gnustack-0.1-r1.ebuild b/sys-apps/fix-gnustack/fix-gnustack-0.1-r1.ebuild
new file mode 100644
index 000000000000..592e82c6121b
--- /dev/null
+++ b/sys-apps/fix-gnustack/fix-gnustack-0.1-r1.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="Utility to report and remove the executable flag from an ELF object's GNU_STACK"
+HOMEPAGE="https://dev.gentoo.org/~blueness/fix-gnustack"
+SRC_URI="https://dev.gentoo.org/~blueness/${PN}/${P}.tar.bz2"
+S="${WORKDIR}/${PN}"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="dev-libs/elfutils"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ # Backports from master, drop on next release
+ "${FILESDIR}"/${PV}
+)
+
+src_prepare() {
+ default
+
+ # Drop on next release, only needed for tests patch
+ eautoreconf
+}