From: Christopher Larson <kergoth@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Christopher Larson <chris_larson@mentor.com>
Subject: [PATCH 3/3] libcap-ng: fix built failure with some external toolchains due to missing pthread
Date: Tue, 26 Nov 2019 03:13:57 +0500 [thread overview]
Message-ID: <20191125221357.6560-3-kergoth@gmail.com> (raw)
In-Reply-To: <20191125221357.6560-1-kergoth@gmail.com>
From: Christopher Larson <chris_larson@mentor.com>
The libcap-ng build doesn't pass -pthread and can fail to link.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
meta/recipes-support/libcap-ng/libcap-ng.inc | 1 +
.../libcap-ng/revert-pthread_atfork-fix.patch | 56 ++++++++++++++++++++++
2 files changed, 57 insertions(+)
create mode 100644 meta/recipes-support/libcap-ng/libcap-ng/revert-pthread_atfork-fix.patch
diff --git a/meta/recipes-support/libcap-ng/libcap-ng.inc b/meta/recipes-support/libcap-ng/libcap-ng.inc
index aec83896e4..46d37e6807 100644
--- a/meta/recipes-support/libcap-ng/libcap-ng.inc
+++ b/meta/recipes-support/libcap-ng/libcap-ng.inc
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
SRC_URI = "http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-${PV}.tar.gz \
file://python.patch \
+ file://revert-pthread_atfork-fix.patch \
"
SRC_URI[md5sum] = "57dc267e2949cdecb651a929f9206572"
diff --git a/meta/recipes-support/libcap-ng/libcap-ng/revert-pthread_atfork-fix.patch b/meta/recipes-support/libcap-ng/libcap-ng/revert-pthread_atfork-fix.patch
new file mode 100644
index 0000000000..d3f7790b1e
--- /dev/null
+++ b/meta/recipes-support/libcap-ng/libcap-ng/revert-pthread_atfork-fix.patch
@@ -0,0 +1,56 @@
+From 81dc82393fae9851397fa5d94094434aa1d5c3d1 Mon Sep 17 00:00:00 2001
+From: Christopher Larson <chris_larson@mentor.com>
+Date: Thu, 14 Nov 2019 21:13:24 +0500
+Subject: [PATCH] Revert "Fix usage of pthread_atfork a whole different way"
+
+This reverts commit 08a09cba90f3d960c080a20833fb8c0908f1cea6.
+
+The fix was breaking builds with some toolchains.
+
+Signed-off-by: Christopher Larson <chris_larson@mentor.com>
+---
+ src/Makefile.am | 2 +-
+ src/cap-ng.c | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5a66d4e..d46d02b 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -34,5 +34,5 @@ noinst_HEADERS = captab.h
+ libcap_ng_la_SOURCES = cap-ng.c lookup_table.c
+ libcap_ng_la_LIBADD =
+ libcap_ng_la_DEPENDENCIES = $(libcap_ng_la_SOURCES) ../config.h
+-libcap_ng_la_LDFLAGS = -Wl,-z,relro
++libcap_ng_la_LDFLAGS = -Wl,-z,relro -Wl,-z,nodelete
+
+diff --git a/src/cap-ng.c b/src/cap-ng.c
+index 35fcd7a..ed31afa 100644
+--- a/src/cap-ng.c
++++ b/src/cap-ng.c
+@@ -155,6 +155,15 @@ static __thread struct cap_ng m = { 1,
+ CAPNG_NEW,
+ {0, 0} };
+
++
++/*
++ * The pthread_atfork function is being made weak so that we can use it
++ * if the program is linked with pthreads and not requiring it for
++ * everything that uses libcap-ng.
++ */
++extern int __attribute__((weak)) pthread_atfork(void (*prepare)(void),
++ void (*parent)(void), void (*child)(void));
++
+ /*
+ * Reset the state so that init gets called to erase everything
+ */
+@@ -166,7 +175,8 @@ static void deinit(void)
+ static void init_lib(void) __attribute__ ((constructor));
+ static void init_lib(void)
+ {
+- pthread_atfork(NULL, NULL, deinit);
++ if (pthread_atfork)
++ pthread_atfork(NULL, NULL, deinit);
+ }
+
+ static void init(void)
--
2.11.1
next prev parent reply other threads:[~2019-11-25 22:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-25 22:13 [PATCH 1/3] acpica: correct flex/bison deps, add explicit m4-native dep Christopher Larson
2019-11-25 22:13 ` [PATCH 2/3] dosfstools: fix CP437 error from `dosfsck -l` Christopher Larson
2019-11-25 22:28 ` Khem Raj
2019-11-25 22:38 ` Christopher Larson
2019-11-25 22:13 ` Christopher Larson [this message]
2019-11-25 22:27 ` [PATCH 3/3] libcap-ng: fix built failure with some external toolchains due to missing pthread Khem Raj
2019-11-25 22:40 ` Christopher Larson
2019-11-26 17:29 ` Christopher Larson
2019-11-25 22:32 ` ✗ patchtest: failure for "acpica: correct flex/bison dep..." and 2 more Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191125221357.6560-3-kergoth@gmail.com \
--to=kergoth@gmail.com \
--cc=chris_larson@mentor.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox