This is a slightly odd series of 2 patches. The two patches are
actually alternative solutions to the same problem. I'm keen to see
one of these merged, but I don't know which method would be preferred.
This commit aims to address an issue that was introduced / mentioned
in commit 20554a78a9bba278c6b9cbbb4cfc5bde3772c56d (ARC:
Conditionalise certain relocations as provided by TLS tools only).
The problem is that not all historic versions of binutils have
supported the @pcl relocation type. This problem is compounded by the
fact that the arithmetic construct that was previously used to
synthesise an @pcl like behaviour, does not work on recent versions of
binutils.
In the commit 20554a78a code was added that selects between the new
style @pcl relocations, and the old style arithmetic construct,
however, this selection is done based on whether the uClibc user has
configured with native threads or not.
Of course, a uClibc user could choose to use a modern version of
binutils AND configure without native thread support, in which case
uClibc will not compile.
I have two proposed solutions. In patch 1/2 I simply drop support for
the older versions of binutils in favour of the new @pcl relocation
type. This feels the cleanest solution, but I don't know how strongly
the uClibc(-ng) community feels about maintaining compatibility for
older versions of the tools.
Given that I anticipated push back against the first patch I took a
look at how I might maintain compatibility. It turns out to be pretty
easy, and that is patch 2/2. In this patch I drew inspiration from
similar examples in the Rules.mak file to check if the toolchain
supports @pcl relocations or not. With this done we have a new define
based on the specific toolchain feature being supported or not, which
can then be used to conditionalise the code.
Would you consider merging one of these patches?
Thanks,
Andrew
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via ff58e44fc38474b1898c59caf9a5e75d0d8c6c57 (commit)
from 084e597e9f8e630e9b3fc7044d544699ad5d2886 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ff58e44fc38474b1898c59caf9a5e75d0d8c6c57
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Sun Jul 17 02:23:24 2016 +0200
mips: add regdef.h glibc compatibility header
-----------------------------------------------------------------------
Summary of changes:
libc/sysdeps/linux/mips/Makefile.arch | 3 +--
{libpthread/nptl/sysdeps => libc/sysdeps/linux}/mips/regdef.h | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
copy {libpthread/nptl/sysdeps => libc/sysdeps/linux}/mips/regdef.h (86%)
diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
index 2c2e66f..844bc2b 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -20,5 +20,4 @@ SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S \
ASFLAGS-syscall_error.S += -D_LIBC_REENTRANT
-ARCH_HEADERS := sgidefs.h
-# regdef.h
+ARCH_HEADERS := sgidefs.h regdef.h
diff --git a/libpthread/nptl/sysdeps/mips/regdef.h b/libc/sysdeps/linux/mips/regdef.h
similarity index 86%
copy from libpthread/nptl/sysdeps/mips/regdef.h
copy to libc/sysdeps/linux/mips/regdef.h
index e4ebd9a..64cffbf 100644
--- a/libpthread/nptl/sysdeps/mips/regdef.h
+++ b/libc/sysdeps/linux/mips/regdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf(a)gnu.org>.
@@ -13,7 +13,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
+ License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _REGDEF_H
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
When building using BuildRoot, I get the below errors.
I have not dived into determine what the problem is yet,
but was asking first in case anyone else has experienced
this problem.
Thanks,
Andy
MKDIR lib
CC libm/acosf.os
CC libm/acoshf.os
In file included from ./libpthread/nptl/../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:2:
./include/sys/procfs.h:55:34: error: conflicting types for 'elf_vrreg_t'
} __attribute__ ((aligned (16))) elf_vrreg_t;
^
In file included from ./libpthread/nptl/../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:1:
./include/sys/procfs.h:55:34: error: conflicting types for 'elf_vrreg_t'
} __attribute__ ((aligned (16))) elf_vrreg_t;
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/../nptl_db/thread_db.h:28,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:153:21: note: previous declaration of 'elf_vrreg_t' was here
typedef __vector128 elf_vrreg_t;
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/../nptl_db/thread_db.h:28,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:1:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:153:21: note: previous declaration of 'elf_vrreg_t' was here
typedef __vector128 elf_vrreg_t;
^
In file included from ./libpthread/nptl/../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:2:
./include/sys/procfs.h:56:21: error: conflicting types for 'elf_vrregset_t'
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from ./libpthread/nptl/../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:1:
./include/sys/procfs.h:56:21: error: conflicting types for 'elf_vrregset_t'
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/../nptl_db/thread_db.h:28,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:154:21: note: previous declaration of 'elf_vrregset_t' was here
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/../nptl_db/thread_db.h:28,
from ./libpthread/nptl/descr.h:31,
from ./libpthread/nptl/pthreadP.h:26,
from <stdin>:1:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:154:21: note: previous declaration of 'elf_vrregset_t' was here
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from ./include/bits/libc-lock.h:36,
from ./include/bits/stdio-lock.h:22,
from ./include/bits/uClibc_mutex.h:73,
from ./include/bits/uClibc_stdio.h:83,
from ./include/stdio.h:71,
from <stdin>:2:
./include/sys/procfs.h:55:34: error: conflicting types for 'elf_vrreg_t'
} __attribute__ ((aligned (16))) elf_vrreg_t;
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from ./include/bits/libc-lock.h:36,
from ./include/bits/stdio-lock.h:22,
from ./include/bits/uClibc_mutex.h:73,
from ./include/bits/uClibc_stdio.h:83,
from ./include/stdio.h:71,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:153:21: note: previous declaration of 'elf_vrreg_t' was here
typedef __vector128 elf_vrreg_t;
^
In file included from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from ./include/bits/libc-lock.h:36,
from ./include/bits/stdio-lock.h:22,
from ./include/bits/uClibc_mutex.h:73,
from ./include/bits/uClibc_stdio.h:83,
from ./include/stdio.h:71,
from <stdin>:2:
./include/sys/procfs.h:56:21: error: conflicting types for 'elf_vrregset_t'
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from ./include/bits/libc-lock.h:36,
from ./include/bits/stdio-lock.h:22,
from ./include/bits/uClibc_mutex.h:73,
from ./include/bits/uClibc_stdio.h:83,
from ./include/stdio.h:71,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:154:21: note: previous declaration of 'elf_vrregset_t' was here
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
CC libm/asinf.os
CC libm/asinhf.os
CC libm/atan2f.os
make[1]: *** [libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.h] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libpthread/nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.h] Error 1
make[1]: *** [libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.h] Error 1
In file included from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from <stdin>:2:
./include/sys/procfs.h:55:34: error: conflicting types for 'elf_vrreg_t'
} __attribute__ ((aligned (16))) elf_vrreg_t;
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:153:21: note: previous declaration of 'elf_vrreg_t' was here
typedef __vector128 elf_vrreg_t;
^
In file included from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28:0,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from <stdin>:2:
./include/sys/procfs.h:56:21: error: conflicting types for 'elf_vrregset_t'
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
In file included from /home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/sigcontext.h:13:0,
from ./include/bits/sigcontext.h:30,
from ./include/signal.h:420,
from ./include/sys/procfs.h:26,
from ./libpthread/nptl/sysdeps/powerpc/../../../nptl_db/thread_db.h:28,
from ./libpthread/nptl/sysdeps/powerpc/../../descr.h:31,
from ./libpthread/nptl/sysdeps/powerpc/tls.h:70,
from ./include/tls.h:6,
from <stdin>:2:
/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/linux-headers-3.12.55/usr/include/asm/elf.h:154:21: note: previous declaration of 'elf_vrregset_t' was here
typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
^
make[1]: *** [libpthread/nptl/sysdeps/powerpc/tcb-offsets.h] Error 1
make[1]: Leaving directory `/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/uclibc-1.0.12'
make: *** [/home/akennedy/base_layer/build/rfs/t1010/buildroot-2016.02/output/build/uclibc-1.0.12/.stamp_built] Error 2
Hi,
I'm hitting an issue with the assembler implementation of
pthread_cond_wait() that is used on x86_64 with nptl.
If a thread is canceled while waiting in pthread_cond_wait(), the
condvar seems be left in an inconsistent state. A different thread
first calling pthread_cond_signal()t then gets blocked in
pthread_cond_destroy(). It seems that the function falsely assumes that
there are other waiters in the condvar.
The test program below reproduces the issue, blocking in
pthread_cond_destroy(). Switching to the C implementation on x86_64
fixes the problem here.
A trivial fix would just switch back to the C implementation, basically
revert e928e223fd. That commit, however, states that the generic
implementations are broken on x86_64. I couldn't reproduce that,
though.
Has anybody else seen pthread_cond_wait() issues on x86_64?
Kind regards
Martin
--
#include <pthread.h>
static pthread_mutex_t m;
static pthread_cond_t c;
static pthread_t t;
static volatile int ready;
static void cancelcb(void *arg)
{
pthread_mutex_unlock(&m);
}
static void* threadcb(void *arg)
{
pthread_mutex_lock(&m);
pthread_cleanup_push(cancelcb, NULL);
ready = 1;
while (1)
pthread_cond_wait(&c, &m);
pthread_cleanup_pop(1);
}
int main(int argc, const char *argv[])
{
pthread_mutex_init(&m, NULL);
pthread_cond_init(&c, NULL);
pthread_create(&t, NULL, threadcb, NULL);
while (!ready);
pthread_cancel(t);
pthread_join(t, NULL);
pthread_cond_signal(&c);
pthread_cond_destroy(&c);
pthread_mutex_destroy(&m);
return 0;
}