linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Some Cross Compiling Questions
@ 1999-07-14 15:41 Grant Carter
  1999-07-14 18:04 ` Daniel Jacobowitz
  1999-07-15 10:12 ` Marcus Sundberg
  0 siblings, 2 replies; 3+ messages in thread
From: Grant Carter @ 1999-07-14 15:41 UTC (permalink / raw)
  To: linuxppc-dev


Hi all

I am very new at using the GNU tools and cross compilers etc and am
wanting to compile Linux for the RPXLite Board running a PowerPC 823. I
have gone throught the CrossGCC FAQ as well as a document on Cross
Development for Linux/PPC but I still have a few questions/problems
which I hope someone can help me with please.

I am running an i386-FreeBSD system and, as I said before, am wanting to
build a PowerPC-linux system. I have built binutils-2.9.1.0.25 and
egcs-1.1.2 successfully and have used that to build the LinuxPPC kernel
(2.2.5). Everything compiled fine but I want to know 2 things: I have
read about libgcc.o and was wondering if I had to provide my own one or
if gcc knew enough about the 823 to build its own. Secondly, how do I
get floating point emulation running as the 823 doesn't provide hardware
floating point. I saw a --nfp in the configuration options - should I
enable this?

Next I tried to compile both glibc which failed. The error message was
as follows:

../sysdeps/powerpc/s_isnan.c: In function `__isnan':
../sysdeps/powerpc/s_isnan.c:32: fixed or forbidden register 32 (0) was
spilled for class FLOAT_REGS. This may be due to a compiler bug or to
impossible asm statements or clauses.

Is this related to my needing the correct libgcc.o file so that the
assembler knows how to implement these functions or what?

I also tried newlib 1.8.1 and newlib 1.7.1. They were complaining about
crt1.0 and crt1.s respectively. I believe that I need one of these files
built for my target platform. Can someone provide me with one or do I
have to write my own? If so, can someone please point me in the
direction of some documentation about the contents of these files? 

Thanks in advance
Grant

-- 
Grant Carter                              gcarter@eng.uct.ac.za
Department of Electrical Engineering      University of Cape Town
Tel: +27 (0)21 650-3467                   Fax: +27 (0)21 650-3465
                     "Coffee not found - operator halted!"

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

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

* Re: Some Cross Compiling Questions
  1999-07-14 15:41 Some Cross Compiling Questions Grant Carter
@ 1999-07-14 18:04 ` Daniel Jacobowitz
  1999-07-15 10:12 ` Marcus Sundberg
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 1999-07-14 18:04 UTC (permalink / raw)
  To: Grant Carter; +Cc: linuxppc-dev


On Wed, Jul 14, 1999 at 05:41:33PM +0200, Grant Carter wrote:
> 
> Hi all
> 
> I am very new at using the GNU tools and cross compilers etc and am
> wanting to compile Linux for the RPXLite Board running a PowerPC 823. I
> have gone throught the CrossGCC FAQ as well as a document on Cross
> Development for Linux/PPC but I still have a few questions/problems
> which I hope someone can help me with please.
> 
> I am running an i386-FreeBSD system and, as I said before, am wanting to
> build a PowerPC-linux system. I have built binutils-2.9.1.0.25 and
> egcs-1.1.2 successfully and have used that to build the LinuxPPC kernel
> (2.2.5). Everything compiled fine but I want to know 2 things: I have
> read about libgcc.o and was wondering if I had to provide my own one or
> if gcc knew enough about the 823 to build its own. Secondly, how do I
> get floating point emulation running as the 823 doesn't provide hardware
> floating point. I saw a --nfp in the configuration options - should I
> enable this?

You want -msoft-float.  Most likely when you build egcs it will build a
bunch of files in subdirectories named nof.  These are used when you
specify -msoft-float on the command line.

> Next I tried to compile both glibc which failed. The error message was
> as follows:
> 
> ../sysdeps/powerpc/s_isnan.c: In function `__isnan':
> ../sysdeps/powerpc/s_isnan.c:32: fixed or forbidden register 32 (0) was
> spilled for class FLOAT_REGS. This may be due to a compiler bug or to
> impossible asm statements or clauses.
> 
> Is this related to my needing the correct libgcc.o file so that the
> assembler knows how to implement these functions or what?

