diff mbox series

popt: Do not export _init and _fini

Message ID 20261124062436.4104471-1-khem.raj@oss.qualcomm.com
State Under Review
Headers show
Series popt: Do not export _init and _fini | expand

Commit Message

Khem Raj Nov. 24, 2026, 6:24 a.m. UTC
The version script names _init and _fini, which riscv64 glibc does not
define, so linking with lld fails:

  ld.lld: error: version script assignment of 'LIBPOPT_0' to symbol '_fini' failed: symbol not defined

Drop them from the version script; the loader uses DT_INIT/DT_FINI and
nothing looks them up by name.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...t.vers-Do-not-export-_init-and-_fini.patch | 34 +++++++++++++++++++
 meta/recipes-support/popt/popt_1.19.bb        |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-support/popt/popt/0001-libpopt.vers-Do-not-export-_init-and-_fini.patch
diff mbox series

Patch

diff --git a/meta/recipes-support/popt/popt/0001-libpopt.vers-Do-not-export-_init-and-_fini.patch b/meta/recipes-support/popt/popt/0001-libpopt.vers-Do-not-export-_init-and-_fini.patch
new file mode 100644
index 0000000000..14a83d3e94
--- /dev/null
+++ b/meta/recipes-support/popt/popt/0001-libpopt.vers-Do-not-export-_init-and-_fini.patch
@@ -0,0 +1,34 @@ 
+From e7b50f35178d7ec011438c699234a5ee90173eaf Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 11 Nov 2026 11:41:05 -0800
+Subject: [PATCH] libpopt.vers: Do not export _init and _fini
+
+_init and _fini come from crti.o on some architectures and are not part of
+the popt API. The dynamic loader finds them through DT_INIT/DT_FINI, not by
+symbol lookup, so there is no reason to export them.
+
+On architectures without crti.o _init/_fini, e.g. riscv64, they are not
+defined at all, and lld, which defaults to --no-undefined-version, fails:
+
+  ld.lld: error: version script assignment of 'LIBPOPT_0' to symbol '_fini' failed: symbol not defined
+  ld.lld: error: version script assignment of 'LIBPOPT_0' to symbol '_init' failed: symbol not defined
+
+Upstream-Status: Backport [https://github.com/rpm-software-management/popt/commit/aec97bc20f46464b779a40d465f716cfe6099e92]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/libpopt.vers | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/libpopt.vers b/src/libpopt.vers
+index 3ac5e52..d199ac9 100644
+--- a/src/libpopt.vers
++++ b/src/libpopt.vers
+@@ -1,8 +1,6 @@
+ LIBPOPT_0
+ {
+   global:
+-    _fini;
+-    _init;
+     _poptArgMask;
+     _poptGroupMask;
+     poptAddAlias;
diff --git a/meta/recipes-support/popt/popt_1.19.bb b/meta/recipes-support/popt/popt_1.19.bb
index dadcfdfeac..6161d4a7c4 100644
--- a/meta/recipes-support/popt/popt_1.19.bb
+++ b/meta/recipes-support/popt/popt_1.19.bb
@@ -15,6 +15,7 @@  SRC_URI = "http://ftp.rpm.org/popt/releases/popt-1.x/${BP}.tar.gz \
            file://CVE-2026-18839-01.patch \
            file://CVE-2026-18839-02.patch \
            file://0001-Fix-test-output-format.patch \
+           file://0001-libpopt.vers-Do-not-export-_init-and-_fini.patch \
            "
 SRC_URI[sha256sum] = "c25a4838fc8e4c1c8aacb8bd620edb3084a3d63bf8987fdad3ca2758c63240f9"