This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Help with -march and -mcpu issues


Hi. I'm using GCC to target an ARM (XScale) processor. I've successfully built code that runs on the target hardware, but I'm trying to understand better some of the nuances.

I should point out that I've asked this question on the GNUARM list and gotten no responses.

I have a very simple situation. A single main.c and start.S are compiled, then linked using ld, then stripped with objcopy and finally downloaded to the target. However, if I add -march=armv5te, I get a very puzzling error. Here are the basic invocations:

$ arm-elf-gcc -c main.c -o main.o
$ arm-elf-ld  -e _start -o h.elf --script=link.lds start.o main.o
$ arm-elf-objcopy --output-target=binary --gap-fill=0xff h.elf h

The resulting file "h" works very well.

However, if I add -mcpu=xscale or -march=armv5te to the gcc line, I get errors like this:

arm-elf-ld: ERROR: main.o uses VFP instructions, whereas h.elf does not

What's puzzling to me about this is that h.elf is what's being built by ld. Presumably there's an option to ld to make it recognize the architecture, but I'm not sure what it is. I tried to change the build steps to call gcc instead of ld, as follows (although I'm not at all sure this is the correct approach):

$ arm-elf-gcc -ffreestanding -nostdlib -std=c99 \
	-Xlinker -e -Xlinker _start -Xlinker --script=link.lds \
	-v -o h.elf start.o main.o


Which seems to have produced the exact same final output (after objcopy). However, when I added -march=armv5e to the gcc invocations, I still get the error about VFP instructions.



I sure hope there's a GCC guru out there who can enlighten me. Thanks!


--
Rick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]