xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision c90cb435038879b0bd0f830bd1e460f6838d9b8c)
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
2146c8c554SDimitry AndricSRCF+=		bswapdi2
2246c8c554SDimitry AndricSRCF+=		bswapsi2
23040b3049SEd MasteSRCF+=		clear_cache
24040b3049SEd MasteSRCF+=		clzdi2
25040b3049SEd MasteSRCF+=		clzsi2
26040b3049SEd MasteSRCF+=		clzti2
27040b3049SEd MasteSRCF+=		cmpdi2
28040b3049SEd MasteSRCF+=		cmpti2
29040b3049SEd MasteSRCF+=		ctzdi2
30040b3049SEd MasteSRCF+=		ctzsi2
31040b3049SEd MasteSRCF+=		ctzti2
32040b3049SEd MasteSRCF+=		divdc3
33040b3049SEd MasteSRCF+=		divdi3
34040b3049SEd MasteSRCF+=		divmoddi4
35040b3049SEd MasteSRCF+=		divmodsi4
36040b3049SEd MasteSRCF+=		divsc3
3704a91333SJohn BaldwinSRCF+=		divsi3
38040b3049SEd MasteSRCF+=		divtc3
39040b3049SEd MasteSRCF+=		divti3
40040b3049SEd MasteSRCF+=		divxc3
41040b3049SEd MasteSRCF+=		enable_execute_stack
42040b3049SEd MasteSRCF+=		eprintf
43040b3049SEd MasteSRCF+=		extendhfsf2
44040b3049SEd MasteSRCF+=		ffsdi2
45289fa303SDimitry AndricSRCF+=		ffssi2
46040b3049SEd MasteSRCF+=		ffsti2
47040b3049SEd MasteSRCF+=		fixdfdi
48040b3049SEd MasteSRCF+=		fixdfti
49040b3049SEd MasteSRCF+=		fixsfdi
50040b3049SEd MasteSRCF+=		fixsfti
51040b3049SEd MasteSRCF+=		fixunsdfdi
52040b3049SEd MasteSRCF+=		fixunsdfsi
53040b3049SEd MasteSRCF+=		fixunsdfti
54040b3049SEd MasteSRCF+=		fixunssfdi
55040b3049SEd MasteSRCF+=		fixunssfsi
56040b3049SEd MasteSRCF+=		fixunssfti
57040b3049SEd MasteSRCF+=		fixunsxfdi
58040b3049SEd MasteSRCF+=		fixunsxfsi
59040b3049SEd MasteSRCF+=		fixunsxfti
60040b3049SEd MasteSRCF+=		fixxfdi
61040b3049SEd MasteSRCF+=		fixxfti
62040b3049SEd MasteSRCF+=		floatditf
63040b3049SEd MasteSRCF+=		floattidf
64040b3049SEd MasteSRCF+=		floattisf
65040b3049SEd MasteSRCF+=		floattixf
66040b3049SEd MasteSRCF+=		floatunditf
67040b3049SEd MasteSRCF+=		floatunsidf
68040b3049SEd MasteSRCF+=		floatunsisf
69040b3049SEd MasteSRCF+=		floatuntidf
70040b3049SEd MasteSRCF+=		floatuntisf
71040b3049SEd MasteSRCF+=		floatuntixf
72040b3049SEd MasteSRCF+=		int_util
73040b3049SEd MasteSRCF+=		lshrdi3
74040b3049SEd MasteSRCF+=		lshrti3
75040b3049SEd MasteSRCF+=		moddi3
7604a91333SJohn BaldwinSRCF+=		modsi3
77040b3049SEd MasteSRCF+=		modti3
78040b3049SEd MasteSRCF+=		muldc3
79040b3049SEd MasteSRCF+=		muldi3
80040b3049SEd MasteSRCF+=		mulodi4
81040b3049SEd MasteSRCF+=		mulosi4
82040b3049SEd MasteSRCF+=		muloti4
83040b3049SEd MasteSRCF+=		mulsc3
848bc12a7eSDimitry AndricSRCF+=		multc3
85040b3049SEd MasteSRCF+=		multi3
86040b3049SEd MasteSRCF+=		mulvdi3
87040b3049SEd MasteSRCF+=		mulvsi3
88040b3049SEd MasteSRCF+=		mulvti3
89040b3049SEd MasteSRCF+=		mulxc3
90040b3049SEd MasteSRCF+=		negdf2
91040b3049SEd MasteSRCF+=		negdi2
92040b3049SEd MasteSRCF+=		negsf2
93040b3049SEd MasteSRCF+=		negti2
94040b3049SEd MasteSRCF+=		negvdi2
95040b3049SEd MasteSRCF+=		negvsi2
96040b3049SEd MasteSRCF+=		negvti2
97040b3049SEd MasteSRCF+=		paritydi2
98040b3049SEd MasteSRCF+=		paritysi2
99040b3049SEd MasteSRCF+=		parityti2
100040b3049SEd MasteSRCF+=		popcountdi2
101040b3049SEd MasteSRCF+=		popcountsi2
102040b3049SEd MasteSRCF+=		popcountti2
103040b3049SEd MasteSRCF+=		powidf2
104040b3049SEd MasteSRCF+=		powisf2
105040b3049SEd MasteSRCF+=		powitf2
106040b3049SEd MasteSRCF+=		powixf2
107040b3049SEd MasteSRCF+=		subvdi3
108040b3049SEd MasteSRCF+=		subvsi3
109040b3049SEd MasteSRCF+=		subvti3
110040b3049SEd MasteSRCF+=		trampoline_setup
111040b3049SEd MasteSRCF+=		truncdfhf2
112040b3049SEd MasteSRCF+=		truncsfhf2
113040b3049SEd MasteSRCF+=		ucmpdi2
114040b3049SEd MasteSRCF+=		ucmpti2
115040b3049SEd MasteSRCF+=		udivdi3
116040b3049SEd MasteSRCF+=		udivmoddi4
117040b3049SEd MasteSRCF+=		udivmodsi4
118040b3049SEd MasteSRCF+=		udivmodti4
11904a91333SJohn BaldwinSRCF+=		udivsi3
120040b3049SEd MasteSRCF+=		udivti3
121040b3049SEd MasteSRCF+=		umoddi3
12204a91333SJohn BaldwinSRCF+=		umodsi3
123040b3049SEd MasteSRCF+=		umodti3
124040b3049SEd Maste
125*c90cb435SDimitry Andric# Enable compiler-rt's atomic implementation only for clang, as it uses clang
126*c90cb435SDimitry Andric# specific builtins, and gcc packages usually come with their own libatomic.
127*c90cb435SDimitry Andric.if "${COMPILER_TYPE}" == "clang"
128*c90cb435SDimitry AndricSRCF+=		atomic
129*c90cb435SDimitry Andric.endif
130*c90cb435SDimitry Andric
1312b12718bSDimitry Andric# Avoid using SSE2 instructions on i386, if unsupported.
1322b12718bSDimitry Andric.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
133e1ca2b88SDimitry AndricSRCS+=		floatdidf.c
134e1ca2b88SDimitry AndricSRCS+=		floatdisf.c
135e1ca2b88SDimitry AndricSRCS+=		floatdixf.c
136e1ca2b88SDimitry AndricSRCS+=		floatundidf.c
137e1ca2b88SDimitry AndricSRCS+=		floatundisf.c
138e1ca2b88SDimitry AndricSRCS+=		floatundixf.c
139e1ca2b88SDimitry Andric.else
140e1ca2b88SDimitry AndricSRCF+=		floatdidf
141e1ca2b88SDimitry AndricSRCF+=		floatdisf
142e1ca2b88SDimitry AndricSRCF+=		floatdixf
143e1ca2b88SDimitry AndricSRCF+=		floatundidf
144e1ca2b88SDimitry AndricSRCF+=		floatundisf
145e1ca2b88SDimitry AndricSRCF+=		floatundixf
146e1ca2b88SDimitry Andric.endif
147e1ca2b88SDimitry Andric
148335bcabeSEd Maste# __cpu_model support, only used on x86
149335bcabeSEd Maste.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
150335bcabeSEd MasteSRCF+=		cpu_model
151335bcabeSEd Maste.endif
152335bcabeSEd Maste
153a92579cfSDimitry Andric# The fp_mode implementation for amd64 and i386 is shared, while other
154a92579cfSDimitry Andric# architectures use the regular approach.
155a92579cfSDimitry Andric.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
156a92579cfSDimitry AndricSRCS+=		i386/fp_mode.c
157a92579cfSDimitry Andric.else
158a92579cfSDimitry AndricSRCF+=		fp_mode
159a92579cfSDimitry Andric.endif
160a92579cfSDimitry Andric
1612ad1d09fSRuslan Bukin#
1622ad1d09fSRuslan Bukin# 128-bit quad precision long double support,
1637804dd52SRuslan Bukin# only used on some architectures.
1642ad1d09fSRuslan Bukin#
1652ad1d09fSRuslan Bukin.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
166040b3049SEd MasteSRCF+=		addtf3
167040b3049SEd MasteSRCF+=		comparetf2
168040b3049SEd MasteSRCF+=		divtf3
169040b3049SEd MasteSRCF+=		extenddftf2
170040b3049SEd MasteSRCF+=		extendsftf2
171040b3049SEd MasteSRCF+=		fixtfdi
172040b3049SEd MasteSRCF+=		fixtfsi
173040b3049SEd MasteSRCF+=		fixtfti
174040b3049SEd MasteSRCF+=		fixunstfdi
175040b3049SEd MasteSRCF+=		fixunstfsi
176040b3049SEd MasteSRCF+=		fixunstfti
17791baa744SDimitry AndricSRCF+=		floatsitf
17891baa744SDimitry AndricSRCF+=		floattitf
179040b3049SEd MasteSRCF+=		floatunsitf
18091baa744SDimitry AndricSRCF+=		floatuntitf
181040b3049SEd MasteSRCF+=		multf3
182040b3049SEd MasteSRCF+=		subtf3
183040b3049SEd MasteSRCF+=		trunctfdf2
184040b3049SEd MasteSRCF+=		trunctfsf2
185040b3049SEd Maste.endif
186040b3049SEd Maste
1877804dd52SRuslan Bukin# These are already shipped by libc.a on some architectures.
1887804dd52SRuslan Bukin.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \
1897804dd52SRuslan Bukin    ${MACHINE_CPUARCH} != "riscv"
190040b3049SEd MasteSRCF+=		adddf3
191040b3049SEd MasteSRCF+=		addsf3
192040b3049SEd MasteSRCF+=		divdf3
193040b3049SEd MasteSRCF+=		divsf3
194040b3049SEd MasteSRCF+=		extendsfdf2
195040b3049SEd MasteSRCF+=		fixdfsi
196040b3049SEd MasteSRCF+=		fixsfsi
197040b3049SEd MasteSRCF+=		floatsidf
198040b3049SEd MasteSRCF+=		floatsisf
199040b3049SEd MasteSRCF+=		muldf3
200040b3049SEd MasteSRCF+=		mulsf3
201040b3049SEd MasteSRCF+=		subdf3
202040b3049SEd MasteSRCF+=		subsf3
203040b3049SEd MasteSRCF+=		truncdfsf2
204040b3049SEd Maste.endif
205040b3049SEd Maste
2060fd19f4aSWarner Losh.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
207040b3049SEd MasteSRCF+=		comparedf2
208040b3049SEd MasteSRCF+=		comparesf2
209040b3049SEd Maste.endif
210040b3049SEd Maste
211040b3049SEd Maste# FreeBSD-specific atomic intrinsics.
212b53a8df3SWarner Losh.if ${MACHINE_CPUARCH} == "arm"
213040b3049SEd Maste.PATH:		${SRCTOP}/sys/arm/arm
214040b3049SEd Maste
215040b3049SEd MasteSRCF+=		stdatomic
216040b3049SEd MasteCFLAGS+=	-DEMIT_SYNC_ATOMICS
217040b3049SEd Maste.elif ${MACHINE_CPUARCH} == "mips"
218040b3049SEd Maste.PATH:		${SRCTOP}/sys/mips/mips
219040b3049SEd Maste
220040b3049SEd MasteSRCF+=		stdatomic
221040b3049SEd Maste.endif
222040b3049SEd Maste
223040b3049SEd Maste.for file in ${SRCF}
2240b972ac9SWarner Losh.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
225040b3049SEd Maste    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
226040b3049SEd MasteSRCS+=		${file}vfp.S
227040b3049SEd Maste. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
228040b3049SEd MasteSRCS+=		${file}.S
229040b3049SEd Maste. else
230040b3049SEd MasteSRCS+=		${file}.c
231040b3049SEd Maste. endif
232040b3049SEd Maste.endfor
233040b3049SEd Maste
234040b3049SEd Maste.if ${MACHINE_CPUARCH} == "arm"
235040b3049SEd MasteSRCS+=		aeabi_div0.c
236040b3049SEd MasteSRCS+=		aeabi_idivmod.S
237040b3049SEd MasteSRCS+=		aeabi_ldivmod.S
238040b3049SEd MasteSRCS+=		aeabi_memcmp.S
239040b3049SEd MasteSRCS+=		aeabi_memcpy.S
240040b3049SEd MasteSRCS+=		aeabi_memmove.S
241040b3049SEd MasteSRCS+=		aeabi_memset.S
242040b3049SEd MasteSRCS+=		aeabi_uidivmod.S
243040b3049SEd MasteSRCS+=		aeabi_uldivmod.S
244040b3049SEd MasteSRCS+=		switch16.S
245040b3049SEd MasteSRCS+=		switch32.S
246040b3049SEd MasteSRCS+=		switch8.S
247040b3049SEd MasteSRCS+=		switchu8.S
248040b3049SEd MasteSRCS+=		sync_synchronize.S
249040b3049SEd Maste.endif
25066ed7741SAdrian Chadd
2513487d668SJohn Baldwin.if ${MACHINE_ARCH:Mriscv*sf}
2523487d668SJohn BaldwinCFLAGS+=	-D__SOFT_FP__
2533487d668SJohn Baldwin.endif
254