Re: [fpc-devel] x86_64 Optimizer Overhaul
> On Dec 16, 2018, at 10:57 PM, Marco van de Voort > wrote: > > I'm no expert, but afaik creating an object involves an exception frame, > which is afaik cheaper in Delphi with SEH, then FPC with setjmp. Even if there is no try..except block? I don’t use exceptions in FPC so shouldn’t this be turned off? I may not understand what you mean by exception frame though. Regards, Ryan Joseph ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
16.12.2018 22:44, Florian Klämpfl: Well, problem is a little bit that arm is really a moving target. Yes, I know. Besides, the exact difference between the "arm-linux" target and "armv7-linux-gnueabi" target is afaics just nowhere explicitely documented.(Though, binutils is opensource, one can read through and hopefully understand it... I tried a bit, but gave up soon.) Thank you! Regards, Nikolai ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Am 16.12.2018 um 20:47 schrieb Nikolai Zhubr: > Hi, > > Yes, "armv7-linux-gnueabi" did the trick for cross-compiling on windows as > well. I just had to manually rename binary > files of binutils so that thay match the naming pattern fpc build system > expacts. I can provide my ready-to-use > win32-to-arm binutils 2.31.1 zip if someone is interested. > > Besides, I employed the "mkbinutils" script from contribs on the website, and > I like it quite a lot, although it needed > some little updating too. Its a pity this script is not mentioned anywhere in > official recommendations. > > I'd like to note that apart from this binutils target pitfall, > cross-compiling appeared to be surprisingly easy even > when both cpu and os of the target differ from the host ones. Really > fantastic thing. But, the documentaion is horribly > lacking/incomplete/outdated, and in the absence of fine official > manual/howto, there are lots of unofficial "manuals" > floating around, full of wrong/random/irrelevant instructions. Well, problem is a little bit that arm is really a moving target. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Am 16.12.2018 um 18:20 schrieb Nikolai Zhubr: > 16.12.2018 20:01, I wrote: >> 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 > > Not exactly true. There is a release named "for raspberry" which is 3.0.4 and > actually it seems usable for my board as > well. Just installed it there, tested that same helloworld, and it worked! > Wierd. So you tried to build the 3.0.4 sources? This is something I apparently missed. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Hi, Yes, "armv7-linux-gnueabi" did the trick for cross-compiling on windows as well. I just had to manually rename binary files of binutils so that thay match the naming pattern fpc build system expacts. I can provide my ready-to-use win32-to-arm binutils 2.31.1 zip if someone is interested. Besides, I employed the "mkbinutils" script from contribs on the website, and I like it quite a lot, although it needed some little updating too. Its a pity this script is not mentioned anywhere in official recommendations. I'd like to note that apart from this binutils target pitfall, cross-compiling appeared to be surprisingly easy even when both cpu and os of the target differ from the host ones. Really fantastic thing. But, the documentaion is horribly lacking/incomplete/outdated, and in the absence of fine official manual/howto, there are lots of unofficial "manuals" floating around, full of wrong/random/irrelevant instructions. Anyway, this is a great success, thanks to all! Regards, Nikolai 16.12.2018 21:01, I wrote: Hi, It seems I've finally cracked this puzzle, somewhat. My self-built binutils were initially configured for "arm-linux" (That is, configure --target="arm-linux"). As soon as I changed this to "armv7-linux-gnueabi" (basically as a random guesswork) and rebuilt it all including the cross-fpc and my helloworld test on host x86_64-linux box again, I do not get much complaints from the build process anymore and the resulting executable appeared runnable on the arm device! Now going to retry it on windows again... Thank you! Regards, Nikolai ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Hi, It seems I've finally cracked this puzzle, somewhat. My self-built binutils were initially configured for "arm-linux" (That is, configure --target="arm-linux"). As soon as I changed this to "armv7-linux-gnueabi" (basically as a random guesswork) and rebuilt it all including the cross-fpc and my helloworld test on host x86_64-linux box again, I do not get much complaints from the build process anymore and the resulting executable appeared runnable on the arm device! Now going to retry it on windows again... Thank you! Regards, Nikolai 16.12.2018 20:20, Nikolai Zhubr: Not exactly true. There is a release named "for raspberry" which is 3.0.4 and actually it seems usable for my board as well. Just installed it there, tested that same helloworld, and it worked! Wierd. Thank you! Regards, Nikolai 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 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
On 12/16/2018 1:01 PM, Nikolai Zhubr wrote: 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 FPC 3.0.4 generates BLX instructions while it must not do that. It is fixed in FPC trunk and the 3.2 branch. You can try to build the trunk version and test. Or as a workaround you can set the armv5 cpu type via the -Cparmv5 switch. In such case BLX will not be used by FPC 3.0.2 too. Yuriy. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
On 12/16/18 7:01 AM, Marco van de Voort wrote: Op 2018-12-15 om 22:27 schreef wkitt...@windstream.net: i'm guessing that VFP is Virtual Floating Point which i would understand as being emulated kinda like we used to do when a machine didn't have a math co-processor in it... >> No, VFP is hard float support. The "V" stands for Vector not Virtual thanks for the correction :) -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.* ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
16.12.2018 20:01, I wrote: 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 Not exactly true. There is a release named "for raspberry" which is 3.0.4 and actually it seems usable for my board as well. Just installed it there, tested that same helloworld, and it worked! Wierd. Thank you! Regards, Nikolai 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 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
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@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/c
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
16.12.2018 18:13, Jonas Maebe: Which instructions does it show if you run the program in gdb and do "x/2i $pc-4" when it crashes? I made some additional steps in gdb in order to check if the program in question actually starts executing anything at all. Looks like it does: GNU gdb (GDB; openSUSE Leap 42.3) 8.0 . Reading symbols from t-bad...(no debugging symbols found)...done. (gdb) info files Symbols from "/root/personal/t-bad". Local exec file: `/root/personal/t-bad', file type elf32-littlearm. Entry point: 0x100ec 0x000100c0 - 0x000100e0 is .note.ABI-tag 0x000100e0 - 0x0003dff4 is .text 0x0003dff8 - 0x00042cf8 is .rodata 0x00053000 - 0x00053c5e is .data 0x00053c60 - 0x00055c18 is .bss (gdb) break *0x100ec Breakpoint 1 at 0x100ec (gdb) run Starting program: /root/personal/t-bad Breakpoint 1, 0x000100ec in ?? () (gdb) x/2i $pc => 0x100ec: mov r11, #0 0x100f0: ldmfd sp!, {r1} (gdb) stepi 0x000100f0 in ?? () (gdb) stepi 0x000100f4 in ?? () (gdb) x/2i $pc-4 0x100f0: ldmfd sp!, {r1} => 0x100f4: ldr r12, [pc, #92] ; 0x10158 (gdb) cont Continuing. Program received signal SIGILL, Illegal instruction. 0x0003155a in ?? () (gdb) x/2i $pc-4 0x31556: stmdb sp!, {r0, r1, r2, r3, r4, r6, r7, r8, r9, r10, r11, r12, pc} => 0x3155a: ; instruction: 0xfaff0060 (gdb) Thank you! Regards, Nikolai Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] x86_64 Optimizer Overhaul
Op 2018-12-15 om 19:01 schreef Martok: memory manager in daily use. Doing that is a C++-ism that shouldn't exist in a sane environment ;-) I just tested something, and I'm a surprised by how big the difference is. This simple test is 1.5 times slower in FPC/trunk/win32 than Delphi 2007 and 2.8 times slower for instances of TComponent. Medium-size GetMemory (I tested 123 bytes) is 22 times slower in FPC. Looks like there is quite some potential there. I'm no expert, but afaik creating an object involves an exception frame, which is afaik cheaper in Delphi with SEH, then FPC with setjmp. The test should probably be repeated with a FPC recompiled with OPTS="-dTEST_WIN32_SEH" ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
On 16/12/18 15:59, Nikolai Zhubr wrote: 16.12.2018 17:03, Florian Klämpfl: [...] https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32/ ? They work for me with the command line you mentioned. However, we have to support newer ones, I'll look into this. With binutils from svn, the cross-build itself succeeded for me out of the box, although still producing "Arm BLX instruction ..." warnings. But, the generated binary still does not work on the target device, generating "Illegal instruction". Which instructions does it show if you run the program in gdb and do "x/2i $pc-4" when it crashes? Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
16.12.2018 17:03, Florian Klämpfl: [...] https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32/ ? They work for me with the command line you mentioned. However, we have to support newer ones, I'll look into this. With binutils from svn, the cross-build itself succeeded for me out of the box, although still producing "Arm BLX instruction ..." warnings. But, the generated binary still does not work on the target device, generating "Illegal instruction". I've noticed though that the binary has now a different set of flags, namely "[has entry point]" as compared to the ones produced by newer binutils, I guess that could be important: objdump -p t t: file format elf32-littlearm private flags = 602: [APCS-32] [VFP float format] [software FP] [has entry point] Apparently I'm now going to arrange some normal development environment on the target board directly to get further... Thank you! Regards, Nikolai ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Am 16.12.2018 um 15:18 schrieb Nikolai Zhubr: > Hi Florian, > > 16.12.2018 16:41, Florian Klämpfl: >> I followed the thread, but didn't find it: what binutils do you use? > > I've tried 3 version so far: > > * binutils-2.15.94 (prebuilt) from fpc website is unusable because assembler > refuses some instructions (I've mentioned > it earlier) > > * binutils-2.28-src for mingw, built by myself on mingw. > > * binutils-2.31.1 regular source release, built by myself on both mingw and > linux. > > The latter 2 versions seem to show similar behaviour, resulting in the > abovementioned results. Can you try those from https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32/ ? They work for me with the command line you mentioned. However, we have to support newer ones, I'll look into this. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Hi Florian, 16.12.2018 16:41, Florian Klämpfl: I followed the thread, but didn't find it: what binutils do you use? I've tried 3 version so far: * binutils-2.15.94 (prebuilt) from fpc website is unusable because assembler refuses some instructions (I've mentioned it earlier) * binutils-2.28-src for mingw, built by myself on mingw. * binutils-2.31.1 regular source release, built by myself on both mingw and linux. The latter 2 versions seem to show similar behaviour, resulting in the abovementioned results. Thank you! Regards, Nikolai ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Hi all, (Sorry for flooding so much, but I've done some more testing!) In order to isolate any possible wierd windows-specific issues, I've redone everything on x86_64-linux as a host, with the same 3.0.4 version starting compiler, same fpcbuild-3.0.4.zip as a source for cross-build, same arm-linux target and same binutils 2.31.1 built from stock source tarball, and same CROSSOPT="-CpARMV6 -Cfsoft". Result seems exactly the same: 1. Adding the abovementioned ASTARGET+=-mfpu=softvfp to rtl/linux/Makefile[.fpc] is necessary, otherwise build will just fail. 2. Lots of "ARM BLX instruction ..." warnings from ld. 3. The resulting elf binary does not run on target device, generating "Illegal instruction" So there definitely must be a problem somewhere. Either I'm doing something really-really stupid, or maybe fpc 3.0.4 is incompatible with at least binutils >= 2.28 for arm target? I'm wondering what version of binutils was used to release fpc 3.0.4 for arm? 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@lists.freepascal.org
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Am 16.12.2018 um 12:01 schrieb Nikolai Zhubr: > 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? I followed the thread, but didn't find it: what binutils do you use? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Op 2018-12-15 om 22:27 schreef wkitt...@windstream.net: i'm guessing that VFP is Virtual Floating Point which i would understand as being emulated kinda like we used to do when a machine didn't have a math co-processor in it... No, VFP is hard float support. The "V" stands for Vector not Virtual ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
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@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Building cross-compiler for arm-linux on win32
Hi all, 16.12.2018 3:44, I wrote: [...] Got it, somewhat: -mfpu=softvfp is passed to arm-linux-as while compiling intermediate .s files (when using -Cfsoft), not sure if it is correct and intentional, and no special flags passed to arm-linux-as while compiling assembler sources. Hence the difference reported by objdump. Now apparently, current binutils' ld wants that somehow fpu type is also specified for linking output if it was specified when assembling input and they probably need to match each other. I could not find such option, but e.g. gcc apparently has some way to automagically do it. And after looking some more into current binutils, it seems machine code with this "VFP float format" and machine code without it are considered by ld not interoperable whatsoever. Therefore, when building for arm-elf, -mfpu=softvfp option should be passed either for _all_ generated object files or for _none_. Otherwise, linking normally can not succeed. And probably it is for a reason. Apparently there is no way to explicitely specify something like -mfpu to ld, but because the setting can not be mixed anyway, the value is just inherited by the output elf executable from some (first ?) input object file ld encounters, afaics. Looking into e.g. rtl/linux/Makefile[.fpc] there is e.g. this: $(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)prt0$(OEXT) $(ARCH)/prt0.as So inserting ASTARGET+=-mfpu=softvfp allowed full cross-build to succeed. I have yet to see if the generated binaries are actually usable. 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@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel