xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision a7dea1671b87c07d2d266f836bfa8b58efc7c134)
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+=		gcc_personality_v0	# not in upstream
71SRCF+=		int_util
72SRCF+=		lshrdi3
73SRCF+=		lshrti3
74SRCF+=		moddi3
75SRCF+=		modsi3
76SRCF+=		modti3
77SRCF+=		muldc3
78SRCF+=		muldi3
79SRCF+=		mulodi4
80SRCF+=		mulosi4
81SRCF+=		muloti4
82SRCF+=		mulsc3
83SRCF+=		multi3
84SRCF+=		mulvdi3
85SRCF+=		mulvsi3
86SRCF+=		mulvti3
87SRCF+=		multc3
88SRCF+=		mulxc3
89SRCF+=		negdf2
90SRCF+=		negdi2
91SRCF+=		negsf2
92SRCF+=		negti2
93SRCF+=		negvdi2
94SRCF+=		negvsi2
95SRCF+=		negvti2
96SRCF+=		paritydi2
97SRCF+=		paritysi2
98SRCF+=		parityti2
99SRCF+=		popcountdi2
100SRCF+=		popcountsi2
101SRCF+=		popcountti2
102SRCF+=		powidf2
103SRCF+=		powisf2
104SRCF+=		powitf2
105SRCF+=		powixf2
106SRCF+=		subvdi3
107SRCF+=		subvsi3
108SRCF+=		subvti3
109SRCF+=		trampoline_setup
110SRCF+=		truncdfhf2
111SRCF+=		truncsfhf2
112SRCF+=		ucmpdi2
113SRCF+=		ucmpti2
114SRCF+=		udivdi3
115SRCF+=		udivmoddi4
116SRCF+=		udivmodsi4
117SRCF+=		udivmodti4
118SRCF+=		udivsi3
119SRCF+=		udivti3
120SRCF+=		umoddi3
121SRCF+=		umodsi3
122SRCF+=		umodti3
123
124# Avoid using SSE2 instructions on i386, if unsupported.
125.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
126SRCS+=		floatdidf.c
127SRCS+=		floatdisf.c
128SRCS+=		floatdixf.c
129SRCS+=		floatundidf.c
130SRCS+=		floatundisf.c
131SRCS+=		floatundixf.c
132.else
133SRCF+=		floatdidf
134SRCF+=		floatdisf
135SRCF+=		floatdixf
136SRCF+=		floatundidf
137SRCF+=		floatundisf
138SRCF+=		floatundixf
139.endif
140
141# __cpu_model support, only used on x86
142.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
143SRCF+=		cpu_model
144.endif
145
146#
147# 128-bit quad precision long double support,
148# only used on some architectures.
149#
150.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
151SRCF+=		addtf3
152SRCF+=		comparetf2
153SRCF+=		divtf3
154SRCF+=		extenddftf2
155SRCF+=		extendsftf2
156SRCF+=		fixtfdi
157SRCF+=		fixtfsi
158SRCF+=		fixtfti
159SRCF+=		fixunstfdi
160SRCF+=		fixunstfsi
161SRCF+=		fixunstfti
162SRCF+=		floatsitf
163SRCF+=		floattitf
164SRCF+=		floatunsitf
165SRCF+=		floatuntitf
166SRCF+=		multf3
167SRCF+=		subtf3
168SRCF+=		trunctfdf2
169SRCF+=		trunctfsf2
170.endif
171
172# These are already shipped by libc.a on some architectures.
173.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \
174    ${MACHINE_CPUARCH} != "riscv"
175SRCF+=		adddf3
176SRCF+=		addsf3
177SRCF+=		divdf3
178SRCF+=		divsf3
179SRCF+=		extendsfdf2
180SRCF+=		fixdfsi
181SRCF+=		fixsfsi
182SRCF+=		floatsidf
183SRCF+=		floatsisf
184SRCF+=		muldf3
185SRCF+=		mulsf3
186SRCF+=		subdf3
187SRCF+=		subsf3
188SRCF+=		truncdfsf2
189.endif
190
191.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
192SRCF+=		comparedf2
193SRCF+=		comparesf2
194.endif
195
196# FreeBSD-specific atomic intrinsics.
197.if ${MACHINE_CPUARCH} == "arm"
198.PATH:		${SRCTOP}/sys/arm/arm
199
200SRCF+=		stdatomic
201CFLAGS+=	-DEMIT_SYNC_ATOMICS
202.elif ${MACHINE_CPUARCH} == "mips"
203.PATH:		${SRCTOP}/sys/mips/mips
204
205SRCF+=		stdatomic
206.endif
207
208
209.if "${COMPILER_TYPE}" == "clang" && \
210    (${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe")
211SRCS+=          atomic.c
212CFLAGS.atomic.c+=      -Wno-atomic-alignment
213.endif
214
215
216.for file in ${SRCF}
217.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
218    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
219SRCS+=		${file}vfp.S
220. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
221SRCS+=		${file}.S
222. else
223SRCS+=		${file}.c
224. endif
225.endfor
226
227.if ${MACHINE_CPUARCH} == "arm"
228SRCS+=		aeabi_div0.c
229SRCS+=		aeabi_idivmod.S
230SRCS+=		aeabi_ldivmod.S
231SRCS+=		aeabi_memcmp.S
232SRCS+=		aeabi_memcpy.S
233SRCS+=		aeabi_memmove.S
234SRCS+=		aeabi_memset.S
235SRCS+=		aeabi_uidivmod.S
236SRCS+=		aeabi_uldivmod.S
237SRCS+=		bswapdi2.S
238SRCS+=		bswapsi2.S
239SRCS+=		switch16.S
240SRCS+=		switch32.S
241SRCS+=		switch8.S
242SRCS+=		switchu8.S
243SRCS+=		sync_synchronize.S
244.endif
245
246# On some archs GCC-6.3 requires bswap32 built-in.
247.if ${MACHINE_CPUARCH} == "mips" || ${MACHINE_CPUARCH} == "riscv" || \
248    ${MACHINE_CPUARCH} == "sparc64"
249SRCS+=		bswapdi2.c
250SRCS+=		bswapsi2.c
251.endif
252
253.if ${MACHINE_ARCH:Mriscv*sf}
254CFLAGS+=	-D__SOFT_FP__
255.endif
256