]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/make/platform/triple.mk
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / make / platform / triple.mk
CommitLineData
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
4Description := Static runtime libraries for platforms selected by 'TargetTriple'
5
6# Provide defaults for the required vars
7ifndef CC
8 CC := gcc
9endif
10ifndef CFLAGS
11 CFLAGS := -Wall -O3
12endif
13
14Configs := builtins
15
16Arch := $(word 1,$(subst -, ,$(TargetTriple)))
17ifeq ($(Arch),i686)
18 Arch := i386
19else ifeq ($(Arch),arm)
20ifneq (,$(findstring ios,$(TargetTriple)))
21 Arch := armv7
22else ifneq (,$(findstring android,$(TargetTriple)))
23 Arch := armv7
24endif
25endif
26
27# Filter out stuff that gcc cannot compile (these are only needed for clang-generated code anywasys).
92a42be0 28CommonFunctions_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
33ifeq ($(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
55endif
56
92a42be0
SL
57# Disable emutls on MIPS
58# Rust uses GCC 4.4 to cross-compile, which doesn't have some builtins
59ifneq (,$(findstring mips,$(TargetTriple)))
60 CommonDisabledFunctions := emutls
61endif
62
63# Disable emutls on Windows
64# emutls works on POSIX only as it uses pthreads
65ifneq (,$(findstring windows,$(TargetTriple)))
66 CommonDisabledFunctions := emutls
67endif
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)
71ifeq (aarch64-apple-ios,$(subst arm64,aarch64,$(TargetTriple)))
72CommonDisabledFunctions := clear_cache
73endif
1a4d82fc 74
85aaf69f
SL
75ArchEnabledFunctions := $(filter-out $(ArchDisabledFunctions),$(value ArchFunctions.$(Arch)))
76CommonEnabledFunctions := $(filter-out $(CommonDisabledFunctions),$(CommonFunctions_gcc))
1a4d82fc 77
85aaf69f 78FUNCTIONS.builtins := $(CommonEnabledFunctions) $(ArchEnabledFunctions)