dante: Do not export rresvport where it does not exist

Extend the version script patch to also leave out rresvport() when
configure does not find it, as on musl, where lld fails with:

  error: version script assignment of 'global' to symbol 'rresvport' failed: symbol not defined

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-11-11 22:46:11 -08:00
1 parent 2364d4d682
commit 172da96127
3 files changed
+45 -40

No files matched your search

@@ -1,39 +0,0 @@
From d873c1b2ddf6818e3f814ab7f9c1ae34fe3da847 Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Mon, 9 Nov 2026 08:37:30 -0800
Subject: [PATCH] Only export getipnodebyname and freehostent where they exist
dlib only interposes getipnodebyname() and freehostent() when the
platform has getipnodebyname() (Solaris), but they are always listed in
the exported symbols, so with glibc linkers that check the version
script, like lld, fail with:
error: version script assignment of 'global' to symbol 'freehostent' failed: symbol not defined
Leave them out of the symbol list when getipnodebyname() is not found.
Upstream-Status: Pending
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
mapfile.m4 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mapfile.m4 b/mapfile.m4
index 644a94b..5daa801 100644
--- a/mapfile.m4
+++ b/mapfile.m4
@@ -13,7 +13,13 @@ if test x"$sol64" = xt; then
PLDDIRS="$PLDDIRS dlib64/"
fi
for symdir in $PLDDIRS; do
- cat include/symbols_preload.txt >> $symdir/$MAPFILE
+ #getipnodebyname() and freehostent() are only interposed where they exist
+ if test x"$ac_cv_func_getipnodebyname" = xyes; then
+ cat include/symbols_preload.txt >> $symdir/$MAPFILE
+ else
+ grep -v -e '^freehostent$' -e '^getipnodebyname$' \
+ include/symbols_preload.txt >> $symdir/$MAPFILE
+ fi
#platform dependent symbols
case $host in
@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Mon, 9 Nov 2026 08:37:30 -0800
Subject: [PATCH] Only export interposed functions that exist on the platform
dlib only interposes getipnodebyname() and freehostent() when the
platform has getipnodebyname() (Solaris), and rresvport() when it is
available (not on Android or musl), but they are always listed in the
exported symbols, so linkers that check the version script, like lld,
fail with:
error: version script assignment of 'global' to symbol 'freehostent' failed: symbol not defined
error: version script assignment of 'global' to symbol 'rresvport' failed: symbol not defined
Leave them out of the symbol list when configure did not find them.
Upstream-Status: Pending
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
mapfile.m4 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mapfile.m4 b/mapfile.m4
index 644a94b..dc964f8 100644
--- a/mapfile.m4
+++ b/mapfile.m4
@@ -12,8 +12,16 @@ PLDDIRS="dlib/" #preloading (standard, non-Rfoo functions)
if test x"$sol64" = xt; then
PLDDIRS="$PLDDIRS dlib64/"
fi
+#only export interposed functions that exist on this platform
+PLDEXCLUDE="-e ^$" #skip blank lines
+if test x"$ac_cv_func_getipnodebyname" != xyes; then
+ PLDEXCLUDE="$PLDEXCLUDE -e ^freehostent$ -e ^getipnodebyname$"
+fi
+if test x"$ac_cv_func_rresvport" != xyes; then
+ PLDEXCLUDE="$PLDEXCLUDE -e ^rresvport$"
+fi
for symdir in $PLDDIRS; do
- cat include/symbols_preload.txt >> $symdir/$MAPFILE
+ grep -v $PLDEXCLUDE include/symbols_preload.txt >> $symdir/$MAPFILE
#platform dependent symbols
case $host in
@@ -12,7 +12,7 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b3a8e7dc09bb720460f28c9d3796afa5"
SRC_URI = "https://www.inet.no/dante/files/dante-${PV}.tar.gz \
file://0001-Only-export-getipnodebyname-and-freehostent-where-th.patch \
file://0001-Only-export-interposed-functions-that-exist-on-the-p.patch \
"
SRC_URI[sha256sum] = "1973c7732f1f9f0a4c0ccf2c1ce462c7c25060b25643ea90f9b98f53a813faec"