Bad version of gcc.  Try the latest 2.95 snapshots.

> I also tried newlib 1.8.1 and newlib 1.7.1. They were complaining about
> crt1.0 and crt1.s respectively. I believe that I need one of these files
> built for my target platform. Can someone provide me with one or do I
> have to write my own? If so, can someone please point me in the
> direction of some documentation about the contents of these files? 

crt*.o come partly with glibc and partly with egcs; crt1.o is from
glibc.  I would expect newlib to have it.

Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

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

* Re: Some Cross Compiling Questions
  1999-07-14 15:41 Some Cross Compiling Questions Grant Carter
  1999-07-14 18:04 ` Daniel Jacobowitz
@ 1999-07-15 10:12 ` Marcus Sundberg
  1 sibling, 0 replies; 3+ messages in thread
From: Marcus Sundberg @ 1999-07-15 10:12 UTC (permalink / raw)
  To: Grant Carter; +Cc: linuxppc-dev

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

Grant Carter wrote:
> 
> Hi all
> 
> I am very new at using the GNU tools and cross compilers etc and am
> wanting to compile Linux for the RPXLite Board running a PowerPC 823. I
> have gone throught the CrossGCC FAQ as well as a document on Cross
> Development for Linux/PPC but I still have a few questions/problems
> which I hope someone can help me with please.
> 
> I am running an i386-FreeBSD system and, as I said before, am wanting to
> build a PowerPC-linux system. I have built binutils-2.9.1.0.25 and
> egcs-1.1.2 successfully and have used that to build the LinuxPPC kernel
> (2.2.5). Everything compiled fine but I want to know 2 things: I have
> read about libgcc.o and was wondering if I had to provide my own one or
> if gcc knew enough about the 823 to build its own.

To build libgcc gcc must find some of the C-library include files.
But you can't build the C-library until you have a compiler...
I don't rember exectly how I solved this as it was a long time since
I did a rebuild from scratch, but basicly you have to do a "multipass"
installation, first compile and install gcc without libgcc, then get
the necessary include files out of glibc and install them, and finally
build the rest of gcc with libgcc and such.

> Secondly, how do I
> get floating point emulation running as the 823 doesn't provide hardware
> floating point. I saw a --nfp in the configuration options - should I
> enable this?

Using --nfp and --with-cpu=823 when compiling egcs will make it generate
soft float code by default, but it will _NOT_ make _SOFT_FLOAT be defined
in the preprocessor by default, unless you hack the specs file. This caused
me great confusion as the va_* variable argument macros check for the
_SOFT_FLOAT define to know whether floating point arguments are in fp
registers or in memory. As the compiler doesn't use this define things
will get really messed up when you pass float arguments to things like
printf().

The simple solution is to _not_ use --nfp and pass -msoft-float to gcc
when compiling PPC code instead.

