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"

The first compiler ppc1 is already a classical compiler (not using LLVM),
and this LEVEL2 and LEVEL3 do not require those LLVM-specific compiler options.

I got this of cfarm14:

muller@cfarm14:~/pas/trunk/fpcsrc/compiler$ which ppcx64
/home/muller/pas/fpc-3.3.1-llvm/bin/ppcx64
muller@cfarm14:~/pas/trunk/fpcsrc/compiler$ ppcx64 -ib
LLVM
muller@cfarm14:~/pas/trunk/fpcsrc/compiler$ make cycle OPTLEVEL1="-dNOLLVM -Clv14.0 -XLL" 
OPT="-n -gl"
....
"cycle" finished successfully with a new ppcx64 in that directory
muller@cfarm14:~/pas/trunk/fpcsrc/compiler$ ./ppcx64 -ib
FPC


Option -XLL is also required to use ld.lld instead of ld.bfd,
because otherwise I get this failure:

/home/muller/pas/fpc-3.3.1-llvm/bin/ppcx64 -Fux86_64 -Fusystems -Fu../rtl/units/x86_64-linux -Fix86_64 -FEx86_64/bin/x86_64-linux -FUx86_64/units/x86_64-linux -Cg -Fl/usr/lib/gcc/x86_64-linux-gnu/12 -n -gl -dNOLLVM -Clv14.0 -dREVINC -dx86_64 -Fux86 -Fix86 -o/home/muller/pas/gitlab-fpc-source/compiler/ppc1 pp.pas
/usr/bin/ld.bfd: .eh_frame_hdr refers to overlapping FDEs
/usr/bin/ld.bfd: final link failed: bad value
pp.pas(307,1) Error: Error while linking
pp.pas(307,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[3]: *** [Makefile:5414: ppcx64] Error 1



Pierre



Le 22/07/2026 à 09:45, Adriaan van Os via fpc-pascal a écrit :

This is a follow up on 
<https://gitlab.com/freepascal.org/fpc/source/-/work_items/41823>

Jonas suggests to add -dNOLLVM (to compile a non-llvm compiler with an llvm 
compiler). When I do that, I get

/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- -Clv15.0 -dNOLLVM -daarch64 -dRELEASE  -Us -Sg ../bsd/system.pp
Error: Illegal parameter: -Clv15.0
make[7]: *** [system.ppu] Error 1
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

When I skip the -Clv15.0, I get

/bin/mkdir -p /Users/administrator/fpc-svn/fpc/rtl/units/aarch64-darwin
/usr/local/lib/fpc/3.3.1-llvm/ppca64 -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- -dNOLLVM -daarch64 -dRELEASE  -Us -Sg ../bsd/system.pp
/Users/administrator/fpc-svn/fpc/rtl/units/aarch64-darwin/system.ll:10644:77: 
error: expected '('
define void @"\01_SYSTEM_$$_STRPAS$PANSICHAR$$SHORTSTRING"([256 x i8]* sret noalias nocapture 
%p.$result, i8* %p.p) inlinehint nobuiltin "null-pointer-is-valid"="true" strictfp {
           ^
1 error generated.
system.pp(429,1) Error: Error while assembling exitcode 1
Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
make[7]: *** [system.ppu] Error 1
make[6]: *** [darwin_all] Error 2
make[5]: *** [rtl] Error 2
make[4]: *** [next] Error 2
make[3]: *** [ppc1] Error 2
make[2]: *** [cycle] Error 2
make[1]: *** [compiler_cycle] Error 2
make: *** [build-stamp.aarch64-darwin] Error 2
logout


Regards,

Adriaan van Os


_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to