Thursday, June 10, 2021

Fix devel/libffi on mips64

devel/libffi has been broken on mips64 since base clang was upgraded
to version 11. The integrated assembler is now more strict about section
flags and throws an error if .eh_frame section is not read-only.

The following patch lets devel/libffi build finish.

OK?

Index: Makefile
===================================================================
RCS file: ports/devel/libffi/Makefile,v
retrieving revision 1.42
diff -u -p -r1.42 Makefile
--- Makefile 10 Feb 2020 18:06:34 -0000 1.42
+++ Makefile 10 Jun 2021 15:30:55 -0000
@@ -3,6 +3,7 @@
COMMENT= Foreign Function Interface

DISTNAME= libffi-3.3
+REVISION= 0
SHARED_LIBS += ffi 1.2 # .6.4
CATEGORIES= devel

Index: patches/patch-src_mips_n32_S
===================================================================
RCS file: patches/patch-src_mips_n32_S
diff -N patches/patch-src_mips_n32_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_mips_n32_S 10 Jun 2021 15:31:06 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Use EH_FRAME_FLAGS to get section flags that clang's integrated assembler
+expects. This fixes the following build error on mips64:
+
+../src/mips/n32.S:585:9: error: changed section flags for .eh_frame, expected: 0x2
+ .section .eh_frame,"aw",@progbits
+ ^
+
+Index: src/mips/n32.S
+--- src/mips/n32.S.orig
++++ src/mips/n32.S
+@@ -582,7 +582,7 @@ cls_epilogue:
+ .end ffi_closure_N32
+
+ #ifdef __GNUC__
+- .section .eh_frame,"aw",@progbits
++ .section .eh_frame,EH_FRAME_FLAGS,@progbits
+ .Lframe1:
+ .4byte .LECIE1-.LSCIE1 # length
+ .LSCIE1:

No comments:

Post a Comment