xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision 1ab9996fb5fafce958fc0d22f68ee16a50d56638)
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+=		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+=		extendhftf2
173SRCF+=		extendsftf2
174SRCF+=		fixtfdi
175SRCF+=		fixtfsi
176SRCF+=		fixtfti
177SRCF+=		fixunstfdi
178SRCF+=		fixunstfsi
179SRCF+=		fixunstfti
180SRCF+=		floatsitf
181SRCF+=		floattitf
182SRCF+=		floatunsitf
183SRCF+=		floatuntitf
184SRCF+=		multf3
185SRCF+=		subtf3
186SRCF+=		trunctfdf2
187SRCF+=		trunctfhf2
188SRCF+=		trunctfsf2
189.endif
190
191# These are already shipped by libc.a on some architectures.
192.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "riscv"
193SRCF+=		adddf3
194SRCF+=		addsf3
195SRCF+=		divdf3
196SRCF+=		divsf3
197SRCF+=		extendsfdf2
198SRCF+=		fixdfsi
199SRCF+=		fixsfsi
200SRCF+=		floatsidf
201SRCF+=		floatsisf
202SRCF+=		muldf3
203SRCF+=		mulsf3
204SRCF+=		subdf3
205SRCF+=		subsf3
206SRCF+=		truncdfsf2
207.endif
208
209.if ${MACHINE_CPUARCH} != "arm"
210SRCF+=		comparedf2
211SRCF+=		comparesf2
212.endif
213
214# FreeBSD-specific atomic intrinsics.
215.if ${MACHINE_CPUARCH} == "arm"
216.PATH:		${SRCTOP}/sys/arm/arm
217
218SRCF+=		stdatomic
219CFLAGS+=	-DEMIT_SYNC_ATOMICS
220.endif
221
222.for file in ${SRCF}
223.if ${MACHINE_CPUARCH} == "arm" && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
224    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
225SRCS+=		${file}vfp.S
226. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
227SRCS+=		${file}.S
228. else
229SRCS+=		${file}.c
230. endif
231.endfor
232
233.if ${MACHINE_CPUARCH} == "arm"
234SRCS+=		aeabi_div0.c
235SRCS+=		aeabi_idivmod.S
236SRCS+=		aeabi_ldivmod.S
237SRCS+=		aeabi_memcmp.S
238SRCS+=		aeabi_memcpy.S
239SRCS+=		aeabi_memmove.S
240SRCS+=		aeabi_memset.S
241SRCS+=		aeabi_uidivmod.S
242SRCS+=		aeabi_uldivmod.S
243SRCS+=		switch16.S
244SRCS+=		switch32.S
245SRCS+=		switch8.S
246SRCS+=		switchu8.S
247SRCS+=		sync_synchronize.S
248.endif
249
250.if ${MACHINE_ARCH:Mriscv*sf}
251CFLAGS+=	-D__SOFT_FP__
252.endif
253