summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-04-30 08:02:15 +0100
committerSam James <sam@gentoo.org>2024-04-30 08:02:15 +0100
commit907cb4aa2d36c14e559e2b7a81f1281c8810264f (patch)
tree5206f0772b5ce02ef06fc6cac1c8a4948274ba24
parentnet-analyzer/nmap: Stabilize 7.94-r1 arm, #930960 (diff)
downloadgentoo-907cb4aa2d36c14e559e2b7a81f1281c8810264f.tar.gz
gentoo-907cb4aa2d36c14e559e2b7a81f1281c8810264f.tar.bz2
gentoo-907cb4aa2d36c14e559e2b7a81f1281c8810264f.zip
sys-devel/mold: fix tests w/ gcc 14
Test-only change. Bug: https://github.com/rui314/mold/issues/1244 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--sys-devel/mold/files/mold-2.30.0-gcc14.patch76
-rw-r--r--sys-devel/mold/files/mold-2.30.0-which-hunt.patch31
-rw-r--r--sys-devel/mold/mold-2.30.0.ebuild5
3 files changed, 112 insertions, 0 deletions
diff --git a/sys-devel/mold/files/mold-2.30.0-gcc14.patch b/sys-devel/mold/files/mold-2.30.0-gcc14.patch
new file mode 100644
index 000000000000..74e7f5081eeb
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.30.0-gcc14.patch
@@ -0,0 +1,76 @@
+https://github.com/rui314/mold/issues/1244
+https://github.com/rui314/mold/commit/002d619b11f38438514f4714f9eb89e8015ba1b6
+https://github.com/rui314/mold/commit/14952546a489c23236f50adc5ef9c8ada4f4e31a
+
+From 002d619b11f38438514f4714f9eb89e8015ba1b6 Mon Sep 17 00:00:00 2001
+From: Rui Ueyama <ruiu@cs.stanford.edu>
+Date: Thu, 25 Apr 2024 16:58:09 +0900
+Subject: [PATCH] Attempt to fix a test failure
+
+I believe some version of objcopy corrupts an object file when
+renaming a section. In this change, I use sed instead of objcopy
+as a workaround.
+
+Fixes https://github.com/rui314/mold/issues/1244
+---
+ test/elf/exception-multiple-ehframe.sh | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
+index ca1d1a1c0..a9b360b09 100755
+--- a/test/elf/exception-multiple-ehframe.sh
++++ b/test/elf/exception-multiple-ehframe.sh
+@@ -28,9 +28,9 @@ int bar() {
+ }
+ EOF
+
+-$OBJCOPY --rename-section .eh_frame=.eh_frame2 $t/a.o
++sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
+ ./mold -r -o $t/c.o $t/a.o $t/b.o
+-$OBJCOPY --rename-section .eh_frame2=.eh_frame $t/c.o
++sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
+
+ cat <<EOF | $CXX -o $t/d.o -c -xc++ -
+ #include <stdio.h>
+@@ -44,5 +44,4 @@ int main() {
+ EOF
+
+ $CXX -B. -o $t/exe1 $t/d.o $t/c.o
+-$QEMU $t/exe1
+ $QEMU $t/exe1 | grep -q '^1 3$'
+
+From 14952546a489c23236f50adc5ef9c8ada4f4e31a Mon Sep 17 00:00:00 2001
+From: Rui Ueyama <ruiu@cs.stanford.edu>
+Date: Sun, 28 Apr 2024 13:04:43 +0900
+Subject: [PATCH] Do not edit binary files with sed
+
+Fixes https://github.com/rui314/mold/issues/1244
+---
+ test/elf/exception-multiple-ehframe.sh | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
+index a9b360b09..8cc31624a 100755
+--- a/test/elf/exception-multiple-ehframe.sh
++++ b/test/elf/exception-multiple-ehframe.sh
+@@ -3,6 +3,8 @@
+
+ nm mold | grep -q '__tsan_init' && skip
+
++which perl > /dev/null || skip
++
+ [ $MACHINE = m68k ] && skip
+ [ $MACHINE = sh4 ] && skip
+
+@@ -28,9 +30,9 @@ int bar() {
+ }
+ EOF
+
+-sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
++perl -i -0777 -pe 's/\.eh_frame/.EH_FRAME/g' $t/a.o
+ ./mold -r -o $t/c.o $t/a.o $t/b.o
+-sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
++perl -i -0777 -pe 's/\.EH_FRAME/.eh_frame/g' $t/c.o
+
+ cat <<EOF | $CXX -o $t/d.o -c -xc++ -
+ #include <stdio.h>
diff --git a/sys-devel/mold/files/mold-2.30.0-which-hunt.patch b/sys-devel/mold/files/mold-2.30.0-which-hunt.patch
new file mode 100644
index 000000000000..d8558091c4bc
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.30.0-which-hunt.patch
@@ -0,0 +1,31 @@
+https://github.com/rui314/mold/pull/1246
+
+From ec0a9d09ddff8b1796ff1822d5381442cd28acb1 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Tue, 30 Apr 2024 07:54:40 +0100
+Subject: [PATCH] test: use `command -v`, not non-portable `which`
+
+`which` isn't in POSIX and several Linux distributions are trying to
+remove it from their base system, see e.g. https://lwn.net/Articles/874049/.
+
+Just use `command -v` which is POSIX.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ test/elf/exception-multiple-ehframe.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh b/test/elf/exception-multiple-ehframe.sh
+index 8cc31624a..1b9f434a4 100755
+--- a/test/elf/exception-multiple-ehframe.sh
++++ b/test/elf/exception-multiple-ehframe.sh
+@@ -3,7 +3,7 @@
+
+ nm mold | grep -q '__tsan_init' && skip
+
+-which perl > /dev/null || skip
++command -v perl > /dev/null || skip
+
+ [ $MACHINE = m68k ] && skip
+ [ $MACHINE = sh4 ] && skip
+
diff --git a/sys-devel/mold/mold-2.30.0.ebuild b/sys-devel/mold/mold-2.30.0.ebuild
index a121f5ffefba..cce55d1650c9 100644
--- a/sys-devel/mold/mold-2.30.0.ebuild
+++ b/sys-devel/mold/mold-2.30.0.ebuild
@@ -31,6 +31,11 @@ RDEPEND="
"
DEPEND="${RDEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${P}-gcc14.patch
+ "${FILESDIR}"/${PN}-2.30.0-which-hunt.patch
+)
+
pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then