Re: Building of extended nbd fails on ppc
> The build process stops at the following line:
> (By the way, I'm using kernel-2.4.20-ben10 on an iBook v2.2)
>
> gcc -o enbd-server enbd-server.o socket.o logging.o alarm.o file.o\
> select.o fileserver.o db.o stream.o ioctl.o ipaddrfile.o pidfile.o\
> interface.o lockfile.o md5.o lock.o shmem.o hash.o
>
> lock.o(.text+0x18): In function `lock_try':
> : undefined reference to `atomic_dec_and_test'
> ^^^^^^^^^^^^^^^^^^^
> lock.o(.text+0x18): In function `lock_try':
> : relocation truncated to fit: R_PPC_REL24 atomic_dec_and_test
> lock.o(.text+0x30): In function `lock_try':
> : undefined reference to `atomic_inc'
> [...]
atomic functions are only accessible to kernel code...
static __inline__ int atomic_dec_return(atomic_t *v)
{
int t;
__asm__ __volatile__(
"1: lwarx %0,0,%1 # atomic_dec_return\n\
addic %0,%0,-1\n\
stwcx. %0,0,%1\n\
bne- 1b"
SMP_ISYNC
: "=&r" (t)
: "r" (&v->counter)
: "cc", "memory");
return t;
}
The SMP_ISYNC is just a plain isync on SMP systems. On non-SMP systems it
should be safe to use these functions. On SMP systems, the isync might
prevent this (privileged instruction, perhaps -- BenH??).
Maybe only the SMP_ISYNC def should be protected by #ifdef __KERNEL__?
Just copy the code ...
Michael
Reply to: