Index: make/platform/clang_windows.mk =================================================================== --- /dev/null +++ make/platform/clang_windows.mk @@ -0,0 +1,154 @@ + +Description = compiler runtime library for clang/Windows + +### + +CheckArchSource := $(ProjSrcRoot)/make/platform/clang_windows_test_input.c +CheckArch = \ + $(shell \ + result="" ; \ + for arch in $(1) ; do \ + if $(CC) -target $$arch-windows-msvc -c $(CheckArchSource) \ + -o /dev/null >/dev/null 2>&1 ; then \ + result="$$result$$arch " ; \ + else \ + printf 1>&2 "warning: windows.mk: dropping arch '$$arch' from lib\n"; \ + fi \ + done ; \ + echo $$result) + +### + +AR := ar +CC := clang +RANLIB := ranlib +STRIP := strip + +CFLAGS.base := -fms-compatibility -ffreestanding -fomit-frame-pointer -Wall -Werror + +CFLAGS.armv7.sysroot := +ifneq ($(LLVM_WINDOWS_ARM_NT_SYSROOT),) + CFLAGS.armv7.sysroot := -isystem $(LLVM_WINDOWS_ARM_NT_SYSROOT)/usr/include -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +endif + +CFLAGS.i686.sysroot := +ifneq ($(LLVM_WINDOWS_X86_SYSROOT),) + CFLAGS.i686.sysroot := -isystem $(LLVM_WINDOWS_X86_SYSROOT)/usr/include +endif + +CFLAGS.x86_64.sysroot := +ifneq ($(LLVM_WINDOWS_X86_64_SYSROOT),) + CFLAGS.x86_64.sysroot := -isystem $(LLVM_WINDOWS_X86_64_SYSROOT)/usr/include +endif + +# NOTE: the use of the itanium environment is due to the ARM assembly syntax; +# the environment here is fully compatible with "msvc". Explicitly add a -mcpu +# option to enable the use of sdiv/udiv on the target. +Platform.clang_windows.CFLAGS.pic.armv7 := -target thumbv7-windows-itanium $(CFLAGS.armv7.sysroot) -Os -fPIC $(CFLAGS.base) -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon +Platform.clang_windows.CFLAGS.pic.i686 := -target i686-windows-msvc $(CFLAGS.i686.sysroot) -Os -fPIC $(CFLAGS.base) +Platform.clang_windows.CFLAGS.pic.x86_64 := -target x86_64-windows-msvc $(CFLAGS.x86_64.sysroot) -Os -fPIC $(CFLAGS.base) + +### + +# Unwanted functions: +# + apple_versioning - Apple specific +# + enable_execute_stack - Windows disables executable stacks +# + eprintf - Apple specific +# + trampoline_step - PPC specific + +# TODO: _Atomic collides with the MSVC extension, resulting in compilation +# failures for atomic routines. Once that has been resolved, it should be added +# to the common functions. +FUNCTIONS.common := absvdi2 absvsi2 absvti2 \ + adddf3 addsf3 \ + addvdi3 addvsi3 addvti3 \ + ashldi3 ashlti3 \ + ashrdi3 ashrti3 \ + clear_cache \ + clzdi2 clzsi2 clzti2 \ + cmpdi2 cmpti2 \ + comparedf2 comparesf2 comparetf2 \ + ctzdi2 ctzsi2 ctzti2 \ + divdc3 divdf3 divdi3 \ + divmoddi4 divmodsi4 \ + divsc3 divsf3 divsi3 \ + divti3 divxc3 \ + extendsfdf2 \ + ffsdi2 ffsti2 \ + fixdfdi fixdfsi fixdfti \ + fixsfdi fixsfsi fixsfti \ + fixunsdfdi fixunsdfsi fixunsdfti \ + fixunssfdi fixunssfsi fixunssfti \ + fixunsxfdi fixunsxfsi fixunsxfti \ + fixxfdi fixxfti \ + floatdidf floatdisf floatdixf \ + floatsidf floatsisf \ + floattidf floattisf floattixf \ + floatundidf floatundisf floatundixf \ + floatunsidf floatunsisf \ + floatuntidf floatuntisf floatuntixf \ + gcc_personality_v0 \ + int_util \ + lshrdi3 lshrti3 \ + moddi3 modsi3 modti3 \ + muldc3 muldf3 muldi3 \ + mulodi4 mulosi4 muloti4 \ + mulsc3 mulsf3 \ + multi3 \ + mulvdi3 mulvsi3 mulvti3 \ + mulxc3 \ + negdf2 negdi2 \ + negsf2 \ + negti2 \ + negvdi2 negvsi2 negvti2 \ + paritydi2 paritysi2 parityti2 \ + popcountdi2 popcountsi2 popcountti2 \ + powidf2 powisf2 powitf2 powixf2 \ + subdf3 subsf3 \ + subvdi3 subvsi3 subvti3 \ + truncdfsf2 \ + ucmpdi2 ucmpti2 \ + udivdi3 \ + udivmoddi4 udivmodsi4 udivmodti4 \ + udivsi3 udivti3 \ + umoddi3 umodsi3 umodti3 \ + $(NULL) + +# Unwanted Functions: +# + aeabi_*: Windows does not conform to AEABI +# + {restore,save}_vfp_d8_d15_regs: designed for Thumb1 SJLJ exceptions +# + switch{16,32,8,u8}: designed for Thumb1 CPUs to generate switch tables +# + sync_synchronize: for Thumb1 GCC __sync_synchronize intrinsic usage +# + *vfp: designed for Thumb1 CPUs with VFPv2 + +FUNCTIONS.armv7 := bswapdi2 bswapsi2 \ + sync_fetch_and_add_4 \ + sync_fetch_and_sub_4 \ + sync_fetch_and_and_4 \ + sync_fetch_and_or_4 \ + sync_fetch_and_xor_4 \ + sync_fetch_and_nand_4 \ + sync_fetch_and_max_4 \ + sync_fetch_and_umax_4 \ + sync_fetch_and_min_4 \ + sync_fetch_and_umin_4 \ + sync_fetch_and_add_8 \ + sync_fetch_and_sub_8 \ + sync_fetch_and_and_8 \ + sync_fetch_and_or_8 \ + sync_fetch_and_xor_8 \ + sync_fetch_and_nand_8 \ + sync_fetch_and_max_8 \ + sync_fetch_and_umax_8 \ + sync_fetch_and_min_8 \ + sync_fetch_and_umin_8 \ + $(NULL) + +FUNCTIONS.pic := $(FUNCTIONS.common) +FUNCTIONS.pic.armv7 := $(FUNCTIONS.common) $(FUNCTIONS.armv7) + +Arch := +Configs := pic + +Arch.pic := $(call CheckArch,armv7 i686 x86_64) +