Browse Source

centos5 gcc 4.1 asm bug

include/atomic/x86-gcc.h:
  force %esi register, don't give gcc a choice.
  (otherwise it could choose %ebx, and 4.1 did)
pull/843/head
Sergei Golubchik 13 years ago
parent
commit
009dee833c
  1. 6
      cmake/os/Linux.cmake
  2. 6
      include/atomic/x86-gcc.h

6
cmake/os/Linux.cmake

@ -47,9 +47,3 @@ IF(HAVE_DECL_SHM_HUGETLB)
SET(HAVE_LARGE_PAGE_OPTION 1)
ENDIF()
IF(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "86")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=i686")
ENDIF()

6
include/atomic/x86-gcc.h

@ -124,10 +124,10 @@
asm volatile ("push %%ebx;" \
"movl (%%ecx), %%ebx;" \
"movl 4(%%ecx), %%ecx;" \
LOCK_prefix "; cmpxchg8b %0;" \
LOCK_prefix "; cmpxchg8b (%%esi);" \
"setz %2; pop %%ebx" \
: "=m" (*a), "+A" (*cmp), "=c" (ret) \
: "c" (&set), "m" (*a) \
: "+S" (a), "+A" (*cmp), "=c" (ret) \
: "c" (&set) \
: "memory", "esp")
#endif

Loading…
Cancel
Save