1306377Semaste# $FreeBSD: stable/11/lib/libcompiler_rt/Makefile.inc 365661 2020-09-12 16:33:05Z dim $
2306377Semaste
3306377SemasteCRTARCH=	${MACHINE_CPUARCH:C/amd64/x86_64/}
4306377Semaste
5360660SdimCRTSRC=		${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins
6306377Semaste
7306377Semaste.PATH:		${CRTSRC}/${CRTARCH}
8306377Semaste.PATH:		${CRTSRC}
9306377Semaste
10306377SemasteSRCF+=		absvdi2
11306377SemasteSRCF+=		absvsi2
12306377SemasteSRCF+=		absvti2
13306377SemasteSRCF+=		addvdi3
14306377SemasteSRCF+=		addvsi3
15306377SemasteSRCF+=		addvti3
16306377SemasteSRCF+=		apple_versioning
17306377SemasteSRCF+=		ashldi3
18306377SemasteSRCF+=		ashlti3
19306377SemasteSRCF+=		ashrdi3
20306377SemasteSRCF+=		ashrti3
21365661SdimSRCF+=		bswapdi2
22365661SdimSRCF+=		bswapsi2
23306377SemasteSRCF+=		clear_cache
24306377SemasteSRCF+=		clzdi2
25306377SemasteSRCF+=		clzsi2
26306377SemasteSRCF+=		clzti2
27306377SemasteSRCF+=		cmpdi2
28306377SemasteSRCF+=		cmpti2
29306377SemasteSRCF+=		ctzdi2
30306377SemasteSRCF+=		ctzsi2
31306377SemasteSRCF+=		ctzti2
32306377SemasteSRCF+=		divdc3
33306377SemasteSRCF+=		divdi3
34306377SemasteSRCF+=		divmoddi4
35306377SemasteSRCF+=		divmodsi4
36306377SemasteSRCF+=		divsc3
37306377SemasteSRCF+=		divtc3
38306377SemasteSRCF+=		divti3
39306377SemasteSRCF+=		divxc3
40306377SemasteSRCF+=		enable_execute_stack
41306377SemasteSRCF+=		eprintf
42306377SemasteSRCF+=		extendhfsf2
43306377SemasteSRCF+=		ffsdi2
44324023SdimSRCF+=		ffssi2
45306377SemasteSRCF+=		ffsti2
46306377SemasteSRCF+=		fixdfdi
47306377SemasteSRCF+=		fixdfti
48306377SemasteSRCF+=		fixsfdi
49306377SemasteSRCF+=		fixsfti
50306377SemasteSRCF+=		fixunsdfdi
51306377SemasteSRCF+=		fixunsdfsi
52306377SemasteSRCF+=		fixunsdfti
53306377SemasteSRCF+=		fixunssfdi
54306377SemasteSRCF+=		fixunssfsi
55306377SemasteSRCF+=		fixunssfti
56306377SemasteSRCF+=		fixunsxfdi
57306377SemasteSRCF+=		fixunsxfsi
58306377SemasteSRCF+=		fixunsxfti
59306377SemasteSRCF+=		fixxfdi
60306377SemasteSRCF+=		fixxfti
61306377SemasteSRCF+=		floatditf
62306377SemasteSRCF+=		floattidf
63306377SemasteSRCF+=		floattisf
64306377SemasteSRCF+=		floattixf
65306377SemasteSRCF+=		floatunditf
66306377SemasteSRCF+=		floatunsidf
67306377SemasteSRCF+=		floatunsisf
68306377SemasteSRCF+=		floatuntidf
69306377SemasteSRCF+=		floatuntisf
70306377SemasteSRCF+=		floatuntixf
71360658SdimSRCF+=		gcc_personality_v0	# not in upstream
72306377SemasteSRCF+=		int_util
73306377SemasteSRCF+=		lshrdi3
74306377SemasteSRCF+=		lshrti3
75306377SemasteSRCF+=		moddi3
76306377SemasteSRCF+=		modti3
77306377SemasteSRCF+=		muldc3
78306377SemasteSRCF+=		muldi3
79306377SemasteSRCF+=		mulodi4
80306377SemasteSRCF+=		mulosi4
81306377SemasteSRCF+=		muloti4
82306377SemasteSRCF+=		mulsc3
83360784SdimSRCF+=		multc3
84306377SemasteSRCF+=		multi3
85306377SemasteSRCF+=		mulvdi3
86306377SemasteSRCF+=		mulvsi3
87306377SemasteSRCF+=		mulvti3
88306377SemasteSRCF+=		mulxc3
89306377SemasteSRCF+=		negdf2
90306377SemasteSRCF+=		negdi2
91306377SemasteSRCF+=		negsf2
92306377SemasteSRCF+=		negti2
93306377SemasteSRCF+=		negvdi2
94306377SemasteSRCF+=		negvsi2
95306377SemasteSRCF+=		negvti2
96306377SemasteSRCF+=		paritydi2
97306377SemasteSRCF+=		paritysi2
98306377SemasteSRCF+=		parityti2
99306377SemasteSRCF+=		popcountdi2
100306377SemasteSRCF+=		popcountsi2
101306377SemasteSRCF+=		popcountti2
102306377SemasteSRCF+=		powidf2
103306377SemasteSRCF+=		powisf2
104306377SemasteSRCF+=		powitf2
105306377SemasteSRCF+=		powixf2
106306377SemasteSRCF+=		subvdi3
107306377SemasteSRCF+=		subvsi3
108306377SemasteSRCF+=		subvti3
109306377SemasteSRCF+=		trampoline_setup
110306377SemasteSRCF+=		truncdfhf2
111306377SemasteSRCF+=		truncsfhf2
112306377SemasteSRCF+=		ucmpdi2
113306377SemasteSRCF+=		ucmpti2
114306377SemasteSRCF+=		udivdi3
115306377SemasteSRCF+=		udivmoddi4
116306377SemasteSRCF+=		udivmodsi4
117306377SemasteSRCF+=		udivmodti4
118306377SemasteSRCF+=		udivti3
119306377SemasteSRCF+=		umoddi3
120306377SemasteSRCF+=		umodti3
121306377Semaste
122365661Sdim# Enable compiler-rt's atomic implementation only for clang, as it uses clang
123365661Sdim# specific builtins, and gcc packages usually come with their own libatomic.
124365661Sdim# Exclude arm which has its own implementations of atomic functions, below.
125365661Sdim.if "${COMPILER_TYPE}" == "clang" && \
126365661Sdim    !(${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6")
127365661SdimSRCF+=		atomic
128365661Sdim.endif
129365661Sdim
130323188Sdim# Avoid using SSE2 instructions on i386, if unsupported.
131323188Sdim.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
132323187SdimSRCS+=		floatdidf.c
133323187SdimSRCS+=		floatdisf.c
134323187SdimSRCS+=		floatdixf.c
135323187SdimSRCS+=		floatundidf.c
136323187SdimSRCS+=		floatundisf.c
137323187SdimSRCS+=		floatundixf.c
138323187Sdim.else
139323187SdimSRCF+=		floatdidf
140323187SdimSRCF+=		floatdisf
141323187SdimSRCF+=		floatdixf
142323187SdimSRCF+=		floatundidf
143323187SdimSRCF+=		floatundisf
144323187SdimSRCF+=		floatundixf
145323187Sdim.endif
146323187Sdim
147310618Sdim# __cpu_model support, only used on x86
148310618Sdim.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
149310618SdimSRCF+=		cpu_model
150310618Sdim.endif
151310618Sdim
152360784Sdim# The fp_mode implementation for amd64 and i386 is shared, while other
153360784Sdim# architectures use the regular approach.
154360784Sdim.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
155360784SdimSRCS+=		i386/fp_mode.c
156360784Sdim.else
157360784SdimSRCF+=		fp_mode
158360784Sdim.endif
159360784Sdim
160360784Sdim#
161360784Sdim# 128-bit quad precision long double support,
162360784Sdim# only used on some architectures.
163360784Sdim#
164360784Sdim.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv"
165306377SemasteSRCF+=		addtf3
166306377SemasteSRCF+=		comparetf2
167306377SemasteSRCF+=		divtf3
168306377SemasteSRCF+=		extenddftf2
169306377SemasteSRCF+=		extendsftf2
170306377SemasteSRCF+=		fixtfdi
171306377SemasteSRCF+=		fixtfsi
172306377SemasteSRCF+=		fixtfti
173306377SemasteSRCF+=		fixunstfdi
174306377SemasteSRCF+=		fixunstfsi
175306377SemasteSRCF+=		fixunstfti
176360658SdimSRCF+=		floatsitf
177360658SdimSRCF+=		floattitf
178306377SemasteSRCF+=		floatunsitf
179360658SdimSRCF+=		floatuntitf
180306377SemasteSRCF+=		multf3
181306377SemasteSRCF+=		subtf3
182306377SemasteSRCF+=		trunctfdf2
183306377SemasteSRCF+=		trunctfsf2
184306377Semaste.endif
185306377Semaste
186306377Semaste# These are already shipped by libc.a on arm and mips
187306377Semaste.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
188306377SemasteSRCF+=		adddf3
189306377SemasteSRCF+=		addsf3
190306377SemasteSRCF+=		divdf3
191306377SemasteSRCF+=		divsf3
192306377SemasteSRCF+=		extendsfdf2
193306377SemasteSRCF+=		fixdfsi
194306377SemasteSRCF+=		fixsfsi
195306377SemasteSRCF+=		floatsidf
196306377SemasteSRCF+=		floatsisf
197306377SemasteSRCF+=		muldf3
198306377SemasteSRCF+=		mulsf3
199306377SemasteSRCF+=		subdf3
200306377SemasteSRCF+=		subsf3
201306377SemasteSRCF+=		truncdfsf2
202306377Semaste.endif
203306377Semaste
204306377Semaste.if ${MACHINE_CPUARCH} != "arm"
205306377SemasteSRCF+=		comparedf2
206306377SemasteSRCF+=		comparesf2
207306377Semaste.endif
208306377Semaste
209306377Semaste.if ${MACHINE_CPUARCH} != "mips"
210306377SemasteSRCF+=		divsi3
211306377SemasteSRCF+=		modsi3
212306377SemasteSRCF+=		udivsi3
213306377SemasteSRCF+=		umodsi3
214306377Semaste.endif
215306377Semaste
216306377Semaste# FreeBSD-specific atomic intrinsics.
217306377Semaste.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
218306377Semaste.PATH:		${SRCTOP}/sys/arm/arm
219306377Semaste
220306377SemasteSRCF+=		stdatomic
221306377SemasteCFLAGS+=	-DEMIT_SYNC_ATOMICS
222306377Semaste.elif ${MACHINE_CPUARCH} == "mips"
223306377Semaste.PATH:		${SRCTOP}/sys/mips/mips
224306377Semaste
225306377SemasteSRCF+=		stdatomic
226306377Semaste.endif
227306377Semaste
228306377Semaste.for file in ${SRCF}
229306377Semaste.if ${MACHINE_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
230306377Semaste    && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
231306377SemasteSRCS+=		${file}vfp.S
232306377Semaste. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
233306377SemasteSRCS+=		${file}.S
234306377Semaste. else
235306377SemasteSRCS+=		${file}.c
236306377Semaste. endif
237306377Semaste.endfor
238306377Semaste
239306377Semaste.if ${MACHINE_CPUARCH} == "arm"
240306377SemasteSRCS+=		aeabi_div0.c
241306377SemasteSRCS+=		aeabi_idivmod.S
242306377SemasteSRCS+=		aeabi_ldivmod.S
243306377SemasteSRCS+=		aeabi_memcmp.S
244306377SemasteSRCS+=		aeabi_memcpy.S
245306377SemasteSRCS+=		aeabi_memmove.S
246306377SemasteSRCS+=		aeabi_memset.S
247306377SemasteSRCS+=		aeabi_uidivmod.S
248306377SemasteSRCS+=		aeabi_uldivmod.S
249306377SemasteSRCS+=		switch16.S
250306377SemasteSRCS+=		switch32.S
251306377SemasteSRCS+=		switch8.S
252306377SemasteSRCS+=		switchu8.S
253306377SemasteSRCS+=		sync_synchronize.S
254306377Semaste.endif
255