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]

Re: Help with -march and -mcpu issues



On Aug 29, 2007, at 6:49 PM, Brian Dessent wrote:


Rick Mann wrote:

$ 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

You should ask this on the binutils list. The linker is not provided by
nor part of gcc, and your question seems to be about the linker.

You're absolutely right, binutils seems to be more appropriate.


Where does start.o come from? Are you not also rebuilding it with the
given -march? I'm guessing that the reason you get the error is that
the linker sees two objects that were built with different -march
settings (or rather one with the default and another with something
else), and that's why it's complaining. But that's just speculation, I
don't actually know.

Sorry, I meant to sanitize that out. I have a simple file start.S which provides a bit of glue and BSS clearing before calling main. It's also built with the same -march setting.


The thing that bugs me, again, is that it's complaining about differences between the .o files and the thing it's linking the .o files into, which is made up only of those .o files!

$ arm-elf-gcc -march=armv5te -ffreestanding -nostdlib -std=c99 - Xlinker -e -Xlinker _start -Xlinker --script=link.lds -o h.elf start.o main.o -lgcc -lc -lm
/usr/local/arm-4.2.0/lib/gcc/arm-elf/4.2.0/../../../../arm-elf/bin/ ld: ERROR: obj/main.o uses VFP instructions, whereas h.elf does not
/usr/local/arm-4.2.0/lib/gcc/arm-elf/4.2.0/../../../../arm-elf/bin/ ld: failed to merge target specific data of file obj/main.o



Interestingly, it doesn't seem to complain about start.o.


--
Rick


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