xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1# $FreeBSD$
2
3CRTARCH=	${MACHINE_CPUARCH:C/amd64/x86_64/}
4
5CRTSRC=		${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins
6
7.PATH:		${CRTSRC}/${CRTARCH}
8.PATH:		${CRTSRC}
9
10SRCF+=		absvdi2
11SRCF+=		absvsi2
12SRCF+=		absvti2
13SRCF+=		addvdi3
14SRCF+=		addvsi3
15SRCF+=		addvti3
16SRCF+=		apple_versioning
17SRCF+=		ashldi3
18SRCF+=		ashlti3
19SRCF+=		ashrdi3
20SRCF+=		ashrti3
21SRCF+=		bswapdi2
22SRCF+=		bswapsi2
23SRCF+=		clear_cache
24SRCF+=		clzdi2
25SRCF+=		clzsi2
26SRCF+=		clzti2
27SRCF+=		cmpdi2
28SRCF+=		cmpti2
29SRCF+=		ctzdi2
30SRCF+=		ctzsi2
31SRCF+=		ctzti2
32SRCF+=		divdc3
33SRCF+=		divdi3
34SRCF+=		divmoddi4
35SRCF+=		divmodsi4
36SRCF+=		divmodti4
37SRCF+=		divsc3
38SRCF+=		divsi3
39SRCF+=		divtc3
40SRCF+=		divti3
41SRCF+=		divxc3
42SRCF+=		enable_execute_stack
43SRCF+=		eprintf
44SRCF+=		extendhfsf2
45SRCF+=		ffsdi2
46SRCF+=		ffssi2
47SRCF+=		ffsti2
48SRCF+=		fixdfdi
49SRCF+=		fixdfti
50SRCF+=		fixsfdi
51SRCF+=		fixsfti
52SRCF+=		fixunsdfdi
53SRCF+=		fixunsdfsi
54SRCF+=		fixunsdfti
55SRCF+=		fixunssfdi
56SRCF+=		fixunssfsi
57SRCF+=		fixunssfti
58SRCF+=		fixunsxfdi
59SRCF+=		fixunsxfsi
60SRCF+=		fixunsxfti
61SRCF+=		fixxfdi
62SRCF+=		fixxfti
63SRCF+=		floatditf
64SRCF+=		floattidf
65SRCF+=		floattisf
66SRCF+=		floattixf
67SRCF+=		floatunditf
68SRCF+=		floatunsidf
69SRCF+=		floatunsisf
70SRCF+=		floatuntidf
71SRCF+=		floatuntisf
72SRCF+=		floatuntixf
73SRCF+=		int_util
74SRCF+=		lshrdi3
75SRCF+=		lshrti3
76SRCF+=		moddi3
77SRCF+=		modsi3
78SRCF+=		modti3
79SRCF+=		muldc3
80SRCF+=		muldi3
81SRCF+=		mulodi4
82SRCF+=		mulosi4
83SRCF+=		muloti4
84SRCF+=		mulsc3
85SRCF+=		multc3
86SRCF+=		multi3
87SRCF+=		mulvdi3
88SRCF+=		mulvsi3
89SRCF+=		mulvti3
90SRCF+=		mulxc3
91SRCF+=		negdf2
92SRCF+=		negdi2
93SRCF+=		negsf2
94SRCF+=		negti2
95SRCF+=		negvdi2
96SRCF+=		negvsi2
97SRCF+=		negvti2
98SRCF+=		paritydi2
99SRCF+=		paritysi2
100SRCF+=		parityti2
101SRCF+=		popcountdi2
102SRCF+=		popcountsi2
103SRCF+=		popcountti2
104SRCF+=		powidf2
105SRCF+=		powisf2
106SRCF+=		powitf2
107SRCF+=		powixf2
108SRCF+=		subvdi3
109SRCF+=		subvsi3
110SRCF+=		subvti3
111SRCF+=		trampoline_setup
112SRCF+=		truncdfhf2
113SRCF+=		truncsfhf2
114SRCF+=		ucmpdi2
115SRCF+=		ucmpti2
116SRCF+=		udivdi3
117SRCF+=		udivmoddi4
118SRCF+=		udivmodsi4
119SRCF+=		udivmodti4
120SRCF+=		udivsi3
121SRCF+=		udivti3
122SRCF+=		umoddi3
123SRCF+=		umodsi3
124SRCF+=		umodti3
125
126# Enable compiler-rt's atomic implementation only for clang, as it uses clang
127# specific builtins, and gcc packages usually come with their own libatomic.
128# Exclude arm which has its own implementations of atomic functions, below.
129.if "${COMPILER_TYPE}" == "clang" && ${MACHINE_CPUARCH} != "arm"
130SRCF+=		atomic
131.endif
132
133# Avoid using SSE2 instructions on i386, if unsupported.
134.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
135SRCS+=		floatdidf.c
136SRCS+=		floatdisf.c
137SRCS+=		floatdixf.c
138SRCS+=		floatundidf.c
139SRCS+=		floatundisf.c
140SRCS+=		floatundixf.c
141.else
142SRCF+=		floatdidf
143SRCF+=		floatdisf
144SRCF+=		floatdixf
145SRCF+=		floatundidf
146SRCF+=		floatundisf
147SRCF+=		floatundixf
148.endif
149
150# __cpu_model support, only used on aarch64 and x86
151.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
152    ${MACHINE_CPUARCH} == "i386"
153SRCF+=		cpu_model
154.endif
155
156# The fp_mode implementation for amd64 and i386 is shared, while other
157# architectures use the regular approach.
158.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
159SRCS+=		i386/fp_mode.c
160.else
161SRCF+=		fp_mode
162.endif
163
164#
165# 128-bit quad precision long double support,
166# only used on some architectures.
167#
168.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
169SRCF+=		addtf3
170SRCF+=		comparetf2
171SRCF+=		divtf3
172SRCF+=		extenddftf2
173SRCF+=		extendhftf2
174SRCF+=		extendsftf2
175SRCF+=		fixtfdi
176SRCF+=		fixtfsi
177SRCF+=		fixtfti
178SRCF+=		fixunstfdi
179SRCF+=		fixunstfsi
180SRCF+=		fixunstfti
181SRCF+=		floatsitf
182SRCF+=		floattitf
183SRCF+=		floatunsitf
184SRCF+=		floatuntitf
185SRCF+=		multf3
186SRCF+=		subtf3
187SRCF+=		trunctfdf2
188SRCF+=		trunctfhf2
189SRCF+=		trunctfsf2
190.endif
191
192# These are already shipped by libc.a on some architectures.
193.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \
194    ${MACHINE_CPUARCH} != "riscv"
195SRCF+=		adddf3
196SRCF+=		addsf3
197SRCF+=		divdf3
198SRCF+=		divsf3
199SRCF+=		extendsfdf2
200SRCF+=		fixdfsi
201SRCF+=		fixsfsi
202SRCF+=		floatsidf
203SRCF+=		floatsisf
204SRCF+=		muldf3
205SRCF+=		mulsf3
206SRCF+=		subdf3
207SRCF+=		subsf3
208SRCF+=		truncdfsf2
209.endif
210
211.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
212SRCF+=		comparedf2
213SRCF+=		comparesf2
214.endif
215
216# FreeBSD-specific atomic intrinsics.
217.if ${MACHINE_CPUARCH} == "arm"
218.PATH:		${SRCTOP}/sys/arm/arm
219
220SRCF+=		stdatomic
221CFLAGS+=	-DEMIT_SYNC_ATOMICS
222.elif ${MACHINE_CPUARCH} == "mips"
223.PATH:		${SRCTOP}/sys/mips/mips
224
225SRCF+=		stdatomic
226.endif
227
228.for file in ${SRCF}
229.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
230    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
231SRCS+=		${file}vfp.S
232. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
233SRCS+=		${file}.S
234. else
235SRCS+=		${file}.c
236. endif
237.endfor
238
239.if ${MACHINE_CPUARCH} == "arm"
240SRCS+=		aeabi_div0.c
241SRCS+=		aeabi_idivmod.S
242SRCS+=		aeabi_ldivmod.S
243SRCS+=		aeabi_memcmp.S
244SRCS+=		aeabi_memcpy.S
245SRCS+=		aeabi_memmove.S
246SRCS+=		aeabi_memset.S
247SRCS+=		aeabi_uidivmod.S
248SRCS+=		aeabi_uldivmod.S
249SRCS+=		switch16.S
250SRCS+=		switch32.S
251SRCS+=		switch8.S
252SRCS+=		switchu8.S
253SRCS+=		sync_synchronize.S
254.endif
255
256.if ${MACHINE_ARCH:Mriscv*sf}
257CFLAGS+=	-D__SOFT_FP__
258.endif
259