Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2026-07

llvminfo woes

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

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

Reply by email

Pierre Muller
to Adriaan van Os

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:

which ppcx64
/home/muller/pas/fpc-3.3.1-llvm/bin/ppcx64
ppcx64 -ib
LLVM
make cycle OPTLEVEL1="-dNOLLVM -Clv14.0 -XLL" OPT="-n -gl" ....
"cycle" finished successfully with a new ppcx64 in that directory ./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 :

Show quoted text 49 lines
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 - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Adriaan van Os
to Pierre Muller
Pierre Muller wrote 6 lines
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

/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-".

Regards,

Adriaan van Os

Reply by email

Jonas Maebe
to Adriaan van Os
Adriaan van Os wrote 10 lines
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).

Show quoted text 29 lines
/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

Reply by email

Adriaan van Os
to Jonas Maebe
Jonas Maebe wrote 19 lines
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.

Yes, I got the same timing results as with the regular compiler 🙂.

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).

Thanks. That works with -O2 and produces a ppca64. With -O3 and -O4, I get the results below. Adding -Swe- or -Sw- didn't help.

Assembling (pipe) aarch64/units/aarch64-darwin/nmat.ll Assembling (pipe) aarch64/units/aarch64-darwin/nmem.ll nld.pas(1271,7) Note: Call to subroutine "procedure arrayconstructor_to_set(var p:tnode);" marked as inline is not inlined Assembling (pipe) aarch64/units/aarch64-darwin/nld.ll htypechk.pas(1463,12) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1523,16) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1530,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1537,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1568,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1607,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1618,28) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1634,21) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1651,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1663,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1676,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1696,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1703,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1723,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1732,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1755,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1765,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1771,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1780,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1794,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1801,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1822,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1840,26) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1848,22) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1866,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1877,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1894,28) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1901,27) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1905,24) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1915,24) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1925,24) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1936,24) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1943,24) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(1952,18) Warning: (treated as error) Function result variable does not seem to be initialized
htypechk.pas(3975) Fatal: There were 34 errors compiling module, stopping Fatal: Compilation aborted
make: *** [ppca64] Error 1

Regards,

Adriaan van Os

Reply by email

Jonas Maebe
to Adriaan van Os
Adriaan van Os wrote 15 lines
On 22/07/2026 23:14, Jonas Maebe wrote: > 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). Thanks. That works with -O2 and produces a ppca64. With -O3 and -O4, I get the results below. Adding -Swe- or -Sw- didn't help. Assembling (pipe) aarch64/units/aarch64-darwin/nmat.ll Assembling (pipe) aarch64/units/aarch64-darwin/nmem.ll nld.pas(1271,7) Note: Call to subroutine "procedure arrayconstructor_to_set(var p:tnode);" marked as inline is not inlined Assembling (pipe) aarch64/units/aarch64-darwin/nld.ll htypechk.pas(1463,12) Warning: (treated as error) Function result variable does not seem to be initialized

That's a wrong error, but I cannot reproduce it. I did get a similar error in ncal.pas, but that one was a real mistake and I pushed a fix for it.

I've also pushed a fix for the issue with nested functions in TP-style object constructors.

Jonas

Reply by email

Jonas Maebe
to Jonas Maebe
Jonas Maebe wrote 18 lines
On 2026-07-23 10:52, Adriaan van Os via fpc-pascal wrote: > On 22/07/2026 23:14, Jonas Maebe wrote: >> 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). > > Thanks. That works with -O2 and produces a ppca64. With -O3 and -O4, I > get the results below. Adding -Swe- or -Sw- didn't help. > > Assembling (pipe) aarch64/units/aarch64-darwin/nmat.ll > Assembling (pipe) aarch64/units/aarch64-darwin/nmem.ll > nld.pas(1271,7) Note: Call to subroutine "procedure > arrayconstructor_to_set(var p:tnode);" marked as inline is not inlined > Assembling (pipe) aarch64/units/aarch64-darwin/nld.ll > htypechk.pas(1463,12) Warning: (treated as error) Function result > variable does not seem to be initialized That's a wrong error, but I cannot reproduce it.

Ah, it happens when you build the initial LLVM compiler with -O3, not when building the non-LLVM compiler with -O3. Now I see it too.

Jonas

Reply by email