OSDN Git Service

Fix PR target/38571
[pf3gnuchains/gcc-fork.git] / libgomp / acinclude.m4
index b7428cf..ac450ca 100644 (file)
@@ -4,10 +4,10 @@ dnl This whole bit snagged from libgfortran.
 dnl Check whether the target supports __sync_*_compare_and_swap.
 AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
   AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
-                have_sync_builtins, [
+                libgomp_cv_have_sync_builtins, [
   AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 1);],
-             have_sync_builtins=yes, have_sync_builtins=no)])
-  if test $have_sync_builtins = yes; then
+             libgomp_cv_have_sync_builtins=yes, libgomp_cv_have_sync_builtins=no)])
+  if test $libgomp_cv_have_sync_builtins = yes; then
     AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
              [Define to 1 if the target supports __sync_*_compare_and_swap])
   fi])
@@ -15,14 +15,14 @@ AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
 dnl Check whether the target supports hidden visibility.
 AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
   AC_CACHE_CHECK([whether the target supports hidden visibility],
-                have_attribute_visibility, [
+                libgomp_cv_have_attribute_visibility, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
   AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
-                [], have_attribute_visibility=yes,
-                have_attribute_visibility=no)
+                [], libgomp_cv_have_attribute_visibility=yes,
+                libgomp_cv_have_attribute_visibility=no)
   CFLAGS="$save_CFLAGS"])
-  if test $have_attribute_visibility = yes; then
+  if test $libgomp_cv_have_attribute_visibility = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
       [Define to 1 if the target supports __attribute__((visibility(...))).])
   fi])
@@ -30,14 +30,14 @@ AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
 dnl Check whether the target supports dllexport
 AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
   AC_CACHE_CHECK([whether the target supports dllexport],
-                have_attribute_dllexport, [
+                libgomp_cv_have_attribute_dllexport, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
   AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
-                [], have_attribute_dllexport=yes,
-                have_attribute_dllexport=no)
+                [], libgomp_cv_have_attribute_dllexport=yes,
+                libgomp_cv_have_attribute_dllexport=no)
   CFLAGS="$save_CFLAGS"])
-  if test $have_attribute_dllexport = yes; then
+  if test $libgomp_cv_have_attribute_dllexport = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
       [Define to 1 if the target supports __attribute__((dllexport)).])
   fi])
@@ -45,15 +45,12 @@ AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
 dnl Check whether the target supports symbol aliases.
 AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_ALIAS], [
   AC_CACHE_CHECK([whether the target supports symbol aliases],
-                have_attribute_alias, [
+                libgomp_cv_have_attribute_alias, [
   AC_TRY_LINK([
-#define ULP    STR1(__USER_LABEL_PREFIX__)
-#define STR1(x)        STR2(x)
-#define STR2(x)        #x
 void foo(void) { }
-extern void bar(void) __attribute__((alias(ULP "foo")));],
-    [bar();], have_attribute_alias=yes, have_attribute_alias=no)])
-  if test $have_attribute_alias = yes; then
+extern void bar(void) __attribute__((alias("foo")));],
+    [bar();], libgomp_cv_have_attribute_alias=yes, libgomp_cv_have_attribute_alias=no)])
+  if test $libgomp_cv_have_attribute_alias = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
       [Define to 1 if the target supports __attribute__((alias(...))).])
   fi])
@@ -118,6 +115,7 @@ dnl  OPT_LDFLAGS='-Wl,-O1' if possible
 dnl  LD (as a side effect of testing)
 dnl Sets:
 dnl  with_gnu_ld
+dnl  libgomp_ld_is_gold (possibly)
 dnl  libgomp_gnu_ld_version (possibly)
 dnl
 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
@@ -149,9 +147,13 @@ AC_DEFUN([LIBGOMP_CHECK_LINKER_FEATURES], [
 
   # Start by getting the version number.  I think the libtool test already
   # does some of this, but throws away the result.
+  libgomp_ld_is_gold=no
+  if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+    libgomp_ld_is_gold=yes
+  fi
   changequote(,)
   ldver=`$LD --version 2>/dev/null | head -1 | \
-         sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+         sed -e 's/GNU \(go\)\{0,1\}ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\4/'`
   changequote([,])
   libgomp_gnu_ld_version=`echo $ldver | \
          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
@@ -273,6 +275,8 @@ if test $enable_symvers = yes; then
   then
     if test $libgomp_gnu_ld_version -ge $libgomp_min_gnu_ld_version ; then
       enable_symvers=gnu
+    elif test $libgomp_ld_is_gold = yes ; then
+      enable_symvers=gnu
     else
       # The right tools, the right setup, but too old.  Fallbacks?
       AC_MSG_WARN(=== Linker version $libgomp_gnu_ld_version is too old for)
@@ -301,6 +305,16 @@ if test $enable_symvers = yes; then
   fi
 fi
 
+AC_CACHE_CHECK([whether the target supports .symver directive],
+              libgomp_cv_have_as_symver_directive, [
+  AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
+                [], libgomp_cv_have_as_symver_directive=yes,
+                libgomp_cv_have_as_symver_directive=no)])
+if test $libgomp_cv_have_as_symver_directive = yes; then
+  AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
+    [Define to 1 if the target assembler supports .symver directive.])
+fi
+
 AM_CONDITIONAL(LIBGOMP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
 ])