Subject: Cross compiling on a linux pc

From: Joseph Heenan <[email-masked]>
Date: Sat, 01 Feb 1997 12:07:16 +0000

Hi,

I'm having problems trying to get an arm-linux kernel to compile -
I've grabbed the patches of the ftp site against linux 2.0.28,
applied them, download the cross-compiler, binutils and libgcc
and stuck them in what seems to be the appropriate place in
/usr/local/, and changed the makefile so that the CROSS_COMPILE
variable is /usr/local/bin/arm-linux-

make config, make dep and make clean seem to work fine, but when I
get to make, I get:

/usr/local/bin/arm-linux-gcc -D__KERNEL__ -I/usr/src/armlinux/include
 -m6 -Wall -Wstrict-prototypes -O2  -fno-strength-reduce -pipe 
 -c -o init/main.o init/main.c
Assembler messages:
Fatal error: invalid listing option `r'
init/main.c: In function `get_options':
init/main.c:244: output pipe has been closed
arm-linux-gcc: Internal compiler error: program cc1 got fatal signal 13
make: *** [init/main.o] Error 1
bluetac:/usr/src/armlinux# cpp: output pipe has been closed

Any ideas what I'm doing wrong?
Or is just that the cross-compiler on the ftp site too old to use for
a recent kernel?

Thanks,

