Skip to contentSkip to conversation

libunwind: Link with libucontext on musl

PATCH New Khem Raj 1 participant 1 message Mar 12, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 libunwind: Link with libucontext on musl

Functions like unw_getcontext in libunwind call getcontext() which are not part of musl C library like glibc, however there is a supplimental library providing these functions called libucontext, therefore link libunwind with a static version of this library to resolve such symbols, this inturn helps packages needing libunwind, who look for certain APIs in libunwind during configure e.g. heaptrack

---
 meta/recipes-support/libunwind/libunwind.inc      | 1 +
 meta/recipes-support/libunwind/libunwind_1.5.0.bb | 1 +
 2 files changed, 2 insertions(+)
meta/recipes-support/libunwind/libunwind.inc +1 -0
index 76a1bf6246..17ba151933 100644
@@ -4,6 +4,7 @@ HOMEPAGE = "http://www.nongnu.org/libunwind"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2d80c8ed4062b8339b715f90fa68cc9f"
 DEPENDS += "libatomic-ops"
+DEPENDS_append_libc-musl = " libucontext"
 
 inherit autotools multilib_header
 
meta/recipes-support/libunwind/libunwind_1.5.0.bb +1 -0
index 887a35708e..6392cac5c9 100644
@@ -25,3 +25,4 @@ COMPATIBLE_HOST_riscv32 = "null"
 LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
 
 SECURITY_LDFLAGS_append_libc-musl = " -lssp_nonshared"
+CACHED_CONFIGUREVARS_append_libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'"
Signature · 1 line
2.30.2