
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 link with -lpthread. The thrown exception is not caught as expected and the program aborts. Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr> --- libpthread/nptl/sysdeps/pthread/Makefile.in | 4 ++-- libpthread/nptl/sysdeps/pthread/pthread-unwind-forcedunwind.c | 1 + 2 files changed, 3 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 9d99f31..6325c0d 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -40,7 +40,7 @@ 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-OMIT-rt-unwind-resume.c = -DIS_IN_libpthread @@ -49,7 +49,7 @@ CFLAGS-librt-cancellation.c = -DIS_IN_librt \ CFLAGS-rt-unwind-resume.c = -DIS_IN_librt \ -fexceptions -fasynchronous-unwind-tables -libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, unwind-forcedunwind) +libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, pthread-unwind-forcedunwind) librt-pt-routines-y = librt-cancellation.c librt-pt-shared-only-routines-y = rt-unwind-resume.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