-- 
Joseph Heenan
email: [email-masked], [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Sat, 1 Feb 1997 13:00:06 +0000 (GMT)

> Or is just that the cross-compiler on the ftp site too old to use for

I doubt much has changed.  Can you rerun that command adding -v to the gcc
commandline, so we can check that it's picking up the right version of the
assembler?

It's possible that gcc is looking at /usr/arm-linux/bin/as for the
assembler, not finding it, and defaulting to the Intel assembler.  You may
need to make a symlink from /usr/local/arm-linux to /usr/arm-linux if this
is the case.

P.

---

From: Joseph Heenan <[email-masked]>
Date: Sat, 01 Feb 1997 16:09:27 +0000

> need to make a symlink from /usr/local/arm-linux to /usr/arm-linux if this

Well, it seemed to be looking for /usr/local/lib/gcc-lib/arm-linux/2.6.0/as,
so I symlinked that to /usr/local/bin/arm-linux-as

I know get the following:

bluetac:/usr/src/armlinux# make
/usr/local/bin/arm-linux-gcc -v -D__KERNEL__ -I/usr/src/armlinux/include
 -m6 -Wall -Wstrict-prototypes -O2  -fno-strength-reduce -pipe  -c -o
  init/main.o init/main.c
Reading specs from /usr/local/lib/gcc-lib/arm-linux/2.6.0/specs
gcc version 2.6.0
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/cpp -lang-c -v
 -I/usr/src/armlinux/include -undef -D__GNUC__=2 -D__GNUC_MINOR__=6
 -Dunix -Darm -Dlinux -D__unix__ -D__arm__ -D__linux__ -D__unix -D__arm
 -D__linux -Asystem(unix) -Asystem(posix) -Acpu(arm) -Amachine(arm)
 -D__OPTIMIZE__ -Wall -Wstrict-prototypes -D__arm6__ -D__KERNEL__
 init/main.c |
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/cc1 -quiet -dumpbase main.c
  -m6 -O2 -Wall -Wstrict-prototypes -version -fno-strength-reduce -o - |
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/as -marm6 -o init/main.o
GNU CPP version 2.6.0 (ARM/Linux)
#include "..." search starts here:
#include <...> search starts here:
 /usr/src/armlinux/include
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/include
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/sys-include
 /usr/local/arm-linux/include
End of search list.
GNU C version 2.6.0 (ARM/Linux) compiled by GNU C version 2.6.3.
{standard input}: Assembler messages:
{standard input}:850: Error: Garbage following instruction --
statement `bne 1f'

{standard input}:856: Error: Rest of line ignored. First ignored
character is `1 '. {standard input}:1134: Error: Garbage following
instruction -- statement `bne 1f '

{standard input}:1140: Error: Rest of line ignored. First ignored
character is ` 1'. {standard input}:1148: Error: Garbage following
instruction -- statement `bne 1f '

{standard input}:1154: Error: Rest of line ignored. First ignored
character is ` 1'. {standard input}:1276: Error: Garbage following
instruction -- statement `bne 1f '

{standard input}:1282: Error: Rest of line ignored. First ignored
character is ` 1'. {standard input}:1323: Error: Garbage following
instruction -- statement `bne 1f '

{standard input}:1329: Error: Rest of line ignored. First ignored
character is ` 1'. make: *** [init/main.o] Error 1

Erm...?

I'm afraid I have absolutely no idea about gcc internals, so any
help is appreciated!

[Have I missed any instructions about what to do with the
 stuff in the cross compile stuff on the ftp site? I seemed to have
 had to just guess about where things should be put :-( ]

---

From: Philip Blundell <[email-masked]>
Date: Sat, 1 Feb 1997 16:42:42 +0000 (GMT)

> I'm afraid I have absolutely no idea about gcc internals, so any

Ugh. 

I'll have to take a look at the cross-compiler myself to figure that one
out, I think.  It looks like all the right things are getting run now, but
as is rejecting (valid) input.

You could try again without -m6 - it could be that the binutils is too old
to generate ARM6 code.  Admittedly you won't get working code that way,
but it would at least tell you where the problem is.

I think gcc 2.7.2 works without patches, but to use a newer binutils
you'll have to hack it around a bit. 

P.

---

From: Philip Blundell <[email-masked]>
Date: Sat, 1 Feb 1997 17:02:49 +0000 (GMT)

> but it would at least tell you where the problem is.

I was wrong about this; -m6 works fine for me.

kings-cross:~$ gcc -m6 -b arm-linux -V 2.6.0 -v hellow.c
Reading specs from /usr/lib/gcc-lib/arm-linux/2.6.0/specs
gcc driver version 2.7.2 executing gcc version 2.6.0
 /usr/lib/gcc-lib/arm-linux/2.6.0/cpp -lang-c -v -undef -D__GNUC__=2
-D__GNUC_MINOR__=6 -Dunix -Darm -Dlinux -D__unix__ -D__arm__ -D__linux__
-D__unix -D__arm -D__linux -Asystem(unix) -Asystem(posix) -Acpu(arm)
-Amachine(arm) -D__arm6__ hellow.c /tmp/cca16647.i
GNU CPP version 2.6.0 (ARM/Linux)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/include
 /usr/local/lib/gcc-lib/arm-linux/2.6.0/sys-include
 /usr/local/arm-linux/include
End of search list.
 /usr/lib/gcc-lib/arm-linux/2.6.0/cc1 /tmp/cca16647.i -quiet -dumpbase
hellow.c -m6 -version -o /tmp/cca16647.s
GNU C version 2.6.0 (ARM/Linux) compiled by GNU C version 2.6.3.
 /usr/arm-linux/bin/as -marm6 -o /tmp/cca166471.o /tmp/cca16647.s
 /usr/arm-linux/bin/ld /usr/lib/crt0.o -L/usr/lib/gcc-lib/arm-linux/2.6.0
-L/usr/arm-linux/lib /tmp/cca166471.o -lgcc -lc -lgcc
/usr/arm-linux/bin/ld: cannot open /usr/lib/crt0.o: No such file or
directory
kings-cross:~$

What does `/usr/local/lib/gcc-lib/arm-linux/2.6.0/as --version' tell you?

My arm-linux as is:

	GNU assembler version 940921 (arm-aout), using BFD version cygnus-2.3

P.

---

From: Philip Blundell <[email-masked]>
Date: Sat, 1 Feb 1997 17:14:14 +0000 (GMT)

On Sat, 1 Feb 1997, Philip Blundell wrote:

> -m6 works fine for me.

On further investigation, this isn't strictly true either.  It works for
trivial programs, but now I've installed the kernel source I'm seeing the
same problems that you were.

More when we have it. 

P.

---

From: Philip Blundell <[email-masked]>
Date: Sat, 1 Feb 1997 17:19:33 +0000 (GMT)

> {standard input}:850: Error: Garbage following instruction --

As far as I can tell, this is an assembler bug.  I'm sure I've had this
working before, but I can't remember how at the moment.

I have put a binary of a newer gas for arm-aout at

	ftp://ftp.london.uk.eu.org/pub/arm/arm-aout-as

- you could try installing this in place of the as you currently have.
I'm not totally sure what the differences in output between this and
Russell's gas are, so it may or not work.

P.

---

From: Joseph Heenan <[email-masked]>
Date: Sat, 01 Feb 1997 20:30:01 +0000

> Russell's gas are, so it may or not work.

Ah - thankyou - I've got that, and the kernel at least appears to
be compiling now - I wonder if I'll get as far as getting one to
boot, though...

Thanks,

[oh - might be worth getting the new 'as' put on ftp.ecs.soton?]

---

From: [email-masked]
Date: Sat, 1 Feb 1997 19:13:28 +0000 (GMT)

> > {standard input}:850: Error: Garbage following instruction --

These errors are caused due to a bug in the configuration setup used to
compile the assembler for arm-unknown-linuxaout on an i386-unknown-linux
system.  (A #define was in the host-specific header file that was supposed
to be in the target-specific header file).

This problem has been rectified in the gas-940921 code by myself, and I'm
currently working on the binutils-2.7 code to get it together.

Once uploaded, the correct versions are:
	kernel source:	2.0.28
	gcc		2.7.2
	binutils:	2.7

Note, however, that there will be two patches for binutils - one to add a
few extra instructions for the StrongARM, and one as the main ARM Linux
patches for it.
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |       Russell King      [email-masked]         --- ---
  | | | | http://whirligig.ecs.soton.ac.uk/~rmk92/home.html  /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |      *  who wishes that he was in Hong Kong  *      ---  |
    +-+-+ -------------------------------------------------  /\\\  |