Re: [fpc-devel] How to view .ll files generated by LLVM backend?
Le 25/07/2023 à 17:52, Lucian Popescu via fpc-devel a écrit : Hi, I followed the instructions for building FPC with LLVM presented here [1]. Now I am interested in generating LLVM assembly from the corresponding Pascal code. Is there any method to achieve this? Just use -al option, this will leave the generated .ll file present after compilation. You can also use -vx option to see how clang is called: Pierre muller@gcc187:~/pas/check$ fpc -al -vx hello.pp Free Pascal Compiler version 3.3.1-13440-ge4911588c5-unpushed-dirty [2023/07/26] for x86_64 Copyright (c) 1993-2023 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling hello.pp Assembling program Executing "/home/muller/bin/clang" with command line "-x ir -O0 -fno-omit-frame-pointer -static -target x86_64-unknown-linux-gnu -c -o hello.o hello.ll " Linking hello Executing "/usr/bin/ld.bfd" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-64.so.2 -s-L. -o hello -T link3003900.res -e _start --eh-frame-hdr" Size of Code: 336615 bytes Size of initialized data: 9568 bytes Size of initialized data: 6648 bytes Size of uninitialized data: 7016 bytes 3 lines compiled, 0.1 sec, 336615 bytes code, 23232 bytes data muller@gcc187:~/pas/check$ ls -altr hello* -rw-rw-r--. 1 muller muller 32 Aug 4 2022 hello.pp -rw-rw-r--. 1 muller muller 5220 Jul 26 11:43 hello.ll -rw-rw-r--. 1 muller muller 2584 Jul 26 11:43 hello.o -rwxrwxr-x. 1 muller muller 447584 Jul 26 11:43 hello ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Haiku
Hi Paul, The web site is not up to date, but if you go to: https://sourceforge.net/projects/freepascal/files/Haiku/3.2.2/ you will find the 3.2.2 release for x86_64 CPU. I used it only very little, and I am not sure it works for all beta/alpha releases... Please let us know if it works for you, and on which release! Pierre Le 04/02/2023 à 23:48, Paul Renaud via fpc-devel a écrit : Is there any plan to release a version of the compiler for 64-bit Haiku? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Attn Florian, commit 1b698210 10/10/2022 22:45:31 breaks DWARF info
Hi Martin, could you tell me if https://gitlab.com/freepascal.org/fpc/source/-/issues/39928#note_1140122898 fixes your troubles? Thanks in advance, Pierre Le 19/10/2022 à 19:47, Martin Frb via fpc-devel a écrit : Revision: 1b6982107f1ac4b4111e37be0a3649d155a2bc1e Author: florian Date: 10/10/2022 22:45:31 Message: * TDebugInfoDwarf3.appenddef_object should not write an extra finish_entry for objects and C++ classes This adds extra DW_OP_... statements in 2 places In procedure addstringdef(const name: shortstring; chardef: tdef; deref: boolean; lensize: aint); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_nop))); However it does not increase the byte count "upperopcodes" in the append_entry(DW_TAG_subrange_type,false,[ DW_AT_lower_bound,DW_FORM_udata,1, DW_AT_upper_bound,DW_FORM_block1,upperopcodes ]); Similar in: procedure tdebuginfodwarf3.appenddef_array(list: tasmlist; def: tarraydef); -- I am still puzzled at the effect from what I saw in the data I got from a reporter. He send me an objdump (which failed mid way) <2><2617>: Abbrev Number: 18 (DW_TAG_subrange_type) <2618> DW_AT_lower_bound : 1 <2619> DW_AT_upper_bound : 13 byte block: 97 6 12 28 4 0 30 2f 3 0 38 1c 6 (DW_OP_push_object_address; DW_OP_deref; > <2><2627>: Abbrev Number: 22 (DW_TAG_subprogram) It should be followed by "Abbrev Number; 0" (end of the nested block) Of course FPC would now write 14 bytes (while the header still says 13), bot the 14th byte should be DW_OP_nop = $96 So I am puzzled where the 22 comes from. Though that could be something that objdump did. (I don't have the exe in question / and I haven't reproduced myself) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Questions about cross-compiling (z80)
2. Is it possible to add z80 cross compilation target to FP IDE? The FP IDe shows me a few targets, but z80 is not there. The text mode IDE can only ever compile for one CPU platform, so you need to build it for Z80. Though I don't know right now whether this is enabled. I just added basic support for a few more CPUs: riscv32, riscv64, wasm32, xtensa and z80. You can generate them in newest trunk by moving to packages/ide directory and issuing a: make all_targets OPT="" with being you usual OPT. Or you can simply use: make z80 OPT="" followed by make z80_install OPT="" This should add z80-fp executable in the same location as your latest trunk compiler... Most CPUs do not have CPU specific options encoded inside the IDE sources, thus you might need to add the options you want to use to the Please report if you discover any problems. Pierre ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Questions regarding m68k-atari target
Le 01/02/2022 à 06:28, Thorsten Otto via fpc-devel a écrit : On Freitag, 28. Januar 2022 13:55:11 CET Thorsten Otto via fpc-devel wrote: > Then i tried -Aas, but then the compiler also complains: > > > > Warning: (treated as error) Assembler output selected "AS" is not compatible > with "Atari ST/STE" > > Warning: (treated as error) "VASM" assembler use forced Bump ;) Any solution to this? Currently seems to be impossible to use gas at all. Sometimes, you need to dig into the sources: look at compiler/m68k/ag68kgas.pas unit. You will see that atari is listed there: muller@gcc120:~/pas/trunk/fpcsrc/compiler/m68k$ grep -inC7 atari ag68kgas.pas 370- 371- as_m68k_as_aout_info : tasminfo = 372- ( 373-id : as_m68k_as_aout; 374-idtxt : 'AS-AOUT'; 375-asmbin : 'as'; 376-asmcmd : '$ARCH -o $OBJ $EXTRAOPT $ASM'; 377:supported_targets : [system_m68k_Amiga,system_m68k_Atari]; 378-flags : [af_needar]; 379-labelprefix : '.L'; 380-labelmaxlen : -1; 381-comment : '# '; 382-dollarsign: '$'; 383- ); The idtxt field is the string you need to use to enable GNU assembler for aout format, thus you should use -Aas-out compiler option. It is true that this entry is missing in ppc68k -h output... Pierre Pierre ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Cross-compiling and warnings from linker
Le 10/11/2021 à 21:19, Sergey Organov via fpc-devel a écrit : Hello, Using cross-compiler from x86-linux to arm-linux, I keep getting a lot of warnings at the linking stage of my programs, in the form: /opt/[...]/arm-linux-gnueabihf-ld: warning: library search path "/usr/lib/eject/" is unsafe for cross-compilation /opt/[...]/arm-linux-gnueabihf-ld: warning: warning: library search path "/usr/lib/console-setup/" is unsafe for cross-compilation [...] for virtually every sub-directory in /usr/lib. FPC 3.2.0 and 3.2.2 both have this issue. This makes me suspect FPC cross produces instructions for the linker to search for files in wrong directories, where host libraries reside, that could lead to unpredictable results, and then tons of the warnings are really annoying. What's the way to fix this? Try to use -Xd compiler option ~/bin$ fpc -h | grep -- -Xd -XdDo not search default library path (sometimes required for cross-compiling when not using -XR) Pierre ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Anyone an idea were/how to look for the missing merge in 3.0.2
Le 09/06/2021 à 00:31, Martin Frb via fpc-devel a écrit : I have the following issue. A testcase (LazDebuggerFp/test) works fine. Except for 3.2.0 and 3.2.2 (win 64) with -O3 or -O2 In detail: - It works in 32 bit 3.2.2 -- O3 - It works in 64 bit 3.0.4 / 3.3.1 -- O1 O2 and O3 (My 3.3.1 is 2 weeks old.) - It works in 64 bit LINUX 3.2.2 -- O3 - It works in 64 bit 3.2.0 / 3.2.2 -- O1 - It works in 64 bit 3.2.2 -- O3 with {$implicitexceptions off} in several units * It does not work in 64bit 3.2.0 / 3.2.2 -O2 or O3 with default {$implicitexceptions ON} Yes, it could be a bug in my code, but at this point, my primary suspicion points to a different origin for the trouble. I could not find the faulty code yet. I suspect that it is a random memory write (dangling pointer) that causes an error long after. And given that I can't use valgrind So anyone can thing of any bug fixed (as it works with 3.3.1), that may not have been merged? I have not checked 3.2.1 yet. / Will be a while, I am away a couple of days. Martin, could you check if this relates to bug #38973? https://bugs.freepascal.org/view.php?id=38973 This bug also does not show in current trunk. If you get the same pattern of failures, it is most probably related to this wrong optimization. Pierre ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Odd test failure on x86_64-win64
Please look at: https://www.freepascal.org/testsuite/cgi-bin/new-testsuite2.cgi?action=4=5630 .rdata support, i.e. read-only data sections, is not supported in several CPU-OS combination, and IIRC, it is even worse for PIC code, but I don't really know if these special limitations should not be removed... See TGNUAssembler.sectionname method in compiler/aggas.pas unit, and difference between secnames and secnames_pic inside that method. Pierre Le 12/05/2021 à 20:13, J. Gareth Moreton via fpc-devel a écrit : Hi everyone, So I stumbled across this during my optimisation development: Under x86_64-win64 (I'm not sure about other platforms), the test "test/tarray15.pp" fails with exitcode 19 if you run the test suite with TEST_OPT=-a to create assembly dumps. The failure is because the code attempts to write to a constant but doesn't raise an exception while doing so. Can anyone else confirm this? Gareth aka. Kit ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC 3.2.2-RC1 released!
Le 24/03/2021 à 12:10, Marco van de Voort via fpc-devel a écrit : Hello, We have placed the first release candidate of the Free Pascal Compiler version 3.2.2 on our ftp servers. You can help improve the upcoming 3.2.2 release by downloading and testing this release. If you want you can report what you have done here: http://wiki.freepascal.org/Testers_3.2.2 or in the maillist. Changes that may break backwards compatibility will be documented at: http://wiki.freepascal.org/User_Changes_3.2.2 Downloads are available at the main FTP server and ftp://freepascal.stack.nl/pub/mirrors/fpc/beta/3.2.2-rc1/ You need to open that directory to world! Pierre ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel