commit:     c5750781de5450ed5a3c8e3a37fe6026911623c9
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Mon Feb 13 04:51:50 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 13 04:59:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5750781

dev-libs/libbsd: Backport Clang 16 configure fix

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/29566
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...x-version-script-linker-support-detection.patch | 36 ++++++++++++++++++++++
 dev-libs/libbsd/libbsd-0.11.7-r2.ebuild            | 13 +++++++-
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git 
a/dev-libs/libbsd/files/libbsd-build-Fix-version-script-linker-support-detection.patch
 
b/dev-libs/libbsd/files/libbsd-build-Fix-version-script-linker-support-detection.patch
new file mode 100644
index 000000000000..2e45429021ff
--- /dev/null
+++ 
b/dev-libs/libbsd/files/libbsd-build-Fix-version-script-linker-support-detection.patch
@@ -0,0 +1,36 @@
+From dec783dce5a7131e232a06e63a544645b5463dd8 Mon Sep 17 00:00:00 2001
+From: Guillem Jover <[email protected]>
+Date: Sun, 12 Feb 2023 23:55:09 +0100
+Subject: [PATCH] build: Fix version script linker support detection
+
+When the linker uses --no-undefined-version either specified by the user
+or as the default behavior (such as with newer clang >= 16 releases),
+a missing symbol definition will cause a linker error if that symbol is
+listed in the version script.
+
+Upstream commit: 
https://gitlab.freedesktop.org/libbsd/libbsd/-/commit/dec783dce5a7131e232a06e63a544645b5463dd8
+
+---
+ configure.ac | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 17d113c..7d17a93 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -33,7 +33,11 @@ AC_CACHE_CHECK([if ld supports --version-script flag],
+     save_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
+     AC_LINK_IFELSE([
+-      AC_LANG_PROGRAM([], [])
++      AC_LANG_PROGRAM([[
++extern int symbol(void);
++int symbol(void) { return 0; }
++]], [[
++]])
+     ], [
+       libbsd_cv_version_script=yes
+     ], [
+-- 
+2.39.1.615.ga0422de7ea.dirty
+

diff --git a/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild 
b/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
index 0fcfb6bd563b..c70b6bdb49f3 100644
--- a/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
+++ b/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/guillemjover.asc
-inherit multilib multilib-minimal verify-sig
+inherit autotools multilib multilib-minimal verify-sig
 
 DESCRIPTION="Library to provide useful functions commonly found on BSD systems"
 HOMEPAGE="https://libbsd.freedesktop.org/wiki/ 
https://gitlab.freedesktop.org/libbsd/libbsd";
@@ -22,6 +22,17 @@ DEPEND="${RDEPEND}
 "
 BDEPEND="verify-sig? ( sec-keys/openpgp-keys-guillemjover )"
 
+PATCHES=(
+       
"${FILESDIR}/libbsd-build-Fix-version-script-linker-support-detection.patch"
+)
+
+src_prepare() {
+       default
+
+       # Drop on next release, only needed for lld patch
+       eautoreconf
+}
+
 multilib_src_configure() {
        # The build system will install libbsd-ctor.a despite USE="-static-libs"
        # which is correct, see:

Reply via email to