forked from mirrors/gecko-dev
Bug 1880420 - Move __thread detection to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D201937
This commit is contained in:
parent
f41191e67a
commit
f3cfc8bfd7
5 changed files with 34 additions and 64 deletions
|
|
@ -2204,6 +2204,38 @@ set_config("WRAP_SYSTEM_INCLUDES", wrap_system_includes)
|
||||||
set_config("VISIBILITY_FLAGS", visibility_flags)
|
set_config("VISIBILITY_FLAGS", visibility_flags)
|
||||||
|
|
||||||
|
|
||||||
|
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
||||||
|
# We pass linker_optimize_flags to the linker because if dead_strip is
|
||||||
|
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
|
||||||
|
# linking XUL.
|
||||||
|
|
||||||
|
|
||||||
|
@depends(target, c_compiler)
|
||||||
|
def check_thread(target, c_compiler):
|
||||||
|
if target.cpu in ("mips32", "mips64"):
|
||||||
|
# mips builds fail with TLS variables because of a binutils bug.
|
||||||
|
# See bug 528687
|
||||||
|
return False
|
||||||
|
if target.os == "Android":
|
||||||
|
# The custom dynamic linker doesn't support TLS variables
|
||||||
|
return False
|
||||||
|
if target.kernel == "OpenBSD":
|
||||||
|
# OpenBSD doesn't have TLS support, and the test succeeds with clang++
|
||||||
|
return False
|
||||||
|
return c_compiler.type != "clang-cl"
|
||||||
|
|
||||||
|
|
||||||
|
set_define(
|
||||||
|
"HAVE_THREAD_TLS_KEYWORD",
|
||||||
|
try_link(
|
||||||
|
body="static __thread bool tlsIsMainThread = false; return tlsIsMainThread;",
|
||||||
|
flags=linker_optimize_flags.ldflags,
|
||||||
|
check_msg="for __thread keyword for TLS variables",
|
||||||
|
when=check_thread,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@template
|
@template
|
||||||
def depend_cflags(host_or_target_c_compiler):
|
def depend_cflags(host_or_target_c_compiler):
|
||||||
@depends(host_or_target_c_compiler)
|
@depends(host_or_target_c_compiler)
|
||||||
|
|
|
||||||
|
|
@ -697,35 +697,6 @@ if test "$GNU_CC"; then
|
||||||
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
|
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
|
||||||
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
|
|
||||||
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
|
|
||||||
# linking XUL.
|
|
||||||
_SAVE_LDFLAGS=$LDFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
|
|
||||||
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
|
||||||
ac_cv_thread_keyword,
|
|
||||||
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
|
||||||
[return tlsIsMainThread;],
|
|
||||||
ac_cv_thread_keyword=yes,
|
|
||||||
ac_cv_thread_keyword=no)])
|
|
||||||
LDFLAGS=$_SAVE_LDFLAGS
|
|
||||||
if test "$ac_cv_thread_keyword" = yes; then
|
|
||||||
# mips builds fail with TLS variables because of a binutils bug.
|
|
||||||
# See bug 528687
|
|
||||||
case "${target}" in
|
|
||||||
mips*-*)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*-android*|*-linuxandroid*)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl End of C++ language/feature checks
|
dnl End of C++ language/feature checks
|
||||||
AC_LANG_C
|
AC_LANG_C
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ inline void ThreadLocal<T, Storage>::set(const T aValue) {
|
||||||
# define MOZ_THREAD_LOCAL(TYPE) \
|
# define MOZ_THREAD_LOCAL(TYPE) \
|
||||||
thread_local ::mozilla::detail::ThreadLocal< \
|
thread_local ::mozilla::detail::ThreadLocal< \
|
||||||
TYPE, ::mozilla::detail::ThreadLocalNativeStorage>
|
TYPE, ::mozilla::detail::ThreadLocalNativeStorage>
|
||||||
#elif defined(HAVE_THREAD_TLS_KEYWORD)
|
#elif defined(HAVE_THREAD_TLS_KEYWORD) && !defined(MOZ_LINKER)
|
||||||
# define MOZ_THREAD_LOCAL(TYPE) \
|
# define MOZ_THREAD_LOCAL(TYPE) \
|
||||||
__thread ::mozilla::detail::ThreadLocal< \
|
__thread ::mozilla::detail::ThreadLocal< \
|
||||||
TYPE, ::mozilla::detail::ThreadLocalNativeStorage>
|
TYPE, ::mozilla::detail::ThreadLocalNativeStorage>
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,7 @@ include("build/moz.configure/flags.configure", when="--enable-compile-environmen
|
||||||
include("build/moz.configure/lto-pgo.configure", when="--enable-compile-environment")
|
include("build/moz.configure/lto-pgo.configure", when="--enable-compile-environment")
|
||||||
# rust.configure is included by js/moz.configure.
|
# rust.configure is included by js/moz.configure.
|
||||||
|
|
||||||
|
|
||||||
option("--enable-valgrind", help="Enable Valgrind integration hooks")
|
option("--enable-valgrind", help="Enable Valgrind integration hooks")
|
||||||
|
|
||||||
valgrind_h = check_header("valgrind/valgrind.h", when="--enable-valgrind")
|
valgrind_h = check_header("valgrind/valgrind.h", when="--enable-valgrind")
|
||||||
|
|
|
||||||
|
|
@ -724,40 +724,6 @@ if test "$GNU_CC"; then
|
||||||
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
|
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
|
||||||
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
|
|
||||||
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
|
|
||||||
# linking XUL.
|
|
||||||
_SAVE_LDFLAGS=$LDFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
|
|
||||||
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
|
||||||
ac_cv_thread_keyword,
|
|
||||||
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
|
||||||
[return tlsIsMainThread;],
|
|
||||||
ac_cv_thread_keyword=yes,
|
|
||||||
ac_cv_thread_keyword=no)])
|
|
||||||
LDFLAGS=$_SAVE_LDFLAGS
|
|
||||||
# The custom dynamic linker doesn't support TLS variables
|
|
||||||
if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
|
|
||||||
# mips builds fail with TLS variables because of a binutils bug.
|
|
||||||
# See bug 528687
|
|
||||||
# OpenBSD doesn't have TLS support, and the test succeeds with clang++
|
|
||||||
case "${target}" in
|
|
||||||
mips*-*)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*-android*|*-linuxandroid*)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*-openbsd*)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$MOZ_LINKER"; then
|
if test -n "$MOZ_LINKER"; then
|
||||||
dnl gold emits wrong sysv-style elf hash tables when building both sysv and
|
dnl gold emits wrong sysv-style elf hash tables when building both sysv and
|
||||||
dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
|
dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue