[fpc-devel] Building cross-compiler for arm-linux on win32

Nikolai Zhubr n-a-zhubr at yandex.ru
Sat Dec 15 21:23:31 CET 2018


Hi again,

15.12.2018 19:52, Nikolai Zhubr:
> 15.12.2018 18:24, Florian Klämpfl:
>>> Now, I'm targeting an A20-olinuxino-micro board, which is afaik
>>> armv7a with VPFv4. The board is running either openwrt
>>> or opensuse. (And actually, the binaries produced by the pre-built
>>> native compiler have been tested in both environments
>>> already)
>>>
>>> So I suppose I should be using CROSSOPT="-CpARMV7A -CfFPV4_S16" ?
>>
>> ... and -dFPC_ARMHF. It is more important than the others.
>
> So, apparently most close to success for now was:
> CROSSOPT="-CpARMV7A -CfvFPV2 -dFPC_ARMHF"

I've got more results.

First, for completeness, here is my actual /proc/cpuinfo:
Processor       : ARMv7 Processor rev 4 (v7l)
processor       : 0
BogoMIPS        : 1434.46
processor       : 1
BogoMIPS        : 1439.63
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 
idiva idivt

Currently, I'm trying with CROSSOPT="-CpARMV7A -CfvFPV3 -dFPC_ARMHF"
(FPV4_S16 failed with some assembler complaints, posted earlier, so I 
then tried vFPV3 and it compiled, so I just stayed with it for now)

Still can not understand this ".o uses VFP instructions, whereas .\pp 
does not", but because I build binutils myself I've found and disabled 
the ld error exit on (in_flags & EF_ARM_VFP_FLOAT) != (out_flags & 
EF_ARM_VFP_FLOAT), and then with such "fixed" binutils crossfpc build 
completed somehow. I can now produce arm-linux executables, but probably 
something is wrong anyway because this "VFP float format" is present in 
.o files but not in final elf executables:

arm-linux-objdump.exe -p t.o
t.o:     file format elf32-littlearm
private flags = 400: [APCS-32] [VFP float format]

arm-linux-objdump.exe -p t
t:     file format elf32-littlearm
Program Header:
......
private flags = 0: [APCS-32] [FPA float format]

(t.pas is a helloworld one-liner.)

Besides, I get tons of warning from ld like this:
C:\FPC\3.0.4\bin\i386-Win32\arm-linux-ld.exe: 
C:\FPC\3.0.4\units\arm-linux\rtl\system.o: Warning: Arm BLX instruction 
targets Arm function 'SYSTEM_$$_SYSINITSTDIO'.

It looks like literally every function in every unit produce such a "Arm 
BLX instruction" warning. Seems suspicious.

And finally, on the target board, the executable totally fails with:

"Illegal instruction"

Any hints?


Thank you!

Regards,
Nikolai

> It successfully produced object files, but ld refsuses to link them.
> Again, the message is:
> pp.o uses VFP instructions, whereas .\pp does not
> (lots of these repeated)
>
> I'm guessing is that either some option is missing for ld to actually
> accept that VFP is present, or rather I need to rebuild my binutils for
> a different (hard fp) target?
>
> (The exact call that fails now is arm-linux-ld.exe -s -L. -o .\pp
> .\link.res)
>
>
> Thank you!
>
> Regards,
> Nikolai
>
>>
>>
>>
>> _______________________________________________
>> fpc-devel maillist - fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list