xref: /freebsd/lib/libcompiler_rt/Makefile.inc (revision 6f1af0d7d2af54b339b5212434cd6d4fda628d80)
1
2CRTARCH=	${MACHINE_CPUARCH:C/amd64/x86_64/}
3
4CRTSRC=		${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins
5
6.PATH:		${CRTSRC}/${CRTARCH}
7.PATH:		${CRTSRC}
8
9SRCF+=		absvdi2
10SRCF+=		absvsi2
11SRCF+=		absvti2
12SRCF+=		addvdi3
13SRCF+=		addvsi3
14SRCF+=		addvti3
15SRCF+=		apple_versioning
16SRCF+=		ashldi3
17SRCF+=		ashlti3
18SRCF+=		ashrdi3
19SRCF+=		ashrti3
20SRCF+=		bswapdi2
21SRCF+=		bswapsi2
22SRCF+=		clear_cache
23SRCF+=		clzdi2
24SRCF+=		clzsi2
25SRCF+=		clzti2
26SRCF+=		cmpdi2
27SRCF+=		cmpti2
28SRCF+=		ctzdi2
29SRCF+=		ctzsi2
30SRCF+=		ctzti2
31SRCF+=		divdc3
32SRCF+=		divdi3
33SRCF+=		divmoddi4
34SRCF+=		divmodsi4
35SRCF+=		divmodti4
36SRCF+=		divsc3
37SRCF+=		divsi3
38SRCF+=		divtc3
39SRCF+=		divti3
40SRCF+=		divxc3
41SRCF+=		enable_execute_stack
42SRCF+=		extendhfsf2
43SRCF+=		ffsdi2
44SRCF+=		ffssi2
45SRCF+=		ffsti2
46SRCF+=		fixdfdi
47SRCF+=		fixdfti
48SRCF+=		fixsfdi
49SRCF+=		fixsfti
50SRCF+=		fixunsdfdi
51SRCF+=		fixunsdfsi
52SRCF+=		fixunsdfti
53SRCF+=		fixunssfdi
54SRCF+=		fixunssfsi
55SRCF+=		fixunssfti
56SRCF+=		fixunsxfdi
57SRCF+=		fixunsxfsi
58SRCF+=		fixunsxfti
59SRCF+=		fixxfdi
60SRCF+=		fixxfti
61SRCF+=		floatditf
62SRCF+=		floattidf
63SRCF+=		floattisf
64SRCF+=		floattixf
65SRCF+=		floatunditf
66SRCF+=		floatunsidf
67SRCF+=		floatunsisf
68SRCF+=		floatuntidf
69SRCF+=		floatuntisf
70SRCF+=		floatuntixf
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+=		multc3
84SRCF+=		multi3
85SRCF+=		mulvdi3
86SRCF+=		mulvsi3
87SRCF+=		mulvti3
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# Enable compiler-rt's atomic implementation only for clang, as it uses clang
125# specific builtins, and gcc packages usually come with their own libatomic.
126# Exclude arm which has its own implementations of atomic functions, below.
127.if "${COMPILER_TYPE}" == "clang" && ${MACHINE_CPUARCH} != "arm"
128SRCF+=		atomic
129.endif
130
131# Avoid using SSE2 instructions on i386, if unsupported.
132.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2)
133SRCS+=		floatdidf.c
134SRCS+=		floatdisf.c
135SRCS+=		floatdixf.c
136SRCS+=		floatundidf.c
137SRCS+=		floatundisf.c
138SRCS+=		floatundixf.c
139.else
140SRCF+=		floatdidf
141SRCF+=		floatdisf
142SRCF+=		floatdixf
143SRCF+=		floatundidf
144SRCF+=		floatundisf
145SRCF+=		floatundixf
146.endif
147
148# __cpu_model support, only used on aarch64 and x86
149.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
150    ${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+=		extendhftf2
172SRCF+=		extendsftf2
173SRCF+=		fixtfdi
174SRCF+=		fixtfsi
175SRCF+=		fixtfti
176SRCF+=		fixunstfdi
177SRCF+=		fixunstfsi
178SRCF+=		fixunstfti
179SRCF+=		floatsitf
180SRCF+=		floattitf
181SRCF+=		floatunsitf
182SRCF+=		floatuntitf
183SRCF+=		multf3
184SRCF+=		subtf3
185SRCF+=		trunctfdf2
186SRCF+=		trunctfhf2
187SRCF+=		trunctfsf2
188.endif
189
190# These are already shipped by libc.a on some architectures.
191.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "riscv"
192SRCF+=		adddf3
193SRCF+=		addsf3
194SRCF+=		divdf3
195SRCF+=		divsf3
196SRCF+=		extendsfdf2
197SRCF+=		fixdfsi
198SRCF+=		fixsfsi
199SRCF+=		floatsidf
200SRCF+=		floatsisf
201SRCF+=		muldf3
202SRCF+=		mulsf3
203SRCF+=		subdf3
204SRCF+=		subsf3
205SRCF+=		truncdfsf2
206.endif
207
208.if ${MACHINE_CPUARCH} != "arm"
209SRCF+=		comparedf2
210SRCF+=		comparesf2
211.endif
212
213# FreeBSD-specific atomic intrinsics.
214.if ${MACHINE_CPUARCH} == "arm"
215.PATH:		${SRCTOP}/sys/arm/arm
216
217SRCF+=		stdatomic
218CFLAGS+=	-DEMIT_SYNC_ATOMICS
219.endif
220
221.for file in ${SRCF}
222.if ${MACHINE_CPUARCH} == "arm" && (!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+=		switch16.S
243SRCS+=		switch32.S
244SRCS+=		switch8.S
245SRCS+=		switchu8.S
246SRCS+=		sync_synchronize.S
247.endif
248