@@ -3082,6 +3082,11 @@ private function hCompileXpm( ) as integer
30823082 function = TRUE
30833083end function
30843084
3085+ # if defined( __FB_WIN32__ )
3086+ '' LLVM official Windows binary distributions lack llc.exe, use clang instead
3087+ #define NO_LLC
3088+ # endif
3089+
30853090private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as integer
30863091 dim as string ln, asmfile
30873092
@@ -3190,13 +3195,34 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
31903195 end select
31913196
31923197 case FB_BACKEND_LLVM
3198+ #ifdef NO_LLC
3199+ ln += "-S "
3200+ '' Silence "overriding the module target triple" warning. Maybe warning
3201+ '' that the target should be declared in the .ll instead.
3202+ ln += "-Wno-override-module "
3203+ '' Tell clang we're using system as, so don't use extensions in the asm
3204+ ln += "-no-integrated-as "
3205+ # endif
3206+
31933207 select case ( fbGetCpuFamily( ) )
31943208 case FB_CPUFAMILY_X86
3195- ln += "-march=x86 "
3209+ #ifdef NO_LLC
3210+ ln += "--target=i686 "
3211+ # else
3212+ ln += "-march=x86 "
3213+ # endif
31963214 case FB_CPUFAMILY_X86_64
3197- ln += "-march=x86-64 "
3215+ #ifdef NO_LLC
3216+ ln += "--target=x86_64 "
3217+ # else
3218+ ln += "-march=x86-64 "
3219+ # endif
31983220 case FB_CPUFAMILY_ARM
3199- ln += "-march=arm "
3221+ #ifdef NO_LLC
3222+ ln += "--target=armv7a "
3223+ # else
3224+ ln += "-march=arm "
3225+ # endif
32003226 case FB_CPUFAMILY_AARCH64
32013227 '' From the GCC manual:
32023228 '' -march=name
@@ -3230,7 +3256,11 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
32303256 '' is tuned to perform well across a range of target
32313257 '' processors implementing the target architecture.
32323258
3233- ln += "-march=armv8-a "
3259+ #ifdef NO_LLC
3260+ ln += "--target=armv8a "
3261+ # else
3262+ ln += "-march=armv8-a "
3263+ # endif
32343264 end select
32353265
32363266 if ( fbGetOption( FB_COMPOPT_PIC ) ) then
@@ -3242,7 +3272,11 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
32423272 select case ( fbGetCpuFamily( ) )
32433273 case FB_CPUFAMILY_X86, FB_CPUFAMILY_X86_64
32443274 if ( fbGetOption( FB_COMPOPT_ASMSYNTAX ) = FB_ASMSYNTAX_INTEL ) then
3245- ln += "--x86-asm-syntax=intel "
3275+ #ifdef NO_LLC
3276+ ln += "-masm=intel "
3277+ # else
3278+ ln += "--x86-asm-syntax=intel "
3279+ # endif
32463280 end if
32473281 end select
32483282
@@ -3260,7 +3294,12 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
32603294 end if
32613295 function = fbcRunBin( "compiling C" , gcc, ln )
32623296 case FB_BACKEND_LLVM
3263- function = fbcRunBin( "compiling LLVM IR" , FBCTOOL_LLC, ln )
3297+ #ifdef NO_LLC
3298+ const compiler = FBCTOOL_CLANG
3299+ # else
3300+ const compiler = FBCTOOL_LLC
3301+ # endif
3302+ function = fbcRunBin( "compiling LLVM IR" , compiler, ln )
32643303 end select
32653304end function
32663305
0 commit comments