OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [config/] [tls.m4] - Diff between revs 157 and 225

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
dnl Check whether the target supports TLS.
dnl Check whether the target supports TLS.
AC_DEFUN([GCC_CHECK_TLS], [
AC_DEFUN([GCC_CHECK_TLS], [
 
  AC_REQUIRE([AC_CANONICAL_HOST])
  GCC_ENABLE(tls, yes, [], [Use thread-local storage])
  GCC_ENABLE(tls, yes, [], [Use thread-local storage])
  AC_CACHE_CHECK([whether the target supports thread-local storage],
  AC_CACHE_CHECK([whether the target supports thread-local storage],
                 gcc_cv_have_tls, [
                 gcc_cv_have_tls, [
    AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
    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 If the test case passed with dynamic linking, try again with
       dnl static linking, but only if static linking is supported (not
       dnl static linking, but only if static linking is supported (not
       dnl on Solaris 10).  This fails with some older Red Hat releases.
       dnl on Solaris 10).  This fails with some older Red Hat releases.
      chktls_save_LDFLAGS="$LDFLAGS"
      chktls_save_LDFLAGS="$LDFLAGS"
      LDFLAGS="-static $LDFLAGS"
      LDFLAGS="-static $LDFLAGS"
      AC_LINK_IFELSE([int main() { return 0; }],
      AC_LINK_IFELSE([int main() { return 0; }],
        AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
        [AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
                      [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],[]),
                       [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],[])],
        [gcc_cv_have_tls=yes])
        [gcc_cv_have_tls=yes])
      LDFLAGS="$chktls_save_LDFLAGS"
      LDFLAGS="$chktls_save_LDFLAGS"
      if test $gcc_cv_have_tls = yes; then
      if test $gcc_cv_have_tls = yes; then
        dnl So far, the binutils and the compiler support TLS.
        dnl So far, the binutils and the compiler support TLS.
        dnl Also check whether the libc supports TLS, i.e. whether a variable
        dnl Also check whether the libc supports TLS, i.e. whether a variable
Line 64... Line 65...
      fi],
      fi],
      [gcc_cv_have_tls=no],
      [gcc_cv_have_tls=no],
      [dnl This is the cross-compiling case. Assume libc supports TLS if the
      [dnl This is the cross-compiling case. Assume libc supports TLS if the
       dnl binutils and the compiler do.
       dnl binutils and the compiler do.
       AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
       AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
                      [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no])
         [chktls_save_LDFLAGS="$LDFLAGS"
 
          dnl Shared library options may depend on the host; this check
 
          dnl is only known to be needed for GNU/Linux.
 
          case $host in
 
            *-*-linux*)
 
              LDFLAGS="-shared -Wl,--no-undefined $LDFLAGS"
 
              ;;
 
          esac
 
          chktls_save_CFLAGS="$CFLAGS"
 
          CFLAGS="-fPIC $CFLAGS"
 
          dnl If -shared works, test if TLS works in a shared library.
 
          AC_LINK_IFELSE([int f() { return 0; }],
 
            [AC_LINK_IFELSE([__thread int a; int b; int f() { return a = b; }],
 
              [gcc_cv_have_tls=yes],
 
              [gcc_cv_have_tls=no])],
 
            [gcc_cv_have_tls=yes])
 
          CFLAGS="$chktls_save_CFLAGS"
 
          LDFLAGS="$chktls_save_LDFLAGS"], [gcc_cv_have_tls=no])
      ]
      ]
    )])
    )])
  if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
  if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then
    AC_DEFINE(HAVE_TLS, 1,
    AC_DEFINE(HAVE_TLS, 1,
              [Define to 1 if the target supports thread-local storage.])
              [Define to 1 if the target supports thread-local storage.])
  fi])
  fi])
 
 
dnl Check whether the target assembler supports TLS.
dnl Check whether the target assembler supports TLS.
AC_DEFUN([GCC_CHECK_CC_TLS], [
AC_DEFUN([GCC_CHECK_CC_TLS], [
  GCC_ENABLE(tls, yes, [], [Use thread-local storage])
  GCC_ENABLE(tls, yes, [], [Use thread-local storage])
  AC_CACHE_CHECK([whether the target asssembler upports thread-local storage],
  AC_CACHE_CHECK([whether the target assembler supports thread-local storage],
                 gcc_cv_have_cc_tls, [
                 gcc_cv_have_cc_tls, [
    AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
    AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
      [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
      [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
    )])
    )])
  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
    AC_DEFINE(HAVE_CC_TLS, 1,
    AC_DEFINE(HAVE_CC_TLS, 1,
              [Define to 1 if the target assembler supports thread-local storage.])
              [Define to 1 if the target assembler supports thread-local storage.])
  fi])
  fi])
 
 
 No newline at end of file
 No newline at end of file
 
dnl Check whether TLS is emulated.
 
AC_DEFUN([GCC_CHECK_EMUTLS], [
 
  AC_CACHE_CHECK([whether the thread-local storage support is from emutls],
 
                 gcc_cv_use_emutls, [
 
    gcc_cv_use_emutls=no
 
    echo '__thread int a; int b; int main() { return a = b; }' > conftest.c
 
    if AC_TRY_COMMAND(${CC-cc} -Werror -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD); then
 
      if grep __emutls_get_address conftest.s > /dev/null; then
 
        gcc_cv_use_emutls=yes
 
      fi
 
    fi
 
    rm -f conftest.*
 
    ])
 
  if test "$gcc_cv_use_emutls" = "yes" ; then
 
    AC_DEFINE(USE_EMUTLS, 1,
 
              [Define to 1 if the target use emutls for thread-local storage.])
 
  fi])
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.