Subject: Problem with "sync" in NetBSD-current...
To: None <port-cobalt@NetBSD.org>
From: Peter Froehlich <phf@cs.jhu.edu>
List: port-cobalt
Date: 02/13/2007 12:34:58
Hi all,
I am trying to build NetBSD-current for my Qube 2, and I thought I
ask here first before asking on port-mips or current-users.
Things break apart in the pthreads stuff where a "sync" instruction
is emitted which apparently conflicts with the idea that this should
run on MIPS I machines as well. Here's the error message from my
build log:
-----CUT-----
# compile libpthread/pthread_lock.o
/home/phf/CURRENT/src/tooldir.NetBSD-3.0-mipsel/bin/mipsel--netbsd-
gcc -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-
arith -Wno-sign-compare -Wno-traditional -Wreturn-type -Wswitch -
Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -
std=gnu99 -Werror -Wno-cast-qual -I/home/phf/CURRENT/src/lib/
libpthread/arch/mips -I/home/phf/CURRENT/src/lib/libpthread -I/home/
phf/CURRENT/src/lib/libpthread/obj -D_LIBC -D__LIBPTHREAD_SOURCE__ -I/
home/phf/CURRENT/src/sys -I/home/phf/CURRENT/src/lib/libpthread/../
libc -nostdinc -isystem /home/phf/CURRENT/src/destdir.cobalt/usr/
include -c /home/phf/CURRENT/src/lib/libpthread/pthread_lock.c -o
pthread_lock.o
/var/tmp//ccfflyyH.s: Assembler messages:
/var/tmp//ccfflyyH.s:83: Error: opcode not supported on this
processor: mips1 (mips1) `sync'
/var/tmp//ccfflyyH.s:132: Error: opcode not supported on this
processor: mips1 (mips1) `sync'
-----CUT-----
I've looked at the assembly for this. Curiously enough the "sync" is
emitted also in line 106 but there it doesn't lead to an error
message? The functions that lead to errors are
pthread__atomic_simple_lock_init
pthread__atomic_simple_unlock
while the function that *doesn't* lead to an error from the assembler is
pthread__atomic_simple_lock_try
which is all the more confusing since all three functions are one-
liners in the C source:
-----CUT-----
static void
pthread__atomic_simple_lock_init(__cpu_simple_lock_t *alp)
{
__cpu_simple_lock_init(alp);
}
static int
pthread__atomic_simple_lock_try(__cpu_simple_lock_t *alp)
{
return (__cpu_simple_lock_try(alp));
}
static void
pthread__atomic_simple_unlock(__cpu_simple_lock_t *alp)
{
__cpu_simple_unlock(alp);
}
-----CUT-----
In turn, the functions called here are from <mips/lock.h> and
(eventually) do mb_memory() which is defined as follows:
-----CUT-----
static __inline void
mb_memory(void)
{
__asm volatile("sync" ::: "memory");
}
-----CUT-----
So I *assume* that there should be some kind of conditional
compilation happening here to avoid sending these out for MIPS I? On
the other hand, why the heck do I need to compile for MIPS I if I am
running NetBSD on a Qube 2 that implements MIPS IV (of which "sync"
is certainly part)? Is there a simple way to tell the build system to
compile for MIPS IV instead? Shouldn't that be happening for the
cobalt port anyway?
Cheers,
Peter
--
Peter H. Froehlich <><><><><><> http://www.cs.jhu.edu/~phf/
OpenPGP: ABC2 9BCC 1445 86E9 4D59 F532 A8B2 BFAE 342B E9D9