From: Dr. Craig Hollabaugh <hidden> Date: 2001-08-16 02:35:41
Folks,
I've spend two days scouring the postings here and read much as I can find on cross compiling
glibc with no fpu options. I've read all kinds of things, compiled for hours, but nothing. I've been somewhat unsuccessful, I'm close to giving up but that's why I'm writing.
I can compile glibc-2.2.3 (no mention of no fpu on configure) but bash segment
faults (actually init respawns to fast). I can get bash running if I use the montavista compiled glibc* from their rpm. So I know that my kernel/filesystem works etc. But still I want to compile glibc for 8xx myself.
Here's my configure line
SRCFILELOC=/root/cross/
BUILDLOC=/root/cross/builds
PREFIX=/usr
ARCH=ppc
TARGET=powerpc-linux
CC=$TARGET-gcc CFLAGS="-msoft-float -D_SOFT_FLOAT -mcpu=860" \
../$GLIBVERSION/configure $TARGET --build=i586-linux \
--prefix=$PREFIX/$TARGET \
--enable-add-ons \
-without-fp
I get this error (I'm not the first one with this error,
http://lists.linuxppc.org/linuxppc-embedded/200106/msg00178.html)
powerpc-linux-gcc -msoft-float ../sysdeps/powerpc/fclrexcpt.c -c -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g -mnew-mnemonics -Wa,-mppc -mpowerpc -fpic -Wno-uninitialized -I../include -I. -I/root/cross/builds/powerpc-linux-glibc/math -I.. -I../libio -I/root/cross/builds/powerpc-linux-glibc -I../sysdeps/powerpc/elf -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/powerpc -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/powerpc/soft-fp -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -D_LIBC_REENTRANT -include ../include/l!
ibc-symbols.h -DPIC -DSHARED -I../soft-fp/ -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -DNO_LONG_DOUBLE -D_Mlong_double_=double -o /root/cross/builds/powerpc-linux-glibc/math/fclrexcpt.os
../sysdeps/powerpc/fclrexcpt.c:20: fenv_libc.h: No such file or directory
I fooled around a bit trying to pass the Ipath to gcc for fenv_libc.h. But didn't figure that out.
I then tried compiling the montavista glibc source but get errors because I don't know which of the 10 patches to apply. I've tried using compiled libs from debian but bash seg faults ( I guess because debian glibc is compiled with fpu).
That's when I figured I should write and ask these questions.
Has anyone cross compiled glibc2.2.3 successfully for the 8xx (no fpu)?
Did you use the GNU source or did you use the MontaVista source?
If you use the MontaVista source, which patches did you apply and in what order?
What's your configure line?
Once you got glibc compiled, how did you check the fpu operation? Printing pi or what?
I'm at a loss. Any ideas? I'm stuck and would really like some suggestions.
Thanks for any help.
Craig
___________________________________________________________
Dr. Craig Hollabaugh craig@hollabaugh.com
304 6th Avenue, P.O. Box 1405
Ouray, CO 81427-1405 See my "kitchen sink" resume at
970 325 0319 home www.hollabaugh.com/resume.html
970 325 0509 office
215 882 1880 cell
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Hi, did you consider the cache line size.
Glibc for powerpc-linux is written for 32 byte cache-line size.
As far as I know, only 8xx CPU has the cache whose line size is 16byte.
This discrepancy usually affects dynamic linking mechanism and results in illegal instruction.
You can check this point by looking into sysdeps/powerpc/dl-machine.c.
There will be PPC_DCBST macro. It should be called at every four long word.
(I didn't see 2.2.3 but 2.1.2 version had a problem like that.)
If it is called at every eight long word, it should be modified.
You can also check this point indirectly. Link bash statically and try to run it.
If it is OK, then it is dynamic linking problem. It might be cache-line size problem.
Good luck.
-- Seungdong Lee
----- Original Message -----
From: Dr. Craig Hollabaugh <redacted>
To: <redacted>
Sent: Thursday, August 16, 2001 11:35 AM
Subject: cross compiling 8xx glibc on x86
Folks,
I've spend two days scouring the postings here and read much as I can find on cross compiling
glibc with no fpu options. I've read all kinds of things, compiled for hours, but nothing. I've been somewhat unsuccessful, I'm close to giving up but that's why I'm writing.
I can compile glibc-2.2.3 (no mention of no fpu on configure) but bash segment
faults (actually init respawns to fast). I can get bash running if I use the montavista compiled glibc* from their rpm. So I know that my kernel/filesystem works etc. But still I want to compile glibc for 8xx myself.
Here's my configure line
SRCFILELOC=/root/cross/
BUILDLOC=/root/cross/builds
PREFIX=/usr
ARCH=ppc
TARGET=powerpc-linux
CC=$TARGET-gcc CFLAGS="-msoft-float -D_SOFT_FLOAT -mcpu=860" \
../$GLIBVERSION/configure $TARGET --build=i586-linux \
--prefix=$PREFIX/$TARGET \
--enable-add-ons \
-without-fp
I get this error (I'm not the first one with this error,
http://lists.linuxppc.org/linuxppc-embedded/200106/msg00178.html)
powerpc-linux-gcc -msoft-float ../sysdeps/powerpc/fclrexcpt.c -c -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g -mnew-mnemonics -Wa,-mppc -mpowerpc -fpic -Wno-uninitialized -I../include -I. -I/root/cross/builds/powerpc-linux-glibc/math -I.. -I../libio -I/root/cross/builds/powerpc-linux-glibc -I../sysdeps/powerpc/elf -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/powerpc -I../sysdeps/unix/sysv/linux/powerpc -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/powerpc -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/powerpc -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/powerpc/soft-fp -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -D_LIBC_REENTRANT -include ../include!
/l!
ibc-symbols.h -DPIC -DSHARED -I../soft-fp/ -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -DNO_LONG_DOUBLE -D_Mlong_double_=double -o /root/cross/builds/powerpc-linux-glibc/math/fclrexcpt.os
../sysdeps/powerpc/fclrexcpt.c:20: fenv_libc.h: No such file or directory
I fooled around a bit trying to pass the Ipath to gcc for fenv_libc.h. But didn't figure that out.
I then tried compiling the montavista glibc source but get errors because I don't know which of the 10 patches to apply. I've tried using compiled libs from debian but bash seg faults ( I guess because debian glibc is compiled with fpu).
That's when I figured I should write and ask these questions.
Has anyone cross compiled glibc2.2.3 successfully for the 8xx (no fpu)?
Did you use the GNU source or did you use the MontaVista source?
If you use the MontaVista source, which patches did you apply and in what order?
What's your configure line?
Once you got glibc compiled, how did you check the fpu operation? Printing pi or what?
I'm at a loss. Any ideas? I'm stuck and would really like some suggestions.
Thanks for any help.
Craig
___________________________________________________________
Dr. Craig Hollabaugh craig@hollabaugh.com
304 6th Avenue, P.O. Box 1405
Ouray, CO 81427-1405 See my "kitchen sink" resume at
970 325 0319 home www.hollabaugh.com/resume.html
970 325 0509 office
215 882 1880 cell
From: Mark Hatle <hidden> Date: 2001-08-16 03:28:30
../sysdeps/powerpc/fclrexcpt.c:20: fenv_libc.h: No such file or directory
That error is due to glibc not being setup to run w/o floating point on
PowerPC.
I fooled around a bit trying to pass the Ipath to gcc for fenv_libc.h. But didn't figure that out.
Look at the patch titled "hhl-powerpc-fpu.patch". This will move the
files to where they need to be for it to work right. It will also
remove the floating point loads/saves in the setjmp/longjmp call.
To find out the order of the patches that we apply, just look at the
%build section, they are layed out in the order in which they are
applied for our product.
Has anyone cross compiled glibc2.2.3 successfully for the 8xx (no fpu)?
HHL 2.0 is based on glibc2.2.3pre1 (due to release schedules). But we
do have glibc-2.2.3 release working in house, it was trivial since
2.2.3pre1 was already done.
Did you use the GNU source or did you use the MontaVista source?
I use MontaVista's Source.. <grin>
If you use the MontaVista source, which patches did you apply and in what order?
What's your configure line?
Once you got glibc compiled, how did you check the fpu operation? Printing pi or what?
The easiest way is to build bash and use the builtin (shell) printf
command and see if it prints out "nan" or the number. If you get the
number it is working correctly.
One side note, you don't really need the no floating point patches, if
you are willing to live with the emulation overhead it works fine in the
kernel.
However, on the 8xx there is one thing that you can not "live w/o"
doing. Specifically you must either "fix" or (easy way) delete the
sysdeps/powerpc/memset.S file. This file is hard coded to 8 word wide
cache lines.. and the 8xx only has 4 words wide cache.
So... if you can live w/ emulation, do that it's easier.....
but regardless you will need to delete the sysdeps/powerpc/memset.S
file.
--Mark
BTW the memset.S is being worked on in the PowerPC community to allow
for various cacheline optimizations from (4 words) 8xx, to (16 words)
Power3/4 series.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Mark Hatle <hidden> Date: 2001-08-16 03:34:44
À̽µ¿(Seungdong Lee) wrote:
Hi, did you consider the cache line size.
Glibc for powerpc-linux is written for 32 byte cache-line size.
As far as I know, only 8xx CPU has the cache whose line size is 16byte.
Just as an FYI, the IBM PPC 403GCX and Motorola PPC 8xx series are the
onlys ones that are 4 word (16 bytes). The 405, 6xx, 7xx, 74xx, 82xx
series are all 8 words (32 bytes) and the Power3/4 are 16 words (64
bytes).
--Mark
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Dr. Craig Hollabaugh <hidden> Date: 2001-08-16 05:41:26
Mark,
Thanks for the speedy reply, do you guys sleep over there?
At 10:28 PM 8/15/2001 -0500, Mark Hatle wrote:
quoted
../sysdeps/powerpc/fclrexcpt.c:20: fenv_libc.h: No such file or directory
That error is due to glibc not being setup to run w/o floating point on
PowerPC.
quoted
I fooled around a bit trying to pass the Ipath to gcc for fenv_libc.h. But didn't figure that out.
Look at the patch titled "hhl-powerpc-fpu.patch". This will move the
files to where they need to be for it to work right. It will also
remove the floating point loads/saves in the setjmp/longjmp call.
Are you saying that applying hhl-powerpc-fpu.patch to 2.2.3 then configuring with
CC=$TARGET-gcc CFLAGS="-msoft-float -D_SOFT_FLOAT -mcpu=860" \
../$GLIBVERSION/configure $TARGET --build=i586-linux \
--prefix=$PREFIX/$TARGET \
--enable-add-ons \
-without-fp
should work?
Patching 2.2.3 with hhl-powerpc-fpu.patch succeeds but configure fails with
make[2]: *** No rule to make target `../sysdeps/powerpc/fpu_control.h', needed by `/root/cross/builds/powerpc-linux-glibc/csu/init-first.d'. Stop.
See next statement
To find out the order of the patches that we apply, just look at the
%build section, they are layed out in the order in which they are
applied for our product.
Are you talking about this?
Patch3: manual-texinfo4.dpatch
Patch4: ldd.dpatch
Patch5: glibcbug.dpatch
Patch6: hurd-ldflags.dpatch
Patch7: fhs-linux-paths.dpatch
Patch8: pthread_create-manpage.dpatch
Patch9: string2-pointer-arith.dpatch
Patch10: glibc22-nss-upgrade.dpatch
Patch11: glibc22-disable-static.dpatch
Patch12: glibc22-eo_EO.dpatch
Patch13: glibc22-getaddrinfo.dpatch
Patch30: glibc-rpc-cross.patch
Patch31: hhl-powerpc-fpu.patch
Patch32: hhl-powerpc-altivec.patch
Patch33: glibc-223pre1-fe_invalid.patch
Patch34: glibc-mips-abi.patch
Patch35: glibc22-27.patch
Patch36: hhl-mips-siginfo.patch
Patch37: hhl-glibc-2.2.3-config.patch
Patch38: glibc-2.2.3-sh.patch
Patch39: 405-atomicity.patch
A lot of these patches fail when applied to 2.2.3. I'm somewhat inexperienced here but I want to learn what's going on.
The easiest way is to build bash and use the builtin (shell) printf
command and see if it prints out "nan" or the number. If you get the
number it is working correctly.
Hmm, sounds simple but last night's all nighter is making me stupid. Can you
give an example of a floating point divide in bash using the printf statement?
One side note, you don't really need the no floating point patches, if
you are willing to live with the emulation overhead it works fine in the
kernel.
Are you talking about setting this CONFIG_MATH_EMULATION=y?
However, on the 8xx there is one thing that you can not "live w/o"
doing. Specifically you must either "fix" or (easy way) delete the
sysdeps/powerpc/memset.S file. This file is hard coded to 8 word wide
cache lines.. and the 8xx only has 4 words wide cache.
So... if you can live w/ emulation, do that it's easier.....
but regardless you will need to delete the sysdeps/powerpc/memset.S
file.
I can live with emulation. If so, should I just go back and recompile the tools,
after I remove all the fpu flags and remove memset.S? After that, do you think
a C program with printf("%f",22.0/7.0) will work?
Thanks again!
Craig
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
From: Mark Hatle <hidden> Date: 2001-08-16 14:39:31
"Dr. Craig Hollabaugh" wrote:
Mark,
Thanks for the speedy reply, do you guys sleep over there?
No.. we don't.. <grin>
Are you saying that applying hhl-powerpc-fpu.patch to 2.2.3 then configuring with
CC=$TARGET-gcc CFLAGS="-msoft-float -D_SOFT_FLOAT -mcpu=860" \
../$GLIBVERSION/configure $TARGET --build=i586-linux \
--prefix=$PREFIX/$TARGET \
--enable-add-ons \
-without-fp
should work?
yes it should.
Patching 2.2.3 with hhl-powerpc-fpu.patch succeeds but configure fails with
make[2]: *** No rule to make target `../sysdeps/powerpc/fpu_control.h', needed by `/root/cross/builds/powerpc-linux-glibc/csu/init-first.d'. Stop.
I just compared our 2.2.3pre1 and 2.2.3 release hhl-powerpc-fpu.patch
and they are identical. Obviously I am not getting that error. The
expanded configure line we use comes out be:
./configure --host=powerpc-hardhat-linux --build=i686-pc-linux-gnu
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
--libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/usr/share --mandir=/usr/share/man
--infodir=/usr/share/info --libexecdir=/usr/lib
--build=i686-pc-linux-gnu --enable-add-ons --without-cvs --without-fp
Obviously you will not need most of the things setting the various
prefixes.. but you will need the --host, --build, --enable-add-ons,
--without-fp (ignore the second --build above.. configure evaluates the
last --build passed in.. it's an artifact of our build system...)
As for the CC, we set it to our compiler as the norm... and we do not
set CFLAGS, but we have slightly modified gcc to default to
-msoft-float.
See next statement
quoted
To find out the order of the patches that we apply, just look at the
%build section, they are layed out in the order in which they are
applied for our product.
Are you talking about this?
Patch3: manual-texinfo4.dpatch
...
Patch39: 405-atomicity.patch
A lot of these patches fail when applied to 2.2.3. I'm somewhat inexperienced here but I want to learn what's going on.
No.. go further down and look for "%prep". This section of the .spec
file indicates what to do to "prep" the package for building.
As I said, the released version is 2.2.3pre1, very few changes have been
made to 2.2.3 release, so you may have to manually apply some of the
patches.
Also the patches 30-39 are the montavista specific patches. The other
ones you probably do not need.
The easiest way is to build bash and use the builtin (shell) printf
quoted
command and see if it prints out "nan" or the number. If you get the
number it is working correctly.
Hmm, sounds simple but last night's all nighter is making me stupid. Can you
give an example of a floating point divide in bash using the printf statement?
Don't even need to do a floating point divide. Just using floating
point.. i.e. "printf %f 1.01" will return "nan" (or crash) if
soft-floating point is not working.. it will return 1.010000 if
floating point is working right.
quoted
One side note, you don't really need the no floating point patches, if
you are willing to live with the emulation overhead it works fine in the
kernel.
Are you talking about setting this CONFIG_MATH_EMULATION=y?
yes.
quoted
However, on the 8xx there is one thing that you can not "live w/o"
doing. Specifically you must either "fix" or (easy way) delete the
sysdeps/powerpc/memset.S file. This file is hard coded to 8 word wide
cache lines.. and the 8xx only has 4 words wide cache.
So... if you can live w/ emulation, do that it's easier.....
but regardless you will need to delete the sysdeps/powerpc/memset.S
file.
I can live with emulation. If so, should I just go back and recompile the tools,
after I remove all the fpu flags and remove memset.S? After that, do you think
a C program with printf("%f",22.0/7.0) will work?
It should. One thing to keep in mind. -msoft-float changes the ABI, so
you can not switch back and forth while running the system. Either
everything has to be -msoft-float, or nothing should be -msoft-float.
As you can see, building/reproducing a working toolchain with everything
configured "just right" isn't exactly the easiest thing to do. :) It
is fairly straight forward, but once you have done it a few thousand
times it becomes much easier.
--Mark
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/