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