201 lines
6.9 KiB
Diff
201 lines
6.9 KiB
Diff
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
|
|
index 1dce82d..8b133b3 100644
|
|
--- a/libitm/Makefile.am
|
|
+++ b/libitm/Makefile.am
|
|
@@ -53,7 +53,6 @@ libitm_version_info = -version-info $(libtool_VERSION)
|
|
# Force link with C, not C++. For now, while we're using C++ we don't
|
|
# want or need libstdc++.
|
|
libitm_la_DEPENDENCIES = $(libitm_version_dep)
|
|
-libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
|
|
libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
|
|
|
|
libitm_la_SOURCES = \
|
|
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
|
|
index 138eeb1..f688e84 100644
|
|
--- a/libitm/Makefile.in
|
|
+++ b/libitm/Makefile.in
|
|
@@ -356,7 +356,6 @@ libitm_version_info = -version-info $(libtool_VERSION)
|
|
# Force link with C, not C++. For now, while we're using C++ we don't
|
|
# want or need libstdc++.
|
|
libitm_la_DEPENDENCIES = $(libitm_version_dep)
|
|
-libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
|
|
libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script)
|
|
libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \
|
|
barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \
|
|
@@ -473,7 +472,7 @@ clean-toolexeclibLTLIBRARIES:
|
|
rm -f "$${dir}/so_locations"; \
|
|
done
|
|
libitm.la: $(libitm_la_OBJECTS) $(libitm_la_DEPENDENCIES) $(EXTRA_libitm_la_DEPENDENCIES)
|
|
- $(libitm_la_LINK) -rpath $(toolexeclibdir) $(libitm_la_OBJECTS) $(libitm_la_LIBADD) $(LIBS)
|
|
+ $(CXXLINK) $(libitm_la_LDFLAGS) -rpath $(toolexeclibdir) $(libitm_la_OBJECTS) $(libitm_la_LIBADD) $(LIBS)
|
|
|
|
mostlyclean-compile:
|
|
-rm -f *.$(OBJEXT)
|
|
diff --git a/libitm/alloc_cpp.cc b/libitm/alloc_cpp.cc
|
|
index 1d52e89..9722a0b 100644
|
|
--- a/libitm/alloc_cpp.cc
|
|
+++ b/libitm/alloc_cpp.cc
|
|
@@ -50,24 +50,30 @@ using namespace GTM;
|
|
/* Everything from libstdc++ is weak, to avoid requiring that library
|
|
to be linked into plain C applications using libitm.so. */
|
|
|
|
+#if defined(__CYGWIN__) && defined(PIC)
|
|
+#define WEAK
|
|
+#else
|
|
+#define WEAK __attribute__((weak))
|
|
+#endif
|
|
+
|
|
extern "C" {
|
|
|
|
-extern void *_ZnwX (size_t) __attribute__((weak));
|
|
-extern void _ZdlPv (void *) __attribute__((weak));
|
|
-extern void _ZdlPvX (void *, size_t) __attribute__((weak));
|
|
-extern void *_ZnaX (size_t) __attribute__((weak));
|
|
-extern void _ZdaPv (void *) __attribute__((weak));
|
|
+extern void *_ZnwX (size_t) WEAK;
|
|
+extern void _ZdlPv (void *) WEAK;
|
|
+extern void _ZdlPvX (void *, size_t) WEAK;
|
|
+extern void *_ZnaX (size_t) WEAK;
|
|
+extern void _ZdaPv (void *) WEAK;
|
|
|
|
typedef const struct nothrow_t { } *c_nothrow_p;
|
|
|
|
-extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak));
|
|
-extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
|
|
+extern void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
|
|
+extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
|
|
extern void _ZdlPvXRKSt9nothrow_t
|
|
-(void *, size_t, c_nothrow_p) __attribute__((weak));
|
|
-extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak));
|
|
-extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
|
|
+(void *, size_t, c_nothrow_p) WEAK;
|
|
+extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) WEAK;
|
|
+extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) WEAK;
|
|
|
|
-#if !defined (HAVE_ELF_STYLE_WEAKREF)
|
|
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined(PIC)
|
|
void *_ZnwX (size_t) { return NULL; }
|
|
void _ZdlPv (void *) { return; }
|
|
void _ZdlPvX (void *, size_t) { return; }
|
|
diff --git a/libitm/beginend.cc b/libitm/beginend.cc
|
|
index 20b5547..3e19441 100644
|
|
--- a/libitm/beginend.cc
|
|
+++ b/libitm/beginend.cc
|
|
@@ -25,6 +25,24 @@
|
|
#include "libitm_i.h"
|
|
#include <pthread.h>
|
|
|
|
+#if defined(__CYGWIN__) && defined(PIC)
|
|
+#define WEAK
|
|
+#else
|
|
+#define WEAK __attribute__((weak))
|
|
+#endif
|
|
+
|
|
+/* Everything from libgcc_s is weak, to avoid requiring that library
|
|
+ to be linked into plain C applications using libitm.so. */
|
|
+
|
|
+extern "C" {
|
|
+
|
|
+extern void _Unwind_DeleteException (_Unwind_Exception*) WEAK;
|
|
+
|
|
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined(PIC)
|
|
+void _Unwind_DeleteException (_Unwind_Exception *) { return; }
|
|
+#endif /* HAVE_ELF_STYLE_WEAKREF */
|
|
+
|
|
+}
|
|
|
|
using namespace GTM;
|
|
|
|
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
|
|
index e84382f..8dbe036 100644
|
|
--- a/libitm/configure.tgt
|
|
+++ b/libitm/configure.tgt
|
|
@@ -141,7 +141,7 @@ case "${target}" in
|
|
*-*-gnu* | *-*-k*bsd*-gnu \
|
|
| *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \
|
|
| *-*-solaris2* | *-*-sysv4* | *-*-hpux11* \
|
|
- | *-*-darwin* | *-*-aix* | *-*-dragonfly*)
|
|
+ | *-*-darwin* | *-*-aix* | *-*-dragonfly* | *-*-cygwin*)
|
|
# POSIX system. The OS is supported.
|
|
;;
|
|
|
|
diff --git a/libitm/eh_cpp.cc b/libitm/eh_cpp.cc
|
|
index a6c06b5..a4ba223 100644
|
|
--- a/libitm/eh_cpp.cc
|
|
+++ b/libitm/eh_cpp.cc
|
|
@@ -77,7 +77,11 @@ using namespace GTM;
|
|
/* Everything from libstdc++ is weak, to avoid requiring that library
|
|
to be linked into plain C applications using libitm.so. */
|
|
|
|
+#if defined(__CYGWIN__) && defined(PIC)
|
|
+#define WEAK
|
|
+#else
|
|
#define WEAK __attribute__((weak))
|
|
+#endif
|
|
|
|
extern "C" {
|
|
|
|
@@ -95,14 +99,13 @@ extern void __cxa_end_catch (void) WEAK;
|
|
extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
|
|
extern __cxa_eh_globals *__cxa_get_globals (void) WEAK;
|
|
|
|
-#if !defined (HAVE_ELF_STYLE_WEAKREF)
|
|
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && !defined(PIC)
|
|
void *__cxa_allocate_exception (size_t) { return NULL; }
|
|
void __cxa_free_exception (void *) { return; }
|
|
void __cxa_throw (void *, void *, void *) { return; }
|
|
void *__cxa_begin_catch (void *) { return NULL; }
|
|
void __cxa_end_catch (void) { return; }
|
|
void __cxa_tm_cleanup (void *, void *, unsigned int) { return; }
|
|
-void _Unwind_DeleteException (_Unwind_Exception *) { return; }
|
|
__cxa_eh_globals *__cxa_get_globals (void) { return NULL; }
|
|
#endif /* HAVE_ELF_STYLE_WEAKREF */
|
|
|
|
@@ -176,9 +179,10 @@ _ITM_cxa_end_catch (void)
|
|
void
|
|
GTM::gtm_thread::init_cpp_exceptions ()
|
|
{
|
|
+ __cxa_eh_globals *(*__cxa_get_globals_ptr)() = &__cxa_get_globals;
|
|
// Only save and restore the number of uncaught exceptions if this is
|
|
// actually used in the program.
|
|
- if (__cxa_get_globals != NULL && __cxa_get_globals () != 0)
|
|
+ if (__cxa_get_globals_ptr != NULL && __cxa_get_globals () != 0)
|
|
cxa_uncaught_count_ptr = &__cxa_get_globals ()->uncaughtExceptions;
|
|
else
|
|
cxa_uncaught_count_ptr = 0;
|
|
diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
|
|
index a8cff57..52d2069 100644
|
|
--- a/libitm/libitm_i.h
|
|
+++ b/libitm/libitm_i.h
|
|
@@ -37,11 +37,6 @@
|
|
#include <string.h>
|
|
#include <unwind.h>
|
|
#include "local_atomic"
|
|
-
|
|
-/* Don't require libgcc_s.so for exceptions. */
|
|
-extern void _Unwind_DeleteException (_Unwind_Exception*) __attribute__((weak));
|
|
-
|
|
-
|
|
#include "common.h"
|
|
|
|
namespace GTM HIDDEN {
|
|
diff --git a/libitm/method-serial.cc b/libitm/method-serial.cc
|
|
index a151b66..3f47f58 100644
|
|
--- a/libitm/method-serial.cc
|
|
+++ b/libitm/method-serial.cc
|
|
@@ -24,12 +24,14 @@
|
|
|
|
#include "libitm_i.h"
|
|
|
|
+#if 0 // !defined(__CYGWIN__) || !defined(PIC)
|
|
// Avoid a dependency on libstdc++ for the pure virtuals in abi_dispatch.
|
|
extern "C" void HIDDEN
|
|
__cxa_pure_virtual ()
|
|
{
|
|
abort ();
|
|
}
|
|
+#endif
|
|
|
|
using namespace GTM;
|
|
|