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