mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-28 13:34:59 +08:00
7544a87f13
* gcc.c (MFWRAP_SPEC): Don't wrap pthread_join or pthread_exit. * acinclude.m4: New file. * configure.ac: Invoke LIBMUDFLAP_CHECK_TLS. * configure, config.h.in, Makefile.in, testsuite/Makefile.in: Rebuild. * mf-hooks1.c (__mf_0fn_malloc): Move body from ... (__mf_0fn_calloc): ... here. * mf-hooks3.c (struct pthread_info): Remove. (__mf_pthread_info, __mf_pthread_info_idx): Remove. (LIBMUDFLAPTH_THREADS_MAX): Set to 1021. (struct mf_thread_data): New. (mf_thread_data, mf_thread_data_lock): New. (__mf_allocate_blank_threadinfo): Remove. (__mf_find_threadinfo): Rewrite and simplify. Only use if TLS is not available. (__mf_state_perthread): Remove. (__mf_get_state, __mf_set_state): New. (__mf_pthread_cleanup): Use &errno, rather than saved pointer. Update mf_thread_data killing procedure. (__mf_pthread_spawner): Similarly. (__mf_0fn_pthread_create): Only use wrapper if necessary. Remove code to allocate thread stack space. (__mf_0fn_pthread_join, pthread_join): Remove. (__mf_0fn_pthread_exit, pthread_exit): Remove. * mf-impl.h (dyn_pthread_join, dyn_pthread_exit): Remove. (__mf_state_1): Rename from __mf_state; use TLS when available. (__mf_get_state, __mf_set_state): New. Update all users. * mf-runtime.c (begin_recursion_protect1): New. (BEGIN_RECURSION_PROTECT): Use it. (__mf_state_1): Rename from __mf_state; use TLS when available. (threads_active_p): Remove. (__mf_usage): Compute it directly. From-SVN: r102108
73 lines
2.5 KiB
Plaintext
73 lines
2.5 KiB
Plaintext
dnl Check whether the target supports TLS.
|
|
AC_DEFUN([LIBMUDFLAP_CHECK_TLS], [
|
|
LIBMUDFLAP_ENABLE(tls, yes, [Use thread-local storage])
|
|
AC_CACHE_CHECK([whether the target supports thread-local storage],
|
|
have_tls, [
|
|
AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
|
|
[dnl If the test case passed with dynamic linking, try again with
|
|
dnl static linking. This fails at least with some older Red Hat
|
|
dnl releases.
|
|
save_LDFLAGS="$LDFLAGS"
|
|
LDFLAGS="-static $LDFLAGS"
|
|
AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
|
|
[have_tls=yes], [have_tls=no], [])
|
|
LDFLAGS="$save_LDFLAGS"],
|
|
[have_tls=no],
|
|
[AC_COMPILE_IFELSE([__thread int foo;], [have_tls=yes], [have_tls=no])]
|
|
)])
|
|
if test "$enable_tls $have_tls" = "yes yes"; then
|
|
AC_DEFINE(HAVE_TLS, 1,
|
|
[Define to 1 if the target supports thread-local storage.])
|
|
fi])
|
|
|
|
dnl ----------------------------------------------------------------------
|
|
dnl This whole bit snagged from libgfortran.
|
|
|
|
sinclude(../libtool.m4)
|
|
dnl The lines below arrange for aclocal not to bring an installed
|
|
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
|
|
dnl add a definition of LIBTOOL to Makefile.in.
|
|
ifelse(,,,[AC_SUBST(LIBTOOL)
|
|
AC_DEFUN([AM_PROG_LIBTOOL])
|
|
AC_DEFUN([AC_LIBTOOL_DLOPEN])
|
|
AC_DEFUN([AC_PROG_LD])
|
|
])
|
|
|
|
dnl ----------------------------------------------------------------------
|
|
dnl This whole bit snagged from libstdc++-v3.
|
|
|
|
dnl
|
|
dnl LIBMUDFLAP_ENABLE
|
|
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
|
|
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
|
|
dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
|
|
dnl
|
|
dnl See docs/html/17_intro/configury.html#enable for documentation.
|
|
dnl
|
|
m4_define([LIBMUDFLAP_ENABLE],[dnl
|
|
m4_define([_g_switch],[--enable-$1])dnl
|
|
m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
|
|
AC_ARG_ENABLE($1,_g_help,
|
|
m4_bmatch([$5],
|
|
[^permit ],
|
|
[[
|
|
case "$enableval" in
|
|
m4_bpatsubst([$5],[permit ])) ;;
|
|
*) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
|
|
dnl Idea for future: generate a URL pointing to
|
|
dnl "onlinedocs/configopts.html#whatever"
|
|
esac
|
|
]],
|
|
[^$],
|
|
[[
|
|
case "$enableval" in
|
|
yes|no) ;;
|
|
*) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
|
|
esac
|
|
]],
|
|
[[$5]]),
|
|
[enable_]m4_bpatsubst([$1],-,_)[=][$2])
|
|
m4_undefine([_g_switch])dnl
|
|
m4_undefine([_g_help])dnl
|
|
])
|