118
118
FBCTOOL_LD
119
119
FBCTOOL_GCC
120
120
FBCTOOL_LLC
121
+ FBCTOOL_CLANG
121
122
FBCTOOL_DLLTOOL
122
123
FBCTOOL_GORC
123
124
FBCTOOL_WINDRES
@@ -132,7 +133,7 @@ end enum
132
133
133
134
static shared as zstring * 16 toolnames( 0 to FBCTOOL__COUNT- 1 ) = _
134
135
{ _
135
- "as" , "ar" , "ld" , "gcc" , "llc" , "dlltool" , "GoRC" , "windres" , "cxbe" , "dxe3gen" , _
136
+ "as" , "ar" , "ld" , "gcc" , "llc" , "clang" , " dlltool", "GoRC" , "windres" , "cxbe" , "dxe3gen" , _
136
137
"emcc" , _
137
138
"emar" , _
138
139
"emcc" , _
@@ -2954,6 +2955,11 @@ private function hCompileXpm( ) as integer
2954
2955
function = TRUE
2955
2956
end function
2956
2957
2958
+ # if __FB_WIN32__
2959
+ '' LLVM official Windows binary distributions lack llc.exe, use clang instead
2960
+ #define NO_LLC
2961
+ # endif
2962
+
2957
2963
private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as integer
2958
2964
dim as string ln, asmfile
2959
2965
@@ -3057,13 +3063,34 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
3057
3063
end select
3058
3064
3059
3065
case FB_BACKEND_LLVM
3066
+ #ifdef NO_LLC
3067
+ ln += "-S "
3068
+ '' Silence "overriding the module target triple" warning. Maybe warning
3069
+ '' that the target should be declared in the .ll instead.
3070
+ ln += "-Wno-override-module "
3071
+ '' Tell clang we're using system as, so don't use extensions in the asm
3072
+ ln += "-no-integrated-as "
3073
+ # endif
3074
+
3060
3075
select case ( fbGetCpuFamily( ) )
3061
3076
case FB_CPUFAMILY_X86
3062
- ln += "-march=x86 "
3077
+ #ifdef NO_LLC
3078
+ ln += "--target=i686 "
3079
+ # else
3080
+ ln += "-march=x86 "
3081
+ # endif
3063
3082
case FB_CPUFAMILY_X86_64
3064
- ln += "-march=x86-64 "
3083
+ #ifdef NO_LLC
3084
+ ln += "--target=x86_64 "
3085
+ # else
3086
+ ln += "-march=x86-64 "
3087
+ # endif
3065
3088
case FB_CPUFAMILY_ARM
3066
- ln += "-march=arm "
3089
+ #ifdef NO_LLC
3090
+ ln += "--target=armv7a "
3091
+ # else
3092
+ ln += "-march=arm "
3093
+ # endif
3067
3094
case FB_CPUFAMILY_AARCH64
3068
3095
'' From the GCC manual:
3069
3096
'' -march=name
@@ -3097,7 +3124,11 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
3097
3124
'' is tuned to perform well across a range of target
3098
3125
'' processors implementing the target architecture.
3099
3126
3100
- ln += "-march=armv8-a "
3127
+ #ifdef NO_LLC
3128
+ ln += "--target=armv8a "
3129
+ # else
3130
+ ln += "-march=armv8-a "
3131
+ # endif
3101
3132
end select
3102
3133
3103
3134
if ( fbGetOption( FB_COMPOPT_PIC ) ) then
@@ -3109,7 +3140,11 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
3109
3140
select case ( fbGetCpuFamily( ) )
3110
3141
case FB_CPUFAMILY_X86, FB_CPUFAMILY_X86_64
3111
3142
if ( fbGetOption( FB_COMPOPT_ASMSYNTAX ) = FB_ASMSYNTAX_INTEL ) then
3112
- ln += "--x86-asm-syntax=intel "
3143
+ #ifdef NO_LLC
3144
+ ln += "-masm=intel "
3145
+ # else
3146
+ ln += "--x86-asm-syntax=intel "
3147
+ # endif
3113
3148
end if
3114
3149
end select
3115
3150
@@ -3127,7 +3162,12 @@ private function hCompileStage2Module( byval module as FBCIOFILE ptr ) as intege
3127
3162
end if
3128
3163
function = fbcRunBin( "compiling C" , gcc, ln )
3129
3164
case FB_BACKEND_LLVM
3130
- function = fbcRunBin( "compiling LLVM IR" , FBCTOOL_LLC, ln )
3165
+ #ifdef NO_LLC
3166
+ const compiler = FBCTOOL_CLANG
3167
+ # else
3168
+ const compiler = FBCTOOL_LLC
3169
+ # endif
3170
+ function = fbcRunBin( "compiling LLVM IR" , compiler, ln )
3131
3171
end select
3132
3172
end function
3133
3173
0 commit comments