/usr/src/gcc-4.4/debian/patches/pr40133.diff is in gcc-4.4-source 4.4.7-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | # DP: Do link tests to check for the atomic builtins
libstdc++-v3/
2009-12-09 Paolo Carlini <paolo.carlini@oracle.com>
Matthias Klose <doko@ubuntu.com>
PR libstdc++/40133
* acinclude.m4 ([GLIBCXX_ENABLE_ATOMIC_BUILTINS]): On *-*-linux*,
*-*-kfreebsd*-gnu | *-*-gnu* targets do link tests when possible.
* configure: Regenerate.
Index: libstdc++-v3/acinclude.m4
===================================================================
--- a/src/libstdc++-v3/acinclude.m4 (revision 155104)
+++ b/src/libstdc++-v3/acinclude.m4 (working copy)
@@ -2438,8 +2438,7 @@
dnl that are used should be checked.
dnl
dnl Note:
-dnl libgomp and libgfortran do this with a link test, instead of an asm test.
-dnl see: CHECK_SYNC_FETCH_AND_ADD
+dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
dnl
dnl Defines:
dnl _GLIBCXX_ATOMIC_BUILTINS_1
@@ -2451,12 +2450,120 @@
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
old_CXXFLAGS="$CXXFLAGS"
-
+
+ # Do link tests if possible, instead asm tests, limited to some platforms
+ atomic_builtins_link_tests=no
+ if test x$gcc_no_link != xyes; then
+ # Can do link tests. Limit to some tested platforms
+ case "$host" in
+ *-*-linux* | *-*-kfreebsd*-gnu | *-*-gnu*)
+ atomic_builtins_link_tests=yes
+ ;;
+ esac
+ fi
+
+ if test x$atomic_builtins_link_tests = xyes; then
+
+ # Do link tests.
+
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for atomic builtins for bool])
+ AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef bool atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_bool=yes],
+ [glibcxx_cv_atomic_bool=no])
+ ])
+ if test $glibcxx_cv_atomic_bool = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
+ [Define if builtin atomic operations for bool are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_bool)
+
+ AC_MSG_CHECKING([for atomic builtins for short])
+ AC_CACHE_VAL(glibcxx_cv_atomic_short, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef short atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_short=yes],
+ [glibcxx_cv_atomic_short=no])
+ ])
+ if test $glibcxx_cv_atomic_short = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
+ [Define if builtin atomic operations for short are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_short)
+
+ AC_MSG_CHECKING([for atomic builtins for int])
+ AC_CACHE_VAL(glibcxx_cv_atomic_int, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef int atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_int=yes],
+ [glibcxx_cv_atomic_int=no])
+ ])
+ if test $glibcxx_cv_atomic_int = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
+ [Define if builtin atomic operations for int are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_int)
+
+ AC_MSG_CHECKING([for atomic builtins for long long])
+ AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef long long atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_long_long=yes],
+ [glibcxx_cv_atomic_long_long=no])
+ ])
+ if test $glibcxx_cv_atomic_long_long = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
+ [Define if builtin atomic operations for long long are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
+
+ else
+
+ # Do asm tests.
+
# Compile unoptimized.
CXXFLAGS='-O0 -S'
- # Fake what AC_TRY_COMPILE does, without linking as this is
- # unnecessary for a builtins test.
+ # Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
[#]line __oline__ "configure"
@@ -2478,14 +2585,14 @@
AC_MSG_CHECKING([for atomic builtins for bool])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsb=no
+ glibcxx_cv_atomic_bool=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
[Define if builtin atomic operations for bool are supported on this host.])
- enable_atomic_builtinsb=yes
+ glibcxx_cv_atomic_bool=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsb)
+ AC_MSG_RESULT($glibcxx_cv_atomic_bool)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2508,14 +2615,14 @@
AC_MSG_CHECKING([for atomic builtins for short])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinss=no
+ glibcxx_cv_atomic_short=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
[Define if builtin atomic operations for short are supported on this host.])
- enable_atomic_builtinss=yes
+ glibcxx_cv_atomic_short=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinss)
+ AC_MSG_RESULT($glibcxx_cv_atomic_short)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2539,14 +2646,14 @@
AC_MSG_CHECKING([for atomic builtins for int])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsi=no
+ glibcxx_cv_atomic_int=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
[Define if builtin atomic operations for int are supported on this host.])
- enable_atomic_builtinsi=yes
+ glibcxx_cv_atomic_int=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsi)
+ AC_MSG_RESULT($glibcxx_cv_atomic_int)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2569,22 +2676,23 @@
AC_MSG_CHECKING([for atomic builtins for long long])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsll=no
+ glibcxx_cv_atomic_long_long=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
[Define if builtin atomic operations for long long are supported on this host.])
- enable_atomic_builtinsll=yes
+ glibcxx_cv_atomic_long_long=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsll)
+ AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
rm -f conftest*
+ fi
CXXFLAGS="$old_CXXFLAGS"
AC_LANG_RESTORE
# Set atomicity_dir to builtins if either of above tests pass.
- if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then
+ if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
atomicity_dir=cpu/generic/atomicity_builtins
fi
|