apitrace: Do not export _init and _fini from wrappers

The wrapper version scripts name _init and _fini, which riscv64 glibc does
not define, so linking egltrace.so with lld fails:

  ld.lld: error: version script assignment of 'global' to symbol '_init' failed: symbol not defined

Drop them from the version scripts; 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>
This commit is contained in:
Khem Raj committed 2026-11-11 22:46:11 -08:00
1 parent 9b67c47ae2
commit 07092abe4c
2 files changed
+47

No files matched your search

@@ -0,0 +1,46 @@
From 4661c86d9a64bf4057bc80fc9e6a4aed83754b5e 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] wrappers: Do not export _init and _fini
_init and _fini come from crti.o on some architectures. The dynamic loader
finds them through DT_INIT/DT_FINI, not by symbol lookup, so there is no
reason to export them from the wrappers.
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 'global' to symbol '_init' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol '_fini' failed: symbol not defined
Upstream-Status: Submitted [https://github.com/apitrace/apitrace/pull/1004]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
wrappers/egltrace.version | 2 --
wrappers/glxtrace.version | 2 --
2 files changed, 4 deletions(-)
diff --git a/wrappers/egltrace.version b/wrappers/egltrace.version
index 0e7e62b..f4154be 100644
--- a/wrappers/egltrace.version
+++ b/wrappers/egltrace.version
@@ -1,7 +1,5 @@
{
global:
- _init;
- _fini;
egl[A-Z]*;
gl[A-Z]*;
dlopen;
diff --git a/wrappers/glxtrace.version b/wrappers/glxtrace.version
index 0546a05..68cd8d1 100644
--- a/wrappers/glxtrace.version
+++ b/wrappers/glxtrace.version
@@ -1,7 +1,5 @@
{
global:
- _init;
- _fini;
gl[A-Z]*;
dlopen;
_exit;
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=aeb969185a143c3c25130bc2c3ef9a50 \
SRCREV = "18cfd388ac47a9e00978b34d6c20341f3e2cdb56"
SRC_URI = "gitsm://github.com/${BPN}/${BPN}.git;branch=master;protocol=https;tag=${PV} \
file://0001-zstd-disable-the-x86-64-BMI2-assembly-fast-loops.patch \
file://0002-wrappers-Do-not-export-_init-and-_fini.patch \
"
DEPENDS += "zlib libpng python3-native"