xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision a92579cfb90894ba1e3fda67fc9856d3c68b5d42)
1040b3049SEd Maste# $FreeBSD$
2040b3049SEd Maste
3040b3049SEd MasteCRTARCH=	${MACHINE_CPUARCH:C/amd64/x86_64/}
4040b3049SEd Maste
50b57cec5SDimitry AndricCRTSRC=		${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins
6040b3049SEd Maste
7040b3049SEd Maste.PATH:		${CRTSRC}/${CRTARCH}
8040b3049SEd Maste.PATH:		${CRTSRC}
9040b3049SEd Maste
10040b3049SEd MasteSRCF+=		absvdi2
11040b3049SEd MasteSRCF+=		absvsi2
12040b3049SEd MasteSRCF+=		absvti2
13040b3049SEd MasteSRCF+=		addvdi3
14040b3049SEd MasteSRCF+=		addvsi3
15040b3049SEd MasteSRCF+=		addvti3
16040b3049SEd MasteSRCF+=		apple_versioning
17040b3049SEd MasteSRCF+=		ashldi3
18040b3049SEd MasteSRCF+=		ashlti3
19040b3049SEd MasteSRCF+=		ashrdi3
20040b3049SEd MasteSRCF+=		ashrti3
21040b3049SEd MasteSRCF+=		clear_cache
22040b3049SEd MasteSRCF+=		clzdi2
23040b3049SEd MasteSRCF+=		clzsi2
24040b3049SEd MasteSRCF+=		clzti2
25040b3049SEd MasteSRCF+=		cmpdi2
26040b3049SEd MasteSRCF+=		cmpti2
27040b3049SEd MasteSRCF+=		ctzdi2
28040b3049SEd MasteSRCF+=		ctzsi2
29040b3049SEd MasteSRCF+=		ctzti2
30040b3049SEd MasteSRCF+=		divdc3
31040b3049SEd MasteSRCF+=		divdi3
32040b3049SEd MasteSRCF+=		divmoddi4
33040b3049SEd MasteSRCF+=		divmodsi4
34040b3049SEd MasteSRCF+=		divsc3
3504a91333SJohn BaldwinSRCF+=		divsi3
36040b3049SEd MasteSRCF+=		divtc3
37040b3049SEd MasteSRCF+=		divti3
38040b3049SEd MasteSRCF+=		divxc3
39040b3049SEd MasteSRCF+=		enable_execute_stack
40040b3049SEd MasteSRCF+=		eprintf
41040b3049SEd MasteSRCF+=		extendhfsf2
42040b3049SEd MasteSRCF+=		ffsdi2
43289fa303SDimitry AndricSRCF+=		ffssi2
44040b3049SEd MasteSRCF+=		ffsti2
45040b3049SEd MasteSRCF+=		fixdfdi
46040b3049SEd MasteSRCF+=		fixdfti
47040b3049SEd MasteSRCF+=		fixsfdi
48040b3049SEd MasteSRCF+=		fixsfti
49040b3049SEd MasteSRCF+=		fixunsdfdi
50040b3049SEd MasteSRCF+=		fixunsdfsi
51040b3049SEd MasteSRCF+=		fixunsdfti
52040b3049SEd MasteSRCF+=		fixunssfdi
53040b3049SEd MasteSRCF+=		fixunssfsi
54040b3049SEd MasteSRCF+=		fixunssfti
55040b3049SEd MasteSRCF+=		fixunsxfdi
56040b3049SEd MasteSRCF+=		fixunsxfsi
57040b3049SEd MasteSRCF+=		fixunsxfti
58040b3049SEd MasteSRCF+=		fixxfdi
59040b3049SEd MasteSRCF+=		fixxfti
60040b3049SEd MasteSRCF+=		floatditf
61040b3049SEd MasteSRCF+=		floattidf
62040b3049SEd MasteSRCF+=		floattisf
63040b3049SEd MasteSRCF+=		floattixf
64040b3049SEd MasteSRCF+=		floatunditf
65040b3049SEd MasteSRCF+=		floatunsidf
66040b3049SEd MasteSRCF+=		floatunsisf
67040b3049SEd MasteSRCF+=		floatuntidf
68040b3049SEd MasteSRCF+=		floatuntisf
69040b3049SEd MasteSRCF+=		floatuntixf
7091baa744SDimitry AndricSRCF+=		gcc_personality_v0	# not in upstream
71040b3049SEd MasteSRCF+=		int_util
72040b3049SEd MasteSRCF+=		lshrdi3
73040b3049SEd MasteSRCF+=		lshrti3
74040b3049SEd MasteSRCF+=		moddi3
7504a91333SJohn BaldwinSRCF+=		modsi3
76040b3049SEd MasteSRCF+=		modti3
77040b3049SEd MasteSRCF+=		muldc3
78040b3049SEd MasteSRCF+=		muldi3
79040b3049SEd MasteSRCF+=		mulodi4
80040b3049SEd MasteSRCF+=		mulosi4
81040b3049SEd MasteSRCF+=		muloti4
82040b3049SEd MasteSRCF+=		mulsc3
838bc12a7eSDimitry AndricSRCF+=		multc3
84040b3049SEd MasteSRCF+=		multi3
85040b3049SEd MasteSRCF+=		mulvdi3
86040b3049SEd MasteSRCF+=		mulvsi3
87040b3049SEd MasteSRCF+=		mulvti3
88040b3049SEd MasteSRCF+=		mulxc3
89040b3049SEd MasteSRCF+=		negdf2
90040b3049SEd MasteSRCF+=		negdi2
91040b3049SEd MasteSRCF+=		negsf2
92040b3049SEd MasteSRCF+=		negti2
93040b3049SEd MasteSRCF+=		negvdi2
94040b3049SEd MasteSRCF+=		negvsi2
95040b3049SEd MasteSRCF+=		negvti2
96040b3049SEd MasteSRCF+=		paritydi2
97040b3049SEd MasteSRCF+=		paritysi2
98040b3049SEd MasteSRCF+=		parityti2
99040b3049SEd MasteSRCF+=		popcountdi2
100040b3049SEd MasteSRCF+=		popcountsi2
101040b3049SEd MasteSRCF+=		popcountti2
102040b3049SEd MasteSRCF+=		powidf2
103040b3049SEd MasteSRCF+=		powisf2
104040b3049SEd MasteSRCF+=		powitf2
105040b3049SEd MasteSRCF+=		powixf2
106040b3049SEd MasteSRCF+=		subvdi3
107040b3049SEd MasteSRCF+=		subvsi3
108040b3049SEd MasteSRCF+=		subvti3
109040b3049SEd MasteSRCF+=		trampoline_setup
110040b3049SEd MasteSRCF+=		truncdfhf2
111040b3049SEd MasteSRCF+=		truncsfhf2
112040b3049SEd MasteSRCF+=		ucmpdi2
113040b3049SEd MasteSRCF+=		ucmpti2
114040b3049SEd MasteSRCF+=		udivdi3
115040b3049SEd MasteSRCF+=		udivmoddi4
116040b3049SEd MasteSRCF+=		udivmodsi4
117040b3049SEd MasteSRCF+=		udivmodti4
11804a91333SJohn BaldwinSRCF+=		udivsi3
119040b3049SEd MasteSRCF+=		udivti3
120040b3049SEd MasteSRCF+=		umoddi3
12104a91333SJohn BaldwinSRCF+=		umodsi3
122040b3049SEd MasteSRCF+=		umodti3
123040b3049SEd Maste
1242b12718bSDimitry Andric# Avoid using SSE2 instructions on i386, if unsupported.
1252b12718bSDimitry Andric.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
126e1ca2b88SDimitry AndricSRCS+=		floatdidf.c
127e1ca2b88SDimitry AndricSRCS+=		floatdisf.c
128e1ca2b88SDimitry AndricSRCS+=		floatdixf.c
129e1ca2b88SDimitry AndricSRCS+=		floatundidf.c
130e1ca2b88SDimitry AndricSRCS+=		floatundisf.c
131e1ca2b88SDimitry AndricSRCS+=		floatundixf.c
132e1ca2b88SDimitry Andric.else
133e1ca2b88SDimitry AndricSRCF+=		floatdidf
134e1ca2b88SDimitry AndricSRCF+=		floatdisf
135e1ca2b88SDimitry AndricSRCF+=		floatdixf
136e1ca2b88SDimitry AndricSRCF+=		floatundidf
137e1ca2b88SDimitry AndricSRCF+=		floatundisf
138e1ca2b88SDimitry AndricSRCF+=		floatundixf
139e1ca2b88SDimitry Andric.endif
140e1ca2b88SDimitry Andric
141335bcabeSEd Maste# __cpu_model support, only used on x86
142335bcabeSEd Maste.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
143335bcabeSEd MasteSRCF+=		cpu_model
144335bcabeSEd Maste.endif
145335bcabeSEd Maste
146*a92579cfSDimitry Andric# The fp_mode implementation for amd64 and i386 is shared, while other
147*a92579cfSDimitry Andric# architectures use the regular approach.
148*a92579cfSDimitry Andric.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
149*a92579cfSDimitry AndricSRCS+=		i386/fp_mode.c
150*a92579cfSDimitry Andric.else
151*a92579cfSDimitry AndricSRCF+=		fp_mode
152*a92579cfSDimitry Andric.endif
153*a92579cfSDimitry Andric
1542ad1d09fSRuslan Bukin#
1552ad1d09fSRuslan Bukin# 128-bit quad precision long double support,
1567804dd52SRuslan Bukin# only used on some architectures.
1572ad1d09fSRuslan Bukin#
1582ad1d09fSRuslan Bukin.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
159040b3049SEd MasteSRCF+=		addtf3
160040b3049SEd MasteSRCF+=		comparetf2
161040b3049SEd MasteSRCF+=		divtf3
162040b3049SEd MasteSRCF+=		extenddftf2
163040b3049SEd MasteSRCF+=		extendsftf2
164040b3049SEd MasteSRCF+=		fixtfdi
165040b3049SEd MasteSRCF+=		fixtfsi
166040b3049SEd MasteSRCF+=		fixtfti
167040b3049SEd MasteSRCF+=		fixunstfdi
168040b3049SEd MasteSRCF+=		fixunstfsi
169040b3049SEd MasteSRCF+=		fixunstfti
17091baa744SDimitry AndricSRCF+=		floatsitf
17191baa744SDimitry AndricSRCF+=		floattitf
172040b3049SEd MasteSRCF+=		floatunsitf
17391baa744SDimitry AndricSRCF+=		floatuntitf
174040b3049SEd MasteSRCF+=		multf3
175040b3049SEd MasteSRCF+=		subtf3
176040b3049SEd MasteSRCF+=		trunctfdf2
177040b3049SEd MasteSRCF+=		trunctfsf2
178040b3049SEd Maste.endif
179040b3049SEd Maste
1807804dd52SRuslan Bukin# These are already shipped by libc.a on some architectures.
1817804dd52SRuslan Bukin.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \
1827804dd52SRuslan Bukin    ${MACHINE_CPUARCH} != "riscv"
183040b3049SEd MasteSRCF+=		adddf3
184040b3049SEd MasteSRCF+=		addsf3
185040b3049SEd MasteSRCF+=		divdf3
186040b3049SEd MasteSRCF+=		divsf3
187040b3049SEd MasteSRCF+=		extendsfdf2
188040b3049SEd MasteSRCF+=		fixdfsi
189040b3049SEd MasteSRCF+=		fixsfsi
190040b3049SEd MasteSRCF+=		floatsidf
191040b3049SEd MasteSRCF+=		floatsisf
192040b3049SEd MasteSRCF+=		muldf3
193040b3049SEd MasteSRCF+=		mulsf3
194040b3049SEd MasteSRCF+=		subdf3
195040b3049SEd MasteSRCF+=		subsf3
196040b3049SEd MasteSRCF+=		truncdfsf2
197040b3049SEd Maste.endif
198040b3049SEd Maste
1990fd19f4aSWarner Losh.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
200040b3049SEd MasteSRCF+=		comparedf2
201040b3049SEd MasteSRCF+=		comparesf2
202040b3049SEd Maste.endif
203040b3049SEd Maste
204040b3049SEd Maste# FreeBSD-specific atomic intrinsics.
205b53a8df3SWarner Losh.if ${MACHINE_CPUARCH} == "arm"
206040b3049SEd Maste.PATH:		${SRCTOP}/sys/arm/arm
207040b3049SEd Maste
208040b3049SEd MasteSRCF+=		stdatomic
209040b3049SEd MasteCFLAGS+=	-DEMIT_SYNC_ATOMICS
210040b3049SEd Maste.elif ${MACHINE_CPUARCH} == "mips"
211040b3049SEd Maste.PATH:		${SRCTOP}/sys/mips/mips
212040b3049SEd Maste
213040b3049SEd MasteSRCF+=		stdatomic
214040b3049SEd Maste.endif
215040b3049SEd Maste
2167b6b882fSJustin Hibbits.if "${COMPILER_TYPE}" == "clang" && \
2177b6b882fSJustin Hibbits    (${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe")
2187b6b882fSJustin HibbitsSRCS+=          atomic.c
2197b6b882fSJustin HibbitsCFLAGS.atomic.c+=      -Wno-atomic-alignment
2207b6b882fSJustin Hibbits.endif
2217b6b882fSJustin Hibbits
222040b3049SEd Maste.for file in ${SRCF}
2230b972ac9SWarner Losh.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
224040b3049SEd Maste    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
225040b3049SEd MasteSRCS+=		${file}vfp.S
226040b3049SEd Maste. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
227040b3049SEd MasteSRCS+=		${file}.S
228040b3049SEd Maste. else
229040b3049SEd MasteSRCS+=		${file}.c
230040b3049SEd Maste. endif
231040b3049SEd Maste.endfor
232040b3049SEd Maste
233040b3049SEd Maste.if ${MACHINE_CPUARCH} == "arm"
234040b3049SEd MasteSRCS+=		aeabi_div0.c
235040b3049SEd MasteSRCS+=		aeabi_idivmod.S
236040b3049SEd MasteSRCS+=		aeabi_ldivmod.S
237040b3049SEd MasteSRCS+=		aeabi_memcmp.S
238040b3049SEd MasteSRCS+=		aeabi_memcpy.S
239040b3049SEd MasteSRCS+=		aeabi_memmove.S
240040b3049SEd MasteSRCS+=		aeabi_memset.S
241040b3049SEd MasteSRCS+=		aeabi_uidivmod.S
242040b3049SEd MasteSRCS+=		aeabi_uldivmod.S
243040b3049SEd MasteSRCS+=		bswapdi2.S
244040b3049SEd MasteSRCS+=		bswapsi2.S
245040b3049SEd MasteSRCS+=		switch16.S
246040b3049SEd MasteSRCS+=		switch32.S
247040b3049SEd MasteSRCS+=		switch8.S
248040b3049SEd MasteSRCS+=		switchu8.S
249040b3049SEd MasteSRCS+=		sync_synchronize.S
250040b3049SEd Maste.endif
25166ed7741SAdrian Chadd
252d9ad2b35SEd Maste# On some archs GCC-6.3 requires bswap32 built-in.
253ea0a30b1SEd Maste.if ${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "riscv" || \
254ea0a30b1SEd Maste    ${MACHINE_CPUARCH} == "sparc64"
25566ed7741SAdrian ChaddSRCS+=		bswapdi2.c
25666ed7741SAdrian ChaddSRCS+=		bswapsi2.c
25766ed7741SAdrian Chadd.endif
2583487d668SJohn Baldwin
2593487d668SJohn Baldwin.if ${MACHINE_ARCH:Mriscv*sf}
2603487d668SJohn BaldwinCFLAGS+=	-D__SOFT_FP__
2613487d668SJohn Baldwin.endif
262