Fix opensuse powerpc build
authorSteven Munroe <munroesj@linux.vnet.ibm.com>
Tue, 19 May 2009 17:14:53 +0000 (13:14 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tue, 19 May 2009 17:14:53 +0000 (13:14 -0400)
I gave this code a spin on a G5 (PPC970) OpenSuse 10.3 system and
encountered same issues that should fix fot tyou next update.

The liburcu make system sis not set up for biarch (32-/64-bit) builds on
PPC. SLES10/OpenSUSE-10.3 is a default 32-bit, 64-bit capable system. To
build a 64-bit you need to insert -m64 for all compiles and link
operations. Also for 64-bit make install should move liburcu.so
to /usr/lib64 not /usr/lib. This is required to FSB complience. Is
worked around this by copying Makefile to Makefile64 and made the
required changes there.

For SLES11 we changed to to a 64-bit default and 32-bit capable system.
In either case you need to be able to build both 32-/64-bit liburcu.so
on same systems and need to insure that make install is appropriate.

Also I found that __SIZEOF_LONG__ was not defined and resulted in a
sigill on PPC64. I suspect this is XLC specific and you need solution
that works for GCC builds as well.

I have attached a patch that implement these change for your review.
With this patch I can build liburcu and run the tests successfully.

Finally when I build 32-bit (default for OpenSUSE 10) I get a unhandled
SIGUSER1. I ran out of weekend before I could figure that out.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Makefile64 [new file with mode: 0644]
arch_atomic_ppc.h

diff --git a/Makefile64 b/Makefile64
new file mode 100644 (file)
index 0000000..7c343a3
--- /dev/null
@@ -0,0 +1,79 @@
+
+#CFLAGS=-m64 -Wall -O2 -g -I.
+CFLAGS=-m64 -O2 -g -I.
+LDFLAGS=-lpthread
+
+#debug
+#CFLAGS=-Wall -g
+#CFLAGS+=-DDEBUG_FULL_MB
+
+#Changing the signal number used by the library. SIGUSR1 by default.
+#CFLAGS+=-DSIGURCU=SIGUSR2
+
+SRC_DEP=`echo $^ | sed 's/[^ ]*.h//g'`
+
+all: arch-api test_urcu test_urcu_dynamic_link test_urcu_timing \
+       test_rwlock_timing test_urcu_yield urcu-asm.S \
+       urcu-asm.o urcutorture urcutorture-yield liburcu.so
+
+arch-api: api.h arch.h
+       # Run either make pthreads-x86 or make pthreads-ppc prior to build
+       # the RCU library. Architecture auto-detectection not implemented
+       # in the build system yet.
+
+pthreads-x86: clean
+       cp api_x86.h api.h
+       cp arch_x86.h arch.h
+       cp arch_atomic_x86.h arch_atomic.h
+
+pthreads-ppc: clean
+       cp api_ppc.h api.h
+       cp arch_ppc.h arch.h
+       cp arch_atomic_ppc.h arch_atomic.h
+
+test_urcu: urcu.o test_urcu.c urcu.h
+       $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h
+       $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP)
+
+test_urcu_yield: urcu-yield.o test_urcu.c urcu.h
+       $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+test_urcu_timing: urcu.o test_urcu_timing.c urcu.h
+       $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h
+       $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+urcu.o: urcu.c urcu.h
+       $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
+
+liburcu.so: urcu.o
+       $(CC) -m64 -fPIC -shared -o $@ $<
+
+urcu-yield.o: urcu.c urcu.h
+       $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
+
+urcu-asm.S: urcu-asm.c urcu.h
+       $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP)
+
+urcu-asm.o: urcu-asm.c urcu.h
+       $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP)
+
+urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h
+       $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h
+       $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
+
+.PHONY: clean install arch-api
+
+install: liburcu.so
+       cp -f liburcu.so /usr/lib64/
+       cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/
+
+clean:
+       rm -f *.o test_urcu test_urcu_timing test_rwlock_timing urcu-asm.S \
+               test_urcu_yield urcutorture urcutorture-yield liburcu.so \
+               test_urcu_dynamic_link api.h arch.h arch_atomic.h
index 587fb8bbcc112dd8a97ed13b278d95c3bd4df7eb..d666230fea7a80b0ee495990ce2e661750ebd406 100644 (file)
  * Boehm-Demers-Weiser conservative garbage collector.
  */
 
+#ifndef __SIZEOF_LONG__
+#ifdef __powerpc64__
+#define __SIZEOF_LONG__ 8
+#else
+#define __SIZEOF_LONG__ 4
+#endif
+#endif
+
 #ifndef BITS_PER_LONG
 #define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
 #endif
@@ -67,7 +75,7 @@ unsigned long atomic_exchange_64(volatile unsigned long *addr,
                "stdcx. %2,0,%1\n"      /* else store conditional */
                "bne- 1b\n"             /* retry if lost reservation */
                "isync\n"
-                       : "=&r"(result),
+                       : "=&r"(result)
                        : "r"(addr), "r"(val)
                        : "memory", "cc");
 
This page took 0.027202 seconds and 4 git commands to generate.