diff mbox series

[scarthgap,7/7] external-arm-toolchain: rebuild libmvec.so symlink if any

Message ID 20250106101238.982418-8-romain.naour@smile.fr
State New
Headers show
Series external-arm-toolchain: backport patches to fix usrmerge support | expand

Commit Message

Romain Naour Jan. 6, 2025, 10:12 a.m. UTC
On some architectures (namely Aarch64), glibc may provide a libmvec
library since glibc 2.22, which programs built with gcc OpenMP
support might get linked to.

In order for these programs to work on the target, we need to copy this
library to the target filesystem.

Make sure that libmvec.so symlink is correct with or without usermerge
enabled otherwise libmvec.so symlink is broken.

For more details on libmvec, see
https://sourceware.org/glibc/wiki/libmvec.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Acked-by: Denys Dmytriyenko <denys@konsulko.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
(cherry picked from commit de47f836e282ad07bdaa72086a96c59e847b880b)
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 .../external-arm-toolchain/external-arm-toolchain.bb       | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
index 4776b7f8..6a03308d 100644
--- a/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
+++ b/meta-arm-toolchain/recipes-devtools/external-arm-toolchain/external-arm-toolchain.bb
@@ -136,6 +136,9 @@  do_install() {
 		ln -sf ../../lib/libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
 		ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
 		ln -sf ../../lib/libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
+		if [ -f ${D}${base_libdir}/libmvec.so.1 ]; then
+			ln -sf ../../lib/libmvec.so.1 ${D}${libdir}/libmvec.so
+		fi
 
 		# remove potential .so duplicates from base_libdir
 		# for all symlinks created above in libdir
@@ -154,6 +157,7 @@  do_install() {
 		rm -f ${D}${base_libdir}/libnss_files.so
 		rm -f ${D}${base_libdir}/libnss_compat.so
 		rm -f ${D}${base_libdir}/libm.so
+		rm -f ${D}${base_libdir}/libmvec.so
 
 		# Move these completely to ${libdir} and delete duplicates in ${base_libdir}
 		for lib in asan hwasan atomic gfortran gomp itm lsan sanitizer stdc++ tsan ubsan; do
@@ -184,6 +188,9 @@  do_install() {
 		ln -sf libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
 		ln -sf libm.so.6 ${D}${libdir}/libm.so
 		ln -sf libc_malloc_debug.so.0 ${D}${libdir}/libc_malloc_debug.so
+		if [ -f ${D}${libdir}/libmvec.so.1 ]; then
+			ln -sf libmvec.so.1 ${D}${libdir}/libmvec.so
+		fi
 	fi
 
 	# Besides ld-${EAT_VER_LIBC}.so, other libs can have duplicates like lib*-${EAT_VER_LIBC}.so