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