diff options
-rw-r--r-- | meta/recipes-support/libunwind/libunwind/libatomic.patch | 38 | ||||
-rw-r--r-- | meta/recipes-support/libunwind/libunwind_1.8.1.bb | 2 |
2 files changed, 39 insertions, 1 deletions
diff --git a/meta/recipes-support/libunwind/libunwind/libatomic.patch b/meta/recipes-support/libunwind/libunwind/libatomic.patch new file mode 100644 index 0000000000..f39e92f2ee --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind/libatomic.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From d6a0d8ce07c761e51b9dc7c5d16a9b06c3e93560 Mon Sep 17 00:00:00 2001 | ||
2 | From: Stephen Webb <swebb@blackberry.com> | ||
3 | Date: Mon, 18 Mar 2024 10:22:26 -0400 | ||
4 | Subject: [PATCH] configure.ac: detect if -latomic is required | ||
5 | |||
6 | Some OS runtimes require libatomic be linked in separately to get | ||
7 | standard atomic operations to work. Try to detect that at configure | ||
8 | time. | ||
9 | |||
10 | Upstream-Status: Submitted [https://github.com/libunwind/libunwind/pull/732/] | ||
11 | Signed-off-by: Ross Burton <ross.burton@arm.com> | ||
12 | --- | ||
13 | configure.ac | 12 ++++++++++++ | ||
14 | 1 file changed, 12 insertions(+) | ||
15 | |||
16 | diff --git a/configure.ac b/configure.ac | ||
17 | index 758a27d19..d0ef5f3d9 100644 | ||
18 | --- a/configure.ac | ||
19 | +++ b/configure.ac | ||
20 | @@ -94,6 +94,18 @@ dnl Checks for library functions. | ||
21 | AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \ | ||
22 | ttrace mincore pipe2 sigaltstack execvpe) | ||
23 | |||
24 | +AC_MSG_CHECKING([if -latomic is required]) | ||
25 | + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | ||
26 | + #include <stdatomic.h> | ||
27 | + atomic_bool ab_ = 0; atomic_llong al_ = 0; | ||
28 | + ]],[[ | ||
29 | + atomic_load(&ab_); atomic_load(&al_); | ||
30 | + ]])], | ||
31 | + [use_libatomic=no], | ||
32 | + [use_libatomic=yes]) | ||
33 | +AC_MSG_RESULT([$use_libatomic]) | ||
34 | +AS_IF([test "$use_libatomic" = "yes"],[LIBS="-latomic $LIBS"]) | ||
35 | + | ||
36 | AC_MSG_CHECKING([if building with AltiVec]) | ||
37 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | ||
38 | #ifndef __ALTIVEC__ | ||
diff --git a/meta/recipes-support/libunwind/libunwind_1.8.1.bb b/meta/recipes-support/libunwind/libunwind_1.8.1.bb index ee4a8401ba..b2c592b435 100644 --- a/meta/recipes-support/libunwind/libunwind_1.8.1.bb +++ b/meta/recipes-support/libunwind/libunwind_1.8.1.bb | |||
@@ -13,6 +13,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ | |||
13 | file://0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch \ | 13 | file://0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch \ |
14 | file://0004-Rework-inline-aarch64-as-for-setcontext.patch \ | 14 | file://0004-Rework-inline-aarch64-as-for-setcontext.patch \ |
15 | file://0005-Handle-musl-on-PPC32.patch \ | 15 | file://0005-Handle-musl-on-PPC32.patch \ |
16 | file://libatomic.patch \ | ||
16 | " | 17 | " |
17 | 18 | ||
18 | SRC_URI[sha256sum] = "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157" | 19 | SRC_URI[sha256sum] = "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157" |
@@ -33,7 +34,6 @@ ARM_INSTRUCTION_SET:armv4 = "arm" | |||
33 | ARM_INSTRUCTION_SET:armv5 = "arm" | 34 | ARM_INSTRUCTION_SET:armv5 = "arm" |
34 | 35 | ||
35 | LDFLAGS += "-Wl,-z,relro,-z,now" | 36 | LDFLAGS += "-Wl,-z,relro,-z,now" |
36 | LDFLAGS:append:powerpc:libc-musl = " -latomic" | ||
37 | 37 | ||
38 | SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared" | 38 | SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared" |
39 | CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'" | 39 | CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'" |