Using unwind-forcedunwind.c from nptl/sysdeps/pthread doesn't work well on ARM, see nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c for an explanation.
The following code example shows what's wrong without the ARM-specific version. -------------------------------------------------------------------- struct Foo { ~Foo(); }; Foo::~Foo() {} void f() { Foo a; throw 0; } int main() { try { f(); } catch (int) { std::cerr << "caught" << std::endl; } return 0; } -------------------------------------------------------------------- Compile without any optimizations (it's important that Foo's destructor is not inlined) and run with uClibc preloaded using LD_PRELOAD to ensure uClibc's implementation of Unwind_Resume overrides the one from libgcc_s. The thrown exception is not caught as expected and the program aborts. Signed-off-by: Ignacy Gawędzki <ignacy.gawed...@green-communications.fr> --- libpthread/nptl/sysdeps/pthread/Makefile.in | 7 +++++-- libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index a501b64..1496252 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -40,12 +40,15 @@ CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE -CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-pthread-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread CFLAGS-librt-cancellation.c = -DIS_IN_librt \ -fexceptions -fasynchronous-unwind-tables -libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, unwind-forcedunwind) +CFLAGS-rt-unwind-resume.c = -DIS_IN_librt \ + -fexceptions -fasynchronous-unwind-tables + +libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, pthread-unwind-forcedunwind) librt-pt-routines-y = librt-cancellation.c diff --git a/libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c b/libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c new file mode 100644 index 0000000..fc04eb4 --- /dev/null +++ b/libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c @@ -0,0 +1 @@ +#include <unwind-forcedunwind.c> -- 2.7.4 _______________________________________________ devel mailing list devel@uclibc-ng.org http://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel