linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: FW: NPTL support on PPC32 (MPC5200) ?
       [not found] <DBFABB80F7FD3143A911F9E6CFD477B0021B045A@hqemmail02.nvidia.com>
@ 2004-10-12 15:29 ` Dan Kegel
  2004-10-13  5:18   ` Jim Freeman
  2004-10-14  1:55   ` Jim Freeman
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Kegel @ 2004-10-12 15:29 UTC (permalink / raw)
  To: Stephen Warren, linuxppc-embedded, crossgcc

Hi Stephen,
to build NPTL, you need to apply contrib/crosstool-0.28-rc34-nptl_fixes.patch
Then see demo-x86_64-nptl.sh

Enough people need this that I've been intending for two weeks to merge it asap,
but I haven't gotten around to it.

That patch was only tested for x86, but ppc32 shouldn't be any
harder, right? :-)
- Dan

Stephen Warren wrote:
> Hi. I'm attempting to use your crosstool to build a NPTL capable GLIBC
> and toolchain for a 32-bit PowerPC target.
> 
> I'm finding it very difficult to find information on which libc, kernel,
> compiler and binutils versions are required for this.
> 
> Can you point me to any information that'll tell me definitively which
> software versions support this, or at any mailing lists that are
> appropriate for this kind of question? I tried
> linuxppc-embedded@ozlabs.org (see attached email) but didn't hear
> anything back.
> 
> Thanks for any pointers at all!
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Subject:
> NPTL support on PPC32 (MPC5200) ?
> From:
> "Stephen Warren" <SWarren@nvidia.com>
> Date:
> Fri, 8 Oct 2004 09:26:22 -0700
> To:
> <linuxppc-embedded@ozlabs.org>
> 
> To:
> <linuxppc-embedded@ozlabs.org>
> 
> 
> Hello everyone.
> 
> I'm trying to run a fairly heavily multi-threaded application on the
> Motorola/Freescale MPC5200 platform. So far, we're having a few
> performance problems. Freescale has profiled the application using
> strace and shown that a lot of our CPU time goes into executing the kill
> and rt_sigsuspend system calls, which we understand are used in the
> implementation of the threading library.
> 
> So, I figured I'd see if NPTL (Native Posix Threads Library) would help
> us out at all. I found and attempted to use a utility named crosstool
> (0.28-rc37) from http://kegel.com/crosstool/ to build a new toolchain
> supporting this.
> 
> I made a few changes to crosstool.sh in an attempt to request NPTL.
> These are shown later in the email.
> 
> However, I'm getting an error from the configure of glibc:
> 
> ...
> /home/swarren/src/crosstool-0.28-rc37/build/powerpc-603e-linux-gnu/gcc-3
> .4-20041001-glibc-20041004/glibc-20041004/configure --prefix=/usr
> --build=i686-pc-linux-gnu --host=powerpc-603e-linux-gnu
> --enable-kernel=2.4.24 --without-cvs --without-gd --with-tls
> --with-__thread --enable-shared --enable-add-ons=nptl
> --with-headers=/usr/local/ppc_82xx/powerpc-603e-linux-gnu/gcc-3.4-200410
> 01-glibc-20041004/powerpc-603e-linux-gnu/include
> ...
> running configure fragment for nptl/sysdeps/pthread
> checking for forced unwind support... no
> configure: error: forced unwind support is required
> 
> I've tried various combinations of:
> 
> gcc-3.4.2        (release)
> gcc-3.4-20041001 (10/01 snapshot)
> glibc-2.3.3      (release)
> glibc-20041004   (10/04 snapshot)
> binutils-2.15    (release)
> binutils-041007) (10/07 snapshot)
> kernel 2.4.24    (release)
> kernel 2.6.8     (release)
> 
> My question is - can anybody tell me, or point me at a website that
> definitively tells me:
> 
> 1) Is NPTL available on PPC at all? I assume so, since I found one of
> the original announcement of NPTL, which mentions performance on a large
> SMP PPC system.
> 
> 2) Which kernels have the required support for NPTL - I believe 2.6.x
> does. I know RedHat back-ported it to their 2.4.x kernels for RedHat 9
> (at least x86). Did it get back-ported into any official 2.4.x kernel,
> such as the 2.4.24 I tried?
> 
> 3) Which glibc and gcc do I need. I found webpages that indicate gcc >=
> 3.4.x is required for toolchain thread/TLS support, and NPTL is part of
> glibc >= 2.3.x.
> 
> 4) Which binutils should work?
> 
> 5) Am I missing some configure options for glibc? Or, binutils or gcc?
> 
> So far, I'm downloading all GNU tools from gnu.org, or a mirror, and
> kernels from kernel.org. Should I try PPC-specific branches for any of
> this?
> 
> Note: I'd really like 2.4.x support if it's available - I need a
> DMA-enabled IDE driver for the MPC5200, and so far, all I have is a
> patched 2.4.24 directly from Freescale (which apparently they're working
> on integrating back into the kernel at www.denx.de) Eventually, we
> intend to use a Montavista-based system. We were using MV Linux 3.0
> (before we hit problems with IDE DMA) which uses kernel 2.4.18.
> 
> Thanks for any help, or pointers to good resources. I spent most of
> yesterday googling and trying out different gcc/glibc/kernel
> combinations, and couldn't get past this.
> 
> Modifications I made to crosstool.sh to request NPTL:
> 
> (Note that if I remove just the second part of this patch, it all builds
> fine, but using the old Linuxthreads instead of NPTL)
> 
> ===============================================================
> [swarren@swarren-linux crosstool-0.28-rc37]$ diff crosstool.sh.orig
> crosstool.sh
> 365,367c365,367
> <       --enable-kernel=2.4.3 \
> <         --without-cvs --disable-profile --disable-debug --without-gd \
> <         --without-tls --without-__thread \
> ---
> 
>>      --enable-kernel=2.4.24 \
>>        --without-cvs --without-gd \
>>        --with-tls --with-__thread \
> 
> 369c369
> <         --enable-add-ons${GLIBC_ADDON_OPTIONS}
> --with-headers=$HEADERDIR
> ---
> 
>>        --enable-add-ons=nptl --with-headers=$HEADERDIR
> 
> ===============================================================
> 
> I created my own top-level build script and .dat files based upon the
> existing ones:
> 
> ===============================================================
> [swarren@swarren-linux crosstool-0.28-rc37]$ cat demo-ppc603e.sh 
> #!/bin/sh
> set -ex
> TARBALLS_DIR=$HOME/archive
> RESULT_TOP=/usr/local/ppc_82xx
> export TARBALLS_DIR RESULT_TOP
> GCC_LANGUAGES="c,c++"
> export GCC_LANGUAGES
> 
> # Really, you should do the mkdir before running this,
> # and chown /opt/crosstool to yourself so you don't need to run as root.
> mkdir -p $RESULT_TOP
> 
> # Build the toolchain.  Takes a couple hours and a couple gigabytes.
> eval `cat powerpc-603e.dat gcc-3.4-20041001-glibc-20041004.dat` sh
> all.sh --notest
> 
> echo Done.
> ===============================================================
> 
> ===============================================================
> [swarren@swarren-linux crosstool-0.28-rc37]$ cat
> gcc-3.4-20041001-glibc-20041004.dat
> BINUTILS_DIR=binutils-2.15
> GCC_DIR=gcc-3.4-20041001
> GLIBC_DIR=glibc-20041004
> LINUX_DIR=linux-2.6.8
> ===============================================================
> 


-- 
Know a student in Los Angeles who wants a job doing C++ on Linux?  Send him/her to http://kegel.com/academy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: NPTL support on PPC32 (MPC5200) ?
  2004-10-12 15:29 ` FW: NPTL support on PPC32 (MPC5200) ? Dan Kegel
@ 2004-10-13  5:18   ` Jim Freeman
  2004-10-13  5:42     ` Jim Freeman
  2004-10-14  1:55   ` Jim Freeman
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Freeman @ 2004-10-13  5:18 UTC (permalink / raw)
  To: Dan Kegel; +Cc: Stephen Warren, crossgcc, linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]

I find that I have to apply the attached patch to

	contrib/crosstool-0.28-rc34-nptl_fixes.patch

or else I get the following error:

	+ cp
	/opt/src/crosstool-0.28-rc37/build/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/nptl/sysdeps/unix/sysv/linux/ppc/bits/pthreadtypes.h
	/opt/src/crosstool-0.28-rc37/result/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/powerpc-8540-linux-gnu/include/bits/pthreadtypes.h
	cp: cannot stat
	`/opt/src/crosstool-0.28-rc37/build/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/nptl/sysdeps/unix/sysv/linux/ppc/bits/pthreadtypes.h':
	No such file or directory

[ ARCH=ppc, but dirname = powerpc/ ]

The build hasn't finished yet, but at least it no longer dies at this
spot.

...jfree
========
On Tue, Oct 12, 2004 at 08:29:58AM -0700, Dan Kegel wrote:
> Hi Stephen,
> to build NPTL, you need to apply 
> contrib/crosstool-0.28-rc34-nptl_fixes.patch
> Then see demo-x86_64-nptl.sh
> 
> Enough people need this that I've been intending for two weeks to merge it 
> asap,
> but I haven't gotten around to it.
> 
> That patch was only tested for x86, but ppc32 shouldn't be any
> harder, right? :-)
> - Dan
> 
> Stephen Warren wrote:
> >Hi. I'm attempting to use your crosstool to build a NPTL capable GLIBC
> >and toolchain for a 32-bit PowerPC target.
> >
> >I'm finding it very difficult to find information on which libc, kernel,
> >compiler and binutils versions are required for this.
> >
> >Can you point me to any information that'll tell me definitively which
> >software versions support this, or at any mailing lists that are
> >appropriate for this kind of question? I tried
> >linuxppc-embedded@ozlabs.org (see attached email) but didn't hear
> >anything back.
> >
> >Thanks for any pointers at all!

[-- Attachment #2: ppc_nptl.diff --]
[-- Type: text/plain, Size: 703 bytes --]

--- contrib/crosstool-0.28-rc34-nptl_fixes.patch	2004/10/13 04:48:11	1.1
+++ contrib/crosstool-0.28-rc34-nptl_fixes.patch	2004/10/13 04:48:45
@@ -164,7 +164,7 @@
 +        # will have to manually be copied from under the tree of the desired
 +        # target pthread implementation.
 +        cp ${GLIBC_DIR}/nptl/sysdeps/pthread/pthread.h $HEADERDIR/pthread.h
-+        cp ${GLIBC_DIR}/nptl/sysdeps/unix/sysv/linux/${ARCH}/bits/pthreadtypes.h $HEADERDIR/bits/pthreadtypes.h
++        cp ${GLIBC_DIR}/nptl/sysdeps/unix/sysv/linux/${ARCH/ppc/powerpc}/bits/pthreadtypes.h $HEADERDIR/bits/pthreadtypes.h
 +
 +        # On s390, powerpc and sparc we also require bits/wordsize.h.
 +        case $TARGET in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: NPTL support on PPC32 (MPC5200) ?
  2004-10-13  5:18   ` Jim Freeman
@ 2004-10-13  5:42     ` Jim Freeman
  0 siblings, 0 replies; 4+ messages in thread
From: Jim Freeman @ 2004-10-13  5:42 UTC (permalink / raw)
  To: Dan Kegel; +Cc: Stephen Warren, crossgcc, linuxppc-embedded

On Tue, Oct 12, 2004 at 11:18:55PM -0600, Jim Freeman wrote:
> I find that I have to apply the attached patch to
>=20
> 	contrib/crosstool-0.28-rc34-nptl_fixes.patch
=2E..
> [ ARCH=3Dppc, but dirname =3D powerpc/ ]
>=20
> The build hasn't finished yet, but at least it no longer dies at this
> spot.

Phbbt - dies later with

	powerpc-8540-linux-gnu-gcc  ../sysdeps/powerpc/elf/libc-start.c -c -std=3D=
gnu99 -O -Wa,-me500 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -mno=
-string -msoft-float -msoft-float -mnew-mnemonics   -I../nptl   -I../includ=
e -I. -I/opt/src/crosstool-0.28-rc37/build/powerpc-8540-linux-gnu/gcc-3.4.2=
-glibc-2.3.3/build-glibc-startfiles/csu -I.. -I../libio -I../nptl -I/opt/sr=
c/crosstool-0.28-rc37/build/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/bu=
ild-glibc-startfiles -I../sysdeps/powerpc/powerpc32/elf -I../sysdeps/powerp=
c/elf -I../nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32 -I../nptl/sysdeps=
/unix/sysv/linux/powerpc -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdep=
s/pthread -I../sysdeps/pthread -I../nptl/sysdeps/unix/sysv -I../nptl/sysdep=
s/unix -I../nptl/sysdeps/powerpc -I../sysdeps/unix/sysv/linux/powerpc/power=
pc32 -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux -I..=
/sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/u=
nix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../sysdeps/unix=
 -I../sysdeps/posix -I../sysdeps/powerpc/powerpc32 -I../sysdeps/wordsize-32=
 -I../sysdeps/powerpc/soft-fp -I../sysdeps/powerpc/nofpu -I../sysdeps/power=
pc -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/iee=
e754 -I../sysdeps/generic/elf -I../sysdeps/generic -nostdinc -isystem /opt/=
src/crosstool-0.28-rc37/result/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3=
/lib/gcc/powerpc-8540-linux-gnu/3.4.2/include -isystem /opt/src/crosstool-0=
=2E28-rc37/result/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/powerpc-8540=
-linux-gnu/include -D_LIBC_REENTRANT -D_LIBC_REENTRANT -include ../include/=
libc-symbols.h       -DHAVE_INITFINI -o /opt/src/crosstool-0.28-rc37/build/=
powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc-startfiles/csu/lib=
c-start.o -MD -MP -MF /opt/src/crosstool-0.28-rc37/build/powerpc-8540-linux=
-gnu/gcc-3.4.2-glibc-2.3.3/build-glibc-startfiles/csu/libc-start.o.dt
	In file included from ../sysdeps/powerpc/elf/libc-start.c:55:
	../sysdeps/generic/libc-start.c: In function `generic_start_main':
	../sysdeps/generic/libc-start.c:93: sorry, unimplemented: function 'generi=
c_start_main' can never be inlined because it uses setjmp
	make[2]: *** [/opt/src/crosstool-0.28-rc37/build/powerpc-8540-linux-gnu/gc=
c-3.4.2-glibc-2.3.3/build-glibc-startfiles/csu/libc-start.o] Error 1
	make[2]: Leaving directory `/opt/src/crosstool-0.28-rc37/build/powerpc-854=
0-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3/csu'
	make[1]: *** [csu/subdir_lib] Error 2
	make[1]: Leaving directory `/opt/src/crosstool-0.28-rc37/build/powerpc-854=
0-linux-gnu/gcc-3.4.2-glibc-2.3.3/glibc-2.3.3'
	make: *** [csu/subdir_lib] Error 2


Tired, bed (I'm a wimp).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FW: NPTL support on PPC32 (MPC5200) ?
  2004-10-12 15:29 ` FW: NPTL support on PPC32 (MPC5200) ? Dan Kegel
  2004-10-13  5:18   ` Jim Freeman
@ 2004-10-14  1:55   ` Jim Freeman
  1 sibling, 0 replies; 4+ messages in thread
From: Jim Freeman @ 2004-10-14  1:55 UTC (permalink / raw)
  To: Dan Kegel; +Cc: Stephen Warren, crossgcc, linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1880 bytes --]

The attached script (wrapper/setup to crosstool.sh) gets me
a toolchain sufficient to build the default-config ppc kernel
(2.6.8.1, NPTL, gcc-3.4.2, glibc-2.3.3).

It tweaks the patch Dan references below for a ppc-ism,
then adds a patch (thanks Google!) to mask an issue that
gcc-3.4.2 has with inline functions calling setjmp() ( see
http://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/ftp.suse.com/pub/projects/powerpc/ftp.linuxppc64.org/pub/people/janis/old/README.20040130
)

The toolchain build fails near the end while linking
build-glibc/elf/sln with undefined references to
`_Unwind_Resume' and `__gcc_personality_v0' (which Google
hints is/was a popular problem, but I don't have time to
track it down).  In any case, 'sln' isn't needed for kernel
building, so it's good enough for me for now.

...jfree
========

On Tue, Oct 12, 2004 at 08:29:58AM -0700, Dan Kegel wrote:
> Hi Stephen,
> to build NPTL, you need to apply 
> contrib/crosstool-0.28-rc34-nptl_fixes.patch
> Then see demo-x86_64-nptl.sh
> 
> Enough people need this that I've been intending for two weeks to merge it 
> asap,
> but I haven't gotten around to it.
> 
> That patch was only tested for x86, but ppc32 shouldn't be any
> harder, right? :-)
> - Dan
> 
> Stephen Warren wrote:
> >Hi. I'm attempting to use your crosstool to build a NPTL capable GLIBC
> >and toolchain for a 32-bit PowerPC target.
...
> >Thanks for any pointers at all!
> >
> >------------------------------------------------------------------------
> >
> >Subject: NPTL support on PPC32 (MPC5200) ?
> >From: "Stephen Warren" <SWarren@nvidia.com>
...
> >My question is - can anybody tell me, or point me at a website that
> >definitively tells me:
> >
> >1) Is NPTL available on PPC at all? I assume so, since I found one of
> >the original announcement of NPTL, which mentions performance on a large
> >SMP PPC system.
...

