xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision c90cb435038879b0bd0f830bd1e460f6838d9b8c)
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.if "${COMPILER_TYPE}" == "clang"
128SRCF+=		atomic
129.endif
130
131# Avoid using SSE2 instructions on i386, if unsupported.
132.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
133SRCS+=		floatdidf.c
134SRCS+=		floatdisf.c
135SRCS+=		floatdixf.c
136SRCS+=		floatundidf.c
137SRCS+=		floatundisf.c
138SRCS+=		floatundixf.c
139.else
140SRCF+=		floatdidf
141SRCF+=		floatdisf
142SRCF+=		floatdixf
143SRCF+=		floatundidf
144SRCF+=		floatundisf
145SRCF+=		floatundixf
146.endif
147
148# __cpu_model support, only used on x86
149.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
150SRCF+=		cpu_model
151.endif
152
153# The fp_mode implementation for amd64 and i386 is shared, while other
154# architectures use the regular approach.
155.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
156SRCS+=		i386/fp_mode.c
157.else
158SRCF+=		fp_mode
159.endif
160
161#
162# 128-bit quad precision long double support,
163# only used on some architectures.
164#
165.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
166SRCF+=		addtf3
167SRCF+=		comparetf2
168SRCF+=		divtf3
169SRCF+=		extenddftf2
170SRCF+=		extendsftf2
171SRCF+=		fixtfdi
172SRCF+=		fixtfsi
173SRCF+=		fixtfti
174SRCF+=		fixunstfdi
175SRCF+=		fixunstfsi
176SRCF+=		fixunstfti
177SRCF+=		floatsitf
178SRCF+=		floattitf
179SRCF+=		floatunsitf
180SRCF+=		floatuntitf
181SRCF+=		multf3
182SRCF+=		subtf3
183SRCF+=		trunctfdf2
184SRCF+=		trunctfsf2
185.endif
186
187# These are already shipped by libc.a on some architectures.
188.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \
189    ${MACHINE_CPUARCH} != "riscv"
190SRCF+=		adddf3
191SRCF+=		addsf3
192SRCF+=		divdf3
193SRCF+=		divsf3
194SRCF+=		extendsfdf2
195SRCF+=		fixdfsi
196SRCF+=		fixsfsi
197SRCF+=		floatsidf
198SRCF+=		floatsisf
199SRCF+=		muldf3
200SRCF+=		mulsf3
201SRCF+=		subdf3
202SRCF+=		subsf3
203SRCF+=		truncdfsf2
204.endif
205
206.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
207SRCF+=		comparedf2
208SRCF+=		comparesf2
209.endif
210
211# FreeBSD-specific atomic intrinsics.
212.if ${MACHINE_CPUARCH} == "arm"
213.PATH:		${SRCTOP}/sys/arm/arm
214
215SRCF+=		stdatomic
216CFLAGS+=	-DEMIT_SYNC_ATOMICS
217.elif ${MACHINE_CPUARCH} == "mips"
218.PATH:		${SRCTOP}/sys/mips/mips
219
220SRCF+=		stdatomic
221.endif
222
223.for file in ${SRCF}
224.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
225    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
226SRCS+=		${file}vfp.S
227. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
228SRCS+=		${file}.S
229. else
230SRCS+=		${file}.c
231. endif
232.endfor
233
234.if ${MACHINE_CPUARCH} == "arm"
235SRCS+=		aeabi_div0.c
236SRCS+=		aeabi_idivmod.S
237SRCS+=		aeabi_ldivmod.S
238SRCS+=		aeabi_memcmp.S
239SRCS+=		aeabi_memcpy.S
240SRCS+=		aeabi_memmove.S
241SRCS+=		aeabi_memset.S
242SRCS+=		aeabi_uidivmod.S
243SRCS+=		aeabi_uldivmod.S
244SRCS+=		switch16.S
245SRCS+=		switch32.S
246SRCS+=		switch8.S
247SRCS+=		switchu8.S
248SRCS+=		sync_synchronize.S
249.endif
250
251.if ${MACHINE_ARCH:Mriscv*sf}
252CFLAGS+=	-D__SOFT_FP__
253.endif
254