1 # This "platform" file is intended for building compiler-rt using gcc.
2 # The actual target platform is selected by setting the TargetTriple variable to the corresponding LLVM triple.
4 Description
:= Static runtime libraries for platforms selected by
'TargetTriple'
6 # Provide defaults for the required vars
16 Arch
:= $(word 1,$(subst -, ,$(TargetTriple
)))
19 else ifeq ($(Arch
),arm
)
20 ifneq (,$(findstring ios
,$(TargetTriple
)))
22 else ifneq (,$(findstring android
,$(TargetTriple
)))
27 # Filter out stuff that gcc cannot compile (these are only needed for clang-generated code anywasys).
28 CommonFunctions_gcc
:= $(filter-out atomic
% enable_execute_stack
,$(CommonFunctions
))
30 # Filter out stuff which is not available on specific target
31 # For example, sync_fetch_and_add_4 uses Thumb instructions, which are unavailable
32 # when building for arm-linux-androideabi
33 ifeq ($(TargetTriple
),arm-linux-androideabi
)
34 ArchDisabledFunctions
:= \
35 sync_fetch_and_add_4 \
36 sync_fetch_and_sub_4 \
37 sync_fetch_and_and_4 \
39 sync_fetch_and_xor_4 \
40 sync_fetch_and_nand_4 \
41 sync_fetch_and_max_4 \
42 sync_fetch_and_umax_4 \
43 sync_fetch_and_min_4 \
44 sync_fetch_and_umin_4 \
45 sync_fetch_and_add_8 \
46 sync_fetch_and_sub_8 \
47 sync_fetch_and_and_8 \
49 sync_fetch_and_xor_8 \
50 sync_fetch_and_nand_8 \
51 sync_fetch_and_max_8 \
52 sync_fetch_and_umax_8 \
53 sync_fetch_and_min_8 \
57 # Disable emutls on MIPS
58 # Rust uses GCC 4.4 to cross-compile, which doesn't have some builtins
59 ifneq (,$(findstring mips
,$(TargetTriple
)))
60 CommonDisabledFunctions
:= emutls
63 # Disable emutls on Windows
64 # emutls works on POSIX only as it uses pthreads
65 ifneq (,$(findstring windows
,$(TargetTriple
)))
66 CommonDisabledFunctions
:= emutls
69 # Clear cache is builtin on aarch64-apple-ios
70 # arm64 and aarch64 are synonims, but iOS targets usually use arm64 (history reasons)
71 ifeq (aarch64-apple-ios
,$(subst arm64
,aarch64
,$(TargetTriple
)))
72 CommonDisabledFunctions
:= clear_cache
75 ArchEnabledFunctions
:= $(filter-out $(ArchDisabledFunctions
),$(value ArchFunctions.
$(Arch
)))
76 CommonEnabledFunctions
:= $(filter-out $(CommonDisabledFunctions
),$(CommonFunctions_gcc
))
78 FUNCTIONS.builtins
:= $(CommonEnabledFunctions
) $(ArchEnabledFunctions
)