[fpc-pascal] llvminfo woes

Jonas Maebe jonas at freepascal.org
Wed Jul 22 23:14:15 CEST 2026


On 2026-07-22 12:01, Adriaan van Os via fpc-pascal wrote:
> On 22/07/2026 10:05, Pierre Muller via fpc-pascal wrote:
>> To cycle successfully starting from a LLVM compiler
>> and trying to generate a non-llvm version you will need to use
>> OPTLEVEL1 Makefile variable.
>> 
>> Check required -ClvX.Y needed by testing 'clang --version' output
>> and use OPTLEVEL1="-ClvX.Y -dNOLLVM -XLL"
> 
> Thanks, OPTLEVEL1="-Clv15.0 -dNOLLVM" (without the -XXL)  works for me. 
> However, I get

I should have mentioned this when you initially asked regarding the 
version check issue, but doing a top-level build, or even a make cycle, 
using an LLVM-based compiler to build a non-LLVM-based compiler, is 
rather pointless. ppc1 will be compiled using the LLVM code generator, 
but ppc2/ppc3 will be compiled using the built-in code generator, so the 
finally installed compiler will (should) be identical to one you'd get 
when starting using e.g. FPC 3.2.2.

To get a regular compiler built using an LLVM compiler, execute your 
make command inside the compiler directory (adding the options to OPT) 
and keep the resulting compiler binary (ppca64 in this case).

> /Applications/Xcode.app/Contents/Developer/usr/bin/make rtl
> /Applications/Xcode.app/Contents/Developer/usr/bin/make -C 
> /Users/administrator/fpc-svn/fpc/rtl 
> 'OPT=-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk 
> -g-    ' all
> /Applications/Xcode.app/Contents/Developer/usr/bin/make -C darwin all
> /Users/administrator/fpc-svn/fpc/compiler/ppc1 -dFPC_USE_LIBC -Ur -Xs 
> -O2 -n -Fi../inc -Fi../aarch64 -Fi../unix -Fi../bsd -Fi../bsd/aarch64 
> -Fi../darwin/aarch64 -FE. 
> -FU/Users/administrator/fpc-svn/fpc/rtl/units/aarch64-darwin 
> -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk 
> -XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk 
> -g- -daarch64 -dRELEASE  -Us -Sg ../bsd/system.pp
> Error: Compilation raised exception internally
> An unhandled exception occurred at $000000018AA2E248:
> EAccessViolation: Access violation
>   $000000018AA2E248
> 
> make[7]: *** [system.ppu] Error 217
> make[6]: *** [darwin_all] Error 2
> make[5]: *** [rtl] Error 2
> make[4]: *** [next] Error 2
> make[3]: *** [ppc2] Error 2
> make[2]: *** [cycle] Error 2
> make[1]: *** [compiler_cycle] Error 2
> make: *** [build-stamp.aarch64-darwin] Error 2
> logout
> 
> The compiler does build when I add -O- or  OPTLEVEL2="-O-".

That crash seems to be due to a bug in the FPC LLVM codegenerator 
handling of nested functions inside TP-style objects' constructors if 
these nested functions access fields. The AArch64 peephole optimiser of 
the built-in code generator contains such a function, which is why -O- 
solves it. I'm looking into it.


Jonas


More information about the fpc-pascal mailing list