Don't break the build on AIX5.3.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7240
This commit is contained in:
Julian Seward 2007-11-27 11:23:55 +00:00
parent 44e10a1a18
commit dc96d0a97a
4 changed files with 26 additions and 18 deletions

View File

@ -27,19 +27,19 @@
# define PLAT_ppc32_aix5 1
#endif
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux)
# define INC(_lval) \
# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
# define INC(_lval) \
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
|| defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
# define INC(_lval,_lqual) \
__asm__ __volatile__( \
"1:\n" \
"L1xyzzy1" _lqual ":\n" \
" lwarx 15,0,%0\n" \
" addi 15,15,1\n" \
" stwcx. 15,0,%0\n" \
" bne- 1b" \
" bne- L1xyzzy1" _lqual \
: /*out*/ : /*in*/ "b"(&(_lval)) \
: /*trash*/ "r15", "cr0", "memory" \
)
@ -52,7 +52,7 @@ int x = 0;
void* child_fn ( void* arg )
{
INC(x);
INC(x, "childfn");
return NULL;
}
@ -65,7 +65,7 @@ int main ( void )
exit(1);
}
INC(x);
INC(x, "main");
if (pthread_join(child, NULL)) {
perror("pthread join");

View File

@ -44,19 +44,19 @@
# define PLAT_ppc32_aix5 1
#endif
#if defined(PLAT_amd64_linux) || defined(PLAT_x86_linux)
# define INC(_lval) \
# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"lock ; incl (%0)" : /*out*/ : /*in*/"r"(&(_lval)) : "memory", "cc" )
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux)
# define INC(_lval) \
#elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
|| defined(PLAT_ppc32_aix5) || defined(PLAT_ppc64_aix5)
# define INC(_lval,_lqual) \
__asm__ __volatile__( \
"1:\n" \
"L1xyzzy1" _lqual ":\n" \
" lwarx 15,0,%0\n" \
" addi 15,15,1\n" \
" stwcx. 15,0,%0\n" \
" bne- 1b" \
" bne- L1xyzzy1" _lqual \
: /*out*/ : /*in*/ "b"(&(_lval)) \
: /*trash*/ "r15", "cr0", "memory" \
)
@ -102,7 +102,7 @@ int main ( void )
}
for (i = 0; i < LIMIT; i++) {
INC(x);
INC(x, "main");
if (i == 5) sleep(1); /* make sure child doesn't starve */
}

View File

@ -2286,6 +2286,6 @@ void* steer ( void* infoV )
__asm__ __volatile__("");
if (wot == 999) return fn(info);
__asm__ __volatile__("");
assert(0);
return 0; /* keep gcc happy on AIX */
}

View File

@ -1,4 +1,3 @@
/* This program attempts to verify that all functions that are
supposed to be wrapped by tc_intercepts.c really are wrapped. The
main way it does this is to cause failures in those functions, so
@ -12,7 +11,6 @@
otherwise "know" about some more exotic pthread stuff, in this case
PTHREAD_MUTEX_ERRORCHECK. */
#define _GNU_SOURCE 1
#include <stdio.h>
#include <string.h>
#include <assert.h>
@ -20,6 +18,8 @@
#include <pthread.h>
#include <semaphore.h>
#if !defined(_AIX)
#if !defined(__GLIBC_PREREQ)
# error "This program needs __GLIBC_PREREQ (in /usr/include/features.h)"
#endif
@ -260,3 +260,11 @@ int main ( void )
return 0;
}
#else /* defined(_AIX) */
int main ( void )
{
fprintf(stderr, "This program does not work on AIX.\n");
return 0;
}
#endif