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

Nikolai Zhubr n-a-zhubr at yandex.ru
Sun Dec 16 18:01:56 CET 2018


Hi,

16.12.2018 17:10, I wrote:
> I'm wondering what version of binutils was used to release fpc 3.0.4 for
> arm?

I've suddenly noticed that there is apparently no binary 3.0.4 release 
for arm! Well, at least not officially presented on fpc website. The 
download link goes to 3.0.2 version instead. Why is that? Is there any 
known problem with 3.0.4 on arm or rather it is supposed to be 
functionally identical to 3.0.2 ?


Thank you!

Regards,
Nikolai

>
>
> Thank you,
>
> Regards,
> Nikolai
>
> 16.12.2018 14:01, I wrote:
>> Hi,
>>
>> 16.12.2018 13:51, I wrote:
>> [...]
>>> So inserting
>>> ASTARGET+=-mfpu=softvfp
>>> allowed full cross-build to succeed. I have yet to see if the generated
>>> binaries are actually usable.
>>
>> Ok, now the resulting elf executable has this (supposedly correct) flag:
>> private flags = 600: [APCS-32] [VFP float format] [software FP]
>>
>> And, helloworld still fails to run:
>> Illegal instruction
>>
>> And, I still see tons of "ARM BLX instruction ..." warnings from ld of
>> this kind:
>>
>> C:\FPC\3.0.4\bin\i386-Win32\arm-linux-ld.exe:
>> arm\units\arm-linux\rautils.o: warning: ARM BLX instruction targets ARM
>> function 'SYSTEM_$$_POS$CHAR$SHORTSTRING$$LONGINT'
>> C:\FPC\3.0.4\bin\i386-Win32\arm-linux-ld.exe:
>> arm\units\arm-linux\rautils.o: warning: ARM BLX instruction targets ARM
>> function 'fpc_shortstr_copy'
>> C:\FPC\3.0.4\bin\i386-Win32\arm-linux-ld.exe:
>> arm\units\arm-linux\rautils.o: warning: ARM BLX instruction targets ARM
>> function 'fpc_shortstr_to_shortstr'
>> C:\FPC\3.0.4\bin\i386-Win32\arm-linux-ld.exe:
>> arm\units\arm-linux\rautils.o: warning: ARM BLX instruction targets ARM
>> function 'SYSTEM_$$_DELETE$OPENSTRING$LONGINT$LONGINT'
>>
>> Currently, my build command is:
>> make OS_TARGET=linux CPU_TARGET=arm NOGDB=1 CROSSCOMPILE=1
>> CROSSOPT="-CpARMV6 -Cfsoft" all
>>
>> Any hints?
>>
>>
>> Thank you!
>>
>> Regards,
>> Nikolai
>>
>>>
>>>
>>> Thank you!
>>>
>>> Regards,
>>> Nikolai
>>>
>>>>
>>>>
>>>> Thank you!
>>>>
>>>> Regards,
>>>> Nikolai
>>>>
>>>>> Thing is, object files compiled from pascal (like system.o) still get
>>>>> this suspicious VFP flag even after I started using CROSSOPT="-CpARMV6
>>>>> -Cfsoft". However, object files compiled from assembler sources (like
>>>>> prt0.o) does not. I'm trying to find where it comes from.
>>>>>
>>>>> arm-linux-objdump.exe -p prt0.o
>>>>> prt0.o: file format elf32-littlearm
>>>>> private flags = 0: [APCS-32] [FPA float format]
>>>>>
>>>>> arm-linux-objdump.exe -p system.o
>>>>> system.o: file format elf32-littlearm
>>>>> private flags = 600: [APCS-32] [VFP float format] [software FP]
>>>>>
>>>>> As a side note, I suddenly realised that I don't need any specially
>>>>> crafted version of binutils as long as I target linux and build
>>>>> binutils
>>>>> from source. Standard binutils source tar compiles with almost zero
>>>>> effort on modern mingw, at least for linux target.
>>>>>
>>>>>
>>>>> Thank you!
>>>>>
>>>>> Regards,
>>>>> Nikolai
>>>>>
>>>>>
>>>>> 15.12.2018 23:23, I wrote:
>>>>>> 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
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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