> Next I tried to compile both glibc which failed. The error message was
> as follows:
> 
> ../sysdeps/powerpc/s_isnan.c: In function `__isnan':
> ../sysdeps/powerpc/s_isnan.c:32: fixed or forbidden register 32 (0) was
> spilled for class FLOAT_REGS. This may be due to a compiler bug or to
> impossible asm statements or clauses.

I believe it is a compiler bug, but this file should not be used anyway
if you want to have a soft float glibc.

Note that there are two kinds of people here:
Those that (like me) want to use MPC8xx processors as purely embedded
processors, compiling all libraries and apps themselves with -msoft-float,
and only doing cross-development.
And then those that want full floating point emulation in the kernel
in order to use normal PPC binaries and libraries, and who wants to
do native development on 8xx boards.

I don't consider any method "right", it's simply matter of taste and
of the particulart application you want to use your 8xx board for.
Therefore I believe that both the kernel (I already know one person
working on full fp emulation) and glibc should allow both ways by
the means of a simple config option.

As for glibc and embedded powerpc the very least you have to do is
to move sysdeps/powerpc/memset.S out of the way and apply this diff:
diff -ur orig/glibc-2.1.1/sysdeps/powerpc/dl-machine.c glibc-2.1.1/sysdeps/powerpc/dl-machine.c
--- orig/glibc-2.1.1/sysdeps/powerpc/dl-machine.c	Fri Mar  5 23:41:23 1999
+++ glibc-2.1.1/sysdeps/powerpc/dl-machine.c	Mon May 17 20:59:06 1999
@@ -250,7 +250,11 @@
 	 PowerPC processors have line sizes of exactly 32 bytes.  */
 
       size_modified = lazy ? rel_offset_words : PLT_INITIAL_ENTRY_WORDS;
+#ifdef PPC_CACHELINESIZE_32
       for (i = 0; i < size_modified; i+= 8)
+#else
+      for (i = 0; i < size_modified; i+= 4)
+#endif
 	PPC_DCBST (plt + i);
       PPC_DCBST (plt + size_modified - 1);
       PPC_SYNC;

This will fix the infamous cache line size problem.
If you want a soft float library (incompatible with normal PPC binaries)
you need to pipe this diff though the attached script:

diff -ur orig/glibc-2.1.1/sysdeps/powerpc/Dist glibc-2.1.1/sysdeps/powerpc/Dist
--- orig/glibc-2.1.1/sysdeps/powerpc/Dist	Tue Sep 15 00:57:08 1998
+++ glibc-2.1.1/sysdeps/powerpc/Dist	Tue May  4 17:00:33 1999
@@ -1,7 +1,3 @@
 dl-machine.c
 dl-start.S
-fenv_const.c
-fenv_libc.h
 ppc-mcount.S
-fe_nomask.c
-t_sqrt.c
diff -ur orig/glibc-2.1.1/sysdeps/powerpc/Makefile glibc-2.1.1/sysdeps/powerpc/Makefile
--- orig/glibc-2.1.1/sysdeps/powerpc/Makefile	Wed Nov 18 00:48:00 1998
+++ glibc-2.1.1/sysdeps/powerpc/Makefile	Tue May  4 17:01:07 1999
@@ -1,7 +1,3 @@
-ifeq ($(subdir),math)
-libm-support += fenv_const fe_nomask t_sqrt
-endif
-
 ifeq ($(subdir),gmon)
 sysdep_routines += ppc-mcount
 endif

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

[-- Attachment #2: glibcpatch --]
[-- Type: text/plain, Size: 940 bytes --]

#!/bin/sh

FPUFILES="
Versions
bits/fenv.h
bits/mathdef.h
bits/mathinline.h
e_sqrt.c
e_sqrtf.c
fclrexcpt.c
fe_nomask.c
fegetenv.c
fegetround.c
feholdexcpt.c
fenv_const.c
fenv_libc.h
fesetenv.c
fesetround.c
feupdateenv.c
fgetexcptflg.c
fpu_control.h
fraiseexcpt.c
fsetexcptflg.c
ftestexcept.c
s_copysign.S
s_copysignf.S
s_fabs.S
s_fabsf.S
s_fmax.S
s_fmaxf.S
s_fmin.S
s_fminf.S
s_isnan.c
s_isnanf.S
s_lrint.c
s_lrintf.S
s_rint.c
s_rintf.c
t_sqrt.c
w_sqrt.c
w_sqrtf.c
"

FPUDISTFILES="fenv_const.c
fenv_libc.h
fe_nomask.c
t_sqrt.c
"

MAKEFILE='-ifeq ($(subdir),math)
-libm-support += fenv_const fe_nomask t_sqrt
-endif'

patch -p1

cd sysdeps/powerpc #|| exit 1
mkdir -p fpu/bits || exit 2

for a in $FPUFILES; do
  mv "$a" "fpu/$a" && echo "Moved $a -> fpu/$a"
done

fail=
for a in $FPUDISTFILES; do
  echo "$a" >> fpu/Dist || fail=1
done
test "$fail" || echo "Created fpu/Dist"

echo "$MAKEFILE" >fpu/Makefile && echo "Created fpu/Makefile"

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

end of thread, other threads:[~1999-07-15 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-14 15:41 Some Cross Compiling Questions Grant Carter
1999-07-14 18:04 ` Daniel Jacobowitz
1999-07-15 10:12 ` Marcus Sundberg

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).