[-- Attachment #2: xgcc-booke --]
[-- Type: text/plain, Size: 2863 bytes --]

#!/bin/bash
set -x

# http://kegel.com/crosstool/
# http://sources.redhat.com/ml/binutils/2003-10/msg00448.html
# http://sources.redhat.com/ml/crossgcc/2004-03/msg00162.html
# http://sources.redhat.com/ml/binutils/2001-10/msg00186.html

## http://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/ftp.suse.com/pub/projects/powerpc/ftp.linuxppc64.org/pub/people/janis/old/README.20040130
## http://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/ftp.suse.com/pub/projects/powerpc/ftp.linuxppc64.org/pub/people/janis/old/glibc.patch.20040121 ;

[ ! -f  crosstool-0.28-rc37.tar.gz ] && \
	wget http://kegel.com/crosstool/crosstool-0.28-rc37.tar.gz || true

tar xzf crosstool-0.28-rc37.tar.gz

cd crosstool-0.28-rc37

pwd

## NPTL patch: when ARCH=ppc, dirname needs to be "powerpc"
## patch the patch ...

patch -p 0 <<HERE
--- contrib/crosstool-0.28-rc34-nptl_fixes.patch        2004/10/13 04:48:11    1.1
+++ contrib/crosstool-0.28-rc34-nptl_fixes.patch        2004/10/13 04:48:45
@@ -164,7 +164,7 @@
 +        # will have to manually be copied from under the tree of the desired
 +        # target pthread implementation.
 +        cp \${GLIBC_DIR}/nptl/sysdeps/pthread/pthread.h \$HEADERDIR/pthread.h
-+        cp \${GLIBC_DIR}/nptl/sysdeps/unix/sysv/linux/\${ARCH}/bits/pthreadtypes.h \$HEADERDIR/bits/pthreadtypes.h
++        cp \${GLIBC_DIR}/nptl/sysdeps/unix/sysv/linux/\${ARCH/ppc/powerpc}/bits/pthreadtypes.h \$HEADERDIR/bits/pthreadtypes.h
 +
 +        # On s390, powerpc and sparc we also require bits/wordsize.h.
 +        case \$TARGET in
HERE

# now apply the patch ...
patch -p 1 <  contrib/crosstool-0.28-rc34-nptl_fixes.patch

## gcc3.4.2 disallows setjmp() in inline functions:
## http://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/ftp.suse.com/pub/projects/powerpc/ftp.linuxppc64.org/pub/people/janis/old/README.20040130
## then fixup to only use first part of patch (and doctor for "patch -p1") ...

( cd patches/glibc-2.3.3;
        wget http://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/ftp.suse.com/pub/projects/powerpc/ftp.linuxppc64.org/pub/people/janis/old/glibc.patch.20040121 ;
        ed glibc.patch.20040121 <<HERE
/Makefile
.,\$d
,s#sysdeps#foo/sysdeps#g
wq
HERE
)

TARBALLS_DIR=`pwd`/..	\
TARGET=powerpc-8540-linux-gnu   \
TARGET_CFLAGS="-O -msoft-float -mno-string -Wa,-me500"  \
GCC_EXTRA_CONFIG=""     \
GCC_LANGUAGES="c"       \
GLIBC_EXTRA_CONFIG="--without-fp"       \
GLIBC_ADDON_NPTL=1	\
BINUTILS_DIR=binutils-2.15      \
GCC_DIR=gcc-3.4.2       \
GLIBC_DIR=glibc-2.3.3   \
LINUX_DIR=linux-2.6.8.1 \
        ./all.sh  --testlinux

	# now,
	#  cd build/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/linux-2.6.8.1
	# ( or wherever your kernel of interest lives )
	#  make V=1 ARCH=ppc CROSS_COMPILE=/work/src/crosstool-0.28-rc37/result/powerpc-8540-linux-gnu/gcc-3.4.2-glibc-2.3.3/bin/powerpc-8540-linux-gnu-

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-14  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <DBFABB80F7FD3143A911F9E6CFD477B0021B045A@hqemmail02.nvidia.com>
2004-10-12 15:29 ` FW: NPTL support on PPC32 (MPC5200) ? Dan Kegel
2004-10-13  5:18   ` Jim Freeman
2004-10-13  5:42     ` Jim Freeman
2004-10-14  1:55   ` Jim Freeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).