From patchwork Sun Sep 14 07:00:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 389012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 65A7914016A for ; Sun, 14 Sep 2014 17:01:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 83C603365B; Sun, 14 Sep 2014 07:01:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LBG-WivCCVZC; Sun, 14 Sep 2014 07:01:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id B9DE43365D; Sun, 14 Sep 2014 07:01:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 2CC881CE590 for ; Sun, 14 Sep 2014 07:01:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 26FFE92180 for ; Sun, 14 Sep 2014 07:01:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qIwJMua5oe15 for ; Sun, 14 Sep 2014 07:01:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lupi.sysmic.org (sysmic.org [62.210.89.17]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5525592174 for ; Sun, 14 Sep 2014 07:01:05 +0000 (UTC) Received: from lupi.online.net (sysmic.org [62.210.89.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jezz) by lupi.sysmic.org (Postfix) with ESMTPSA id 87F7440E3B; Sun, 14 Sep 2014 09:01:03 +0200 (CEST) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= To: buildroot@busybox.net Date: Sun, 14 Sep 2014 09:00:58 +0200 Message-Id: <1410678059-12446-1-git-send-email-jezz@sysmic.org> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Subject: [Buildroot] [PATCH 1/2] libffi: make thread support optional X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Thomas Petazzoni Fixes: http://autobuild.buildroot.org/results/7ee57d01917ea72d1811469e482513dda2ceb1ea/build-end.log Signed-off-by: Thomas Petazzoni Signed-off-by: Jérôme Pouiller --- This patch was alread sent here: http://lists.busybox.net/pipermail/buildroot/2012-November/061976.html It is a better solution than simply disable libffi (and all its dependencies). However, there is still an unanswered question: Why autobuilders did not detect this problem before? ...ffi-0003-Make-thread-support-conditionnal.patch | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 package/libffi/libffi-0003-Make-thread-support-conditionnal.patch diff --git a/package/libffi/libffi-0003-Make-thread-support-conditionnal.patch b/package/libffi/libffi-0003-Make-thread-support-conditionnal.patch new file mode 100644 index 0000000..90d98d6 --- /dev/null +++ b/package/libffi/libffi-0003-Make-thread-support-conditionnal.patch @@ -0,0 +1,73 @@ +From a7f6342120060564a829704cceb843e53e0b34a9 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 17 Nov 2012 18:44:16 +0100 +Subject: [PATCH 3/3] Make thread support conditionnal + +When libffi is linked against a C library that does not have thread +support, it is not necessary to use a mutex to protect global +variables, since the application calling libffi cannot be +multi-threaded. + +Therefore, make the libffi thread support conditionnal: when we're +building against uClibc with no thread support, don't use the +pthread_mutex. + +Signed-off-by: Thomas Petazzoni +--- + src/closures.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/closures.c b/src/closures.c +index 1b37827..3d151f6 100644 +--- a/src/closures.c ++++ b/src/closures.c +@@ -70,7 +70,10 @@ + + # elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ + ++#if defined(__UCLIBC__) && !defined(__HAS_NO_THREADS__) + #define USE_LOCKS 1 ++#endif ++ + #define USE_DL_PREFIX 1 + #ifdef __GNUC__ + #ifndef USE_BUILTIN_FFS +@@ -116,7 +119,10 @@ + #include + #endif /* HAVE_MNTENT */ + #include ++ ++#if defined(__UCLIBC__) && !defined(__HAS_NO_THREADS__) + #include ++#endif + + /* We don't want sys/mman.h to be included after we redefine mmap and + dlmunmap. */ +@@ -214,8 +220,10 @@ static int dlmunmap(void *, size_t); + + #if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) + ++#if defined(__UCLIBC__) && !defined(__HAS_NO_THREADS__) + /* A mutex used to synchronize access to *exec* variables in this file. */ + static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; ++#endif + + /* A file descriptor of a temporary file from which we'll map + executable pages. */ +@@ -473,9 +481,13 @@ dlmmap (void *start, size_t length, int prot, + + if (execsize == 0 || execfd == -1) + { ++#if defined(__UCLIBC__) && !defined(__HAS_NO_THREADS__) + pthread_mutex_lock (&open_temp_exec_file_mutex); ++#endif + ptr = dlmmap_locked (start, length, prot, flags, offset); ++#if defined(__UCLIBC__) && !defined(__HAS_NO_THREADS__) + pthread_mutex_unlock (&open_temp_exec_file_mutex); ++#endif + + return ptr; + } +-- +1.7.9.5 +