[fpc-pascal] Linking Problems while cross compiling for arm
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Dec 9 10:47:39 CET 2009
On 09 Dec 2009, at 10:35, Dariusz Mazur wrote:
> Jonas Maebe pisze:
>> On 08 Dec 2009, at 23:25, Dariusz Mazur wrote:
>>
>>
>>> By the way:
>>> when XR path is set then XP should be default, but its not
>>>
>>
>> -XP is set by /etc/fpc.cfg if the source cpu is different from the
>> target CPU, and if the source and target OS are not both Darwin
>> (because on Mac OS X, the default as/ld can assemble/link for all
>> supported architectures). -XR has nothing to do with the naming of
>> the assembler/linker.
>>
> -XR is need to resolve part to uclibc or others, FPC is looking <XR>/
> lib/uclibc.o
> then FPC can assume that -XP is equal <XR>/bin
-XP defines the prefix for the binutils utility names, such as "arm-
linux-gnueabi-" (in order to generate utility names such as arm-linux-
gnueabi-as). The -FD parameter is what specifies the location of the
binutils. Additionally, setting the binutils directory like that is
not necessarily correct. E.g., on Mac OS X that would be wrong in most
cases, because the cross-compiling libraries are often in a completely
different place than the utilities.
You can of course then add a special case for Mac OS X, but this will
then make things confusing for people using multiple platforms (and
complicate code and/or configuration files).
>>> FPC search arm-linux-as
>>> maybe better search also "as" in <XR path>/bin/as
>>
>> No, that would cause confusion. If you want the compiler to use as/
>> ld there, then use -XP -FD<XR path>/bin (-XP without anything else
>> will set the prefix to "nothing").
>>
> that not solve problem.
> Its not for me, I pass through crosscompiling, but I want to make
> it simpler,
Adding "intelligence" like that to a compiler in the long run almost
always makes things more complex, because
a) people /will/ introduce bugs when modifying the compiler later on,
because they forgot or didn't know about these indirect effects. It
makes it almost impossible to modify the compiler in the long run
without changing/breaking some previous behaviour.
b) it requires special code to correctly handle the case when people
specify both -XR and -FD parameters, and possibly different behaviour
depending on the order in which the -XR and -FD parameter are passed
Jonas
More information about the fpc-pascal
mailing list