commit:     2e3cc0b99dbeabd39abda0ee063760a6434ed060
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Fri Jun 13 04:27:31 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct  9 07:40:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e3cc0b9

dev-libs/ffcall: fix compilation with clang

patch from upstream

Closes: https://bugs.gentoo.org/829663
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42572
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/ffcall/ffcall-2.4-r2.ebuild               | 69 ++++++++++++++++++++++
 ...te-a-read-only-.eh_frame-section-on-all-p.patch | 65 ++++++++++++++++++++
 2 files changed, 134 insertions(+)

diff --git a/dev-libs/ffcall/ffcall-2.4-r2.ebuild 
b/dev-libs/ffcall/ffcall-2.4-r2.ebuild
new file mode 100644
index 000000000000..66c961625fe8
--- /dev/null
+++ b/dev-libs/ffcall/ffcall-2.4-r2.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic libtool
+
+MY_PV="libffcall-${PV}"
+
+DESCRIPTION="Build foreign function call interfaces in embedded interpreter"
+HOMEPAGE="https://www.gnu.org/software/libffcall/";
+SRC_URI="mirror://gnu/libffcall/${MY_PV}.tar.gz"
+S="${WORKDIR}"/${MY_PV}
+
+# "Ffcall is under GNU GPL. As a special exception, if used in GNUstep
+# or in derivate works of GNUstep, the included parts of ffcall are
+# under GNU LGPL." -ffcall author
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos"
+
+PATCHES=(
+       # bug 842915, drop on next version bump
+       "${FILESDIR}"/${PN}-2.4-vacall-riscv-pic.patch
+       "${FILESDIR}"/${PN}-2.4-slibtool.patch # 776976
+       
"${FILESDIR}"/${PN}-2.4-create-a-read-only-.eh_frame-section-on-all-p.patch # 
829663
+)
+
+src_prepare() {
+       # The build system is a strange mix of autogenerated
+       # files and manual tweaks on top. Uses $CFLAGS / $LDFLAGS randomly.
+       # We are adding them consistently here and a bit over the top:
+       # bugs: #334581
+       local mfi
+       for mfi in {,*/,*/*/,}Makefile.in ; do
+               einfo "Patching '${mfi}'"
+               # usually uses only assembler here, but -march=
+               # and -Wa, are a must to pass here.
+               sed -e 's/$(CC) /&$(CFLAGS) /g' \
+                       -i "${mfi}" || die
+       done
+
+       default
+       elibtoolize
+}
+
+src_configure() {
+       append-flags -fPIC
+
+       # Doc goes in datadir
+       econf \
+               --datadir="${EPREFIX}"/usr/share/doc/${PF} \
+               --enable-shared \
+               --disable-static
+}
+
+src_compile() {
+       # TODO. Remove -j1
+       emake -j1
+}
+
+src_install() {
+       dodoc NEWS README
+       dodir /usr/share/man
+
+       default
+
+       find "${ED}" -name '*.la' -delete || die
+}

diff --git 
a/dev-libs/ffcall/files/ffcall-2.4-create-a-read-only-.eh_frame-section-on-all-p.patch
 
b/dev-libs/ffcall/files/ffcall-2.4-create-a-read-only-.eh_frame-section-on-all-p.patch
new file mode 100644
index 000000000000..1eb9fb2ee759
--- /dev/null
+++ 
b/dev-libs/ffcall/files/ffcall-2.4-create-a-read-only-.eh_frame-section-on-all-p.patch
@@ -0,0 +1,65 @@
+https://git.savannah.gnu.org/cgit/libffcall.git/commit/?id=580f0bb144c0d63560c61229291e172e55971437
+
+From 580f0bb144c0d63560c61229291e172e55971437 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <[email protected]>
+Date: Sat, 26 Jun 2021 18:19:21 +0200
+Subject: [PATCH] x86_64: Create a read-only .eh_frame section on all
+ platforms.
+
+Reported by Thomas Klausner <[email protected]> at
+<https://savannah.gnu.org/bugs/?60815>.
+
+* common/asm-x86_64.h (EH_FRAME_SECTION): Use flags "a" (instead of
+"aw") on all platforms.
+
+diff --git a/ChangeLog b/ChangeLog
+index 1e87b99..d2bde2a 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,11 @@
++2021-06-26  Bruno Haible  <[email protected]>
++
++      x86_64: Create a read-only .eh_frame section on all platforms.
++      Reported by Thomas Klausner <[email protected]> at
++      <https://savannah.gnu.org/bugs/?60815>.
++      * common/asm-x86_64.h (EH_FRAME_SECTION): Use flags "a" (instead of
++      "aw") on all platforms.
++
+ 2021-06-13  Bruno Haible  <[email protected]>
+ 
+       maint: Don't require an internet connection for running autogen.sh.
+diff --git a/common/asm-x86_64.h b/common/asm-x86_64.h
+index b4713d7..edb1ea5 100644
+--- a/common/asm-x86_64.h
++++ b/common/asm-x86_64.h
+@@ -279,11 +279,24 @@
+ // Solaris/ELF
+ #define EH_FRAME_SECTION .eh_frame,"aL",link=.text,@unwind
+ #else
+-#if defined __FreeBSD__
+-// FreeBSD/ELF
++// The eh_frame section was usually writable (flags "aw") in older OS 
versions,
++// but can be made read-only (flags "a") under specific conditions, depending
++// on the assembler's behaviour (look for EH_TABLES_CAN_BE_READ_ONLY in
++// gcc-11.1.0/gcc/defaults.h).
++// To determine whether the eh_frame section is writable or read-only by
++// default, compile a simple program:
++//   gcc -S -fno-dwarf2-cfi-asm hello.c  (GCC >= 4.4)
++// or
++//   gcc -S hello.c                      (GCC < 4.4)
++// The result is that all modern systems (at least Ubuntu >= 16.04,
++// Red Hat Enterprise Linux >= 5, Fedora >= 13, Alpine Linux >= 3.7,
++// FreeBSD >= 11, DragonFly BSD >= 6, NetBSD >= 7, OpenBSD >= 6)
++// use a read-only eh_frame section.
++#if 1
++// all modern systems
+ #define EH_FRAME_SECTION .eh_frame,"a",@progbits
+ #else
+-// Linux/ELF
++// only very old systems
+ #define EH_FRAME_SECTION .eh_frame,"aw",@progbits
+ #endif
+ #endif
+-- 
+2.45.2
+

Reply via email to