]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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. | |
3 | ||
4 | Description := Static runtime libraries for platforms selected by 'TargetTriple' | |
5 | ||
6 | # Provide defaults for the required vars | |
7 | ifndef CC | |
8 | CC := gcc | |
9 | endif | |
10 | ifndef CFLAGS | |
11 | CFLAGS := -Wall -O3 | |
12 | endif | |
13 | ||
14 | Configs := builtins | |
15 | ||
16 | Arch := $(word 1,$(subst -, ,$(TargetTriple))) | |
17 | ifeq ($(Arch),i686) | |
18 | Arch := i386 | |
19 | else ifeq ($(Arch),arm) | |
20 | ifneq (,$(findstring ios,$(TargetTriple))) | |
21 | Arch := armv7 | |
22 | else ifneq (,$(findstring android,$(TargetTriple))) | |
23 | Arch := armv7 | |
24 | endif | |
25 | endif | |
26 | ||
27 | # Filter out stuff that gcc cannot compile (these are only needed for clang-generated code anywasys). | |
92a42be0 | 28 | CommonFunctions_gcc := $(filter-out atomic% enable_execute_stack,$(CommonFunctions)) |
1a4d82fc JJ |
29 | |
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 \ | |
38 | sync_fetch_and_or_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 \ | |
48 | sync_fetch_and_or_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 \ | |
54 | sync_fetch_and_umin_8 | |
55 | endif | |
56 | ||
92a42be0 SL |
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 | |
61 | endif | |
62 | ||
63 | # Disable emutls on Windows | |
64 | # emutls works on POSIX only as it uses pthreads | |
65 | ifneq (,$(findstring windows,$(TargetTriple))) | |
66 | CommonDisabledFunctions := emutls | |
67 | endif | |
68 | ||
85aaf69f SL |
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 | |
73 | endif | |
1a4d82fc | 74 | |
85aaf69f SL |
75 | ArchEnabledFunctions := $(filter-out $(ArchDisabledFunctions),$(value ArchFunctions.$(Arch))) |
76 | CommonEnabledFunctions := $(filter-out $(CommonDisabledFunctions),$(CommonFunctions_gcc)) | |
1a4d82fc | 77 | |
85aaf69f | 78 | FUNCTIONS.builtins := $(CommonEnabledFunctions) $(ArchEnabledFunctions) |