This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Specifying VPF instructions for ARM?
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Jeff Gold <jgold at us dot ncipher dot com>
- Cc: gcc at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Tue, 04 Nov 2003 01:05:52 +0000
- Subject: Re: Specifying VPF instructions for ARM?
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> I'm using GCC to cross compile code for ARM but am running into trouble
> with floating point formats. The ARM architecture seems to have two
> kinds of instructions for floating point emulation, VFP and FPA, and
> these cannot be mixed within an executable. Some versions of GCC seem
> to produce one kind and some produce the other. This proves to be a
> problem when attempting to link libraries and executable object files
> created with different GCC installations.
>
GCC cannot currently generate VFP instructions, but work is in progress to
address this (though not for the next release of the compiler). It can
support VFP-format soft-float code (using the same data layout as the VFP,
but without using VFP instructions) but this can only be selected as a
build-time option.
> I have studied the description of ARM specific GCC options in the
> texinfo page and searched both google and the gcc-help list archives.
> Nothing I've found seems to indicate how to ask GCC to use a particular
> floating point format. I also posted a summary of this problem to
> gcc-help@gcc.gnu.org over a month ago but have not recieved a response.
Sorry, I don't read gcc-help -- too many mails in each day as it is,
without adding more.
>
> Can anyone tell me if there is a command line option I've missed? Or if
> there is a way to specify which kind of floating point instructions
> should be generated when configuring GCC? Failing that, does anyone
> know of a more appropriate forum where questions of this sort have a
> chance of being answered?
You don't say which versions of the various tools you are trying to use,
but assuming that they are based on released versions (rather than CVS
builds) there are no options that will address your problems available.
The CVS trunk of GCC has some patches to fix this, but those will only
appear in gcc-3.4.
>
> Here are some additional details about the problem. I use the same
> CFLAGS for compiling object files for the library and the executable,
> but different GCC versions. The errors occur at link time
> and look like this:
>
> xscale-elf-gcc -O3 -Wall -Wpointer-arith -Wwrite-strings \
> -Wstrict-prototypes -Wmissing-prototypes -Werror \
> -mapcs-32 -msoft-float -mlittle-endian -mcpu=strongarm \
> -nostdinc -fno-builtin \
> -I/path/to/headers -I. -o program.o -c ./program.c
> xscale-elf-gcc -O3 -Wall -Wpointer-arith -Wwrite-strings \
> -Wstrict-prototypes -Wmissing-prototypes -Werror \
> -mapcs-32 -msoft-float -mlittle-endian -mcpu=strongarm \
> -nostdinc -fno-builtin \
> -I/path/to/headers -I. -o utilities.o -c ./utilities.c
> xscale-elf-ld -warn-common -nostdlib -Ttext 0x800000 -Tdata 0x900000 \
> -o program.elf program.o utilities.o \
> /path/to/libs/libsomething.a
> xscale-elf-ld: ERROR: /path/to/libs/libsomething.a(one.o) uses VFP
> instructions, whereas program.elf does not
> File format not recognized: failed to merge target specific data of file
> /path/to/libs/libsomething.a(one.o)
> xscale-elf-ld: ERROR: /path/to/libs/libsomething.a(two.o) uses VFP
> instructions, whereas program.elf does not
> File format not recognized: failed to merge target specific data of file
> /path/to/libs/libsomething.a(two.o)
>
This is occurring at least in part because there is a disconnect between
what the compiler is generating and what the assembler is expecting. When
you built an xscale-elf toolchain the assembler picked the VFP data format
for doubles, so any object file compiled with the default options (all the
support code) will be marked that way.
When you assemble (or compile) code with the -mcpu=strongarm option, then
the assembler will assume you want the legacy FPA data format for your
doubles, so when you link the code together the linker reports a conflict
(it doesn't matter whether a file contains any floating point values or
not, it's always marked one way the another).
The only solution I can suggest here is to avoid using an xscale-elf
toolchain for building applications non-xscale systems (use the arm-elf
configuration or maybe the strongarm-elf configuration). Not withstanding
the linkage problem described above, you probably don't want to use the
xscale-elf configuration for building strongarm apps because all the
support code (startup-files, C library, runtime support library) could
potentially have instructions that are not available on a strongarm.
R.