xref: /freebsd/lib/libcompiler_rt/Makefile (revision a70cba95822f662d3f9da5119b6a0c433e8f70af)
1a3cf0ef5SEd Schouten# $FreeBSD$
2a3cf0ef5SEd Schouten
3c6063d0dSWarner Losh.include <src.opts.mk>
4a3cf0ef5SEd Schouten
5*a70cba95SGlen BarberPACKAGE=lib${LIB}
6a3cf0ef5SEd SchoutenLIB=	compiler_rt
7a3cf0ef5SEd SchoutenNO_PIC=
8a3cf0ef5SEd SchoutenWARNS?=	2
9a3cf0ef5SEd Schouten
10a1896337SEd SchoutenCFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
117ff61602SDimitry AndricCFLAGS+=-I${.CURDIR}/../../contrib/libcxxrt
12a3cf0ef5SEd Schouten
13a3cf0ef5SEd Schouten.if ${MACHINE_CPUARCH} == "amd64"
14a3cf0ef5SEd SchoutenCRTARCH=x86_64
15a3cf0ef5SEd Schouten.else
16a3cf0ef5SEd SchoutenCRTARCH=${MACHINE_CPUARCH}
17a3cf0ef5SEd Schouten.endif
18a3cf0ef5SEd Schouten
19f4341a5aSDimitry AndricCRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins
20a3cf0ef5SEd Schouten
21a3cf0ef5SEd Schouten.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
22a3cf0ef5SEd Schouten
23a3cf0ef5SEd SchoutenSRCF=	absvdi2 \
24a3cf0ef5SEd Schouten	absvsi2 \
25a3cf0ef5SEd Schouten	absvti2 \
26a3cf0ef5SEd Schouten	addvdi3 \
27a3cf0ef5SEd Schouten	addvsi3 \
28a3cf0ef5SEd Schouten	addvti3 \
29f4341a5aSDimitry Andric	apple_versioning \
30a3cf0ef5SEd Schouten	ashldi3 \
31a3cf0ef5SEd Schouten	ashlti3 \
32a3cf0ef5SEd Schouten	ashrdi3 \
33a3cf0ef5SEd Schouten	ashrti3 \
348b02079fSAndrew Turner	clear_cache \
35a3cf0ef5SEd Schouten	clzdi2 \
36a3cf0ef5SEd Schouten	clzsi2 \
37a3cf0ef5SEd Schouten	clzti2 \
38a3cf0ef5SEd Schouten	cmpdi2 \
39a3cf0ef5SEd Schouten	cmpti2 \
40a3cf0ef5SEd Schouten	ctzdi2 \
41a3cf0ef5SEd Schouten	ctzsi2 \
42a3cf0ef5SEd Schouten	ctzti2 \
43a3cf0ef5SEd Schouten	divdc3 \
44a3cf0ef5SEd Schouten	divdi3 \
45ef8821e5SEd Schouten	divmoddi4 \
46ef8821e5SEd Schouten	divmodsi4 \
47a3cf0ef5SEd Schouten	divsc3 \
48a3cf0ef5SEd Schouten	divti3 \
49a3cf0ef5SEd Schouten	divxc3 \
50a3cf0ef5SEd Schouten	enable_execute_stack \
51a3cf0ef5SEd Schouten	eprintf \
5285279087SDimitry Andric	extendhfsf2 \
53a3cf0ef5SEd Schouten	ffsdi2 \
54a3cf0ef5SEd Schouten	ffsti2 \
55a3cf0ef5SEd Schouten	fixdfdi \
56a3cf0ef5SEd Schouten	fixdfti \
57a3cf0ef5SEd Schouten	fixsfdi \
58a3cf0ef5SEd Schouten	fixsfti \
59a3cf0ef5SEd Schouten	fixunsdfdi \
60a3cf0ef5SEd Schouten	fixunsdfsi \
61a3cf0ef5SEd Schouten	fixunsdfti \
62a3cf0ef5SEd Schouten	fixunssfdi \
63a3cf0ef5SEd Schouten	fixunssfsi \
64a3cf0ef5SEd Schouten	fixunssfti \
65a3cf0ef5SEd Schouten	fixunsxfdi \
66a3cf0ef5SEd Schouten	fixunsxfsi \
67a3cf0ef5SEd Schouten	fixunsxfti \
68a3cf0ef5SEd Schouten	fixxfdi \
69a3cf0ef5SEd Schouten	fixxfti \
70a3cf0ef5SEd Schouten	floatdidf \
71a3cf0ef5SEd Schouten	floatdisf \
726853d12dSEd Maste	floatditf \
73a3cf0ef5SEd Schouten	floatdixf \
74b4a5ecf6SEd Maste	floatsitf \
75a3cf0ef5SEd Schouten	floattidf \
76a3cf0ef5SEd Schouten	floattisf \
77a3cf0ef5SEd Schouten	floattixf \
78a3cf0ef5SEd Schouten	floatundidf \
79a3cf0ef5SEd Schouten	floatundisf \
806853d12dSEd Maste	floatunditf \
81a3cf0ef5SEd Schouten	floatundixf \
82a3cf0ef5SEd Schouten	floatunsidf \
83a3cf0ef5SEd Schouten	floatunsisf \
84a3cf0ef5SEd Schouten	floatuntidf \
85a3cf0ef5SEd Schouten	floatuntisf \
86a3cf0ef5SEd Schouten	floatuntixf \
87f4341a5aSDimitry Andric	gcc_personality_v0 \
887686ff74SEd Schouten	int_util \
89a3cf0ef5SEd Schouten	lshrdi3 \
90a3cf0ef5SEd Schouten	lshrti3 \
91a3cf0ef5SEd Schouten	moddi3 \
92a3cf0ef5SEd Schouten	modti3 \
93a3cf0ef5SEd Schouten	muldc3 \
94a3cf0ef5SEd Schouten	muldi3 \
957686ff74SEd Schouten	mulodi4 \
967686ff74SEd Schouten	mulosi4 \
977686ff74SEd Schouten	muloti4 \
98a3cf0ef5SEd Schouten	mulsc3 \
99a3cf0ef5SEd Schouten	multi3 \
100a3cf0ef5SEd Schouten	mulvdi3 \
101a3cf0ef5SEd Schouten	mulvsi3 \
102a3cf0ef5SEd Schouten	mulvti3 \
10313553dc6SEd Maste	multc3 \
104a3cf0ef5SEd Schouten	mulxc3 \
105a3cf0ef5SEd Schouten	negdf2 \
106a3cf0ef5SEd Schouten	negdi2 \
107a3cf0ef5SEd Schouten	negsf2 \
108a3cf0ef5SEd Schouten	negti2 \
109a3cf0ef5SEd Schouten	negvdi2 \
110a3cf0ef5SEd Schouten	negvsi2 \
111a3cf0ef5SEd Schouten	negvti2 \
112a3cf0ef5SEd Schouten	paritydi2 \
113a3cf0ef5SEd Schouten	paritysi2 \
114a3cf0ef5SEd Schouten	parityti2 \
115a3cf0ef5SEd Schouten	popcountdi2 \
116a3cf0ef5SEd Schouten	popcountsi2 \
117a3cf0ef5SEd Schouten	popcountti2 \
118a3cf0ef5SEd Schouten	powidf2 \
119a3cf0ef5SEd Schouten	powisf2 \
120a3cf0ef5SEd Schouten	powitf2 \
121a3cf0ef5SEd Schouten	powixf2 \
122a3cf0ef5SEd Schouten	subvdi3 \
123a3cf0ef5SEd Schouten	subvsi3 \
124a3cf0ef5SEd Schouten	subvti3 \
125a3cf0ef5SEd Schouten	trampoline_setup \
12685279087SDimitry Andric	truncdfhf2 \
12785279087SDimitry Andric	truncsfhf2 \
128a3cf0ef5SEd Schouten	ucmpdi2 \
129a3cf0ef5SEd Schouten	ucmpti2 \
130a3cf0ef5SEd Schouten	udivdi3 \
131a3cf0ef5SEd Schouten	udivmoddi4 \
132ef8821e5SEd Schouten	udivmodsi4 \
133a3cf0ef5SEd Schouten	udivmodti4 \
134a3cf0ef5SEd Schouten	udivti3 \
135a3cf0ef5SEd Schouten	umoddi3 \
136a3cf0ef5SEd Schouten	umodti3
137a3cf0ef5SEd Schouten
138eade5b38SEd Maste# 128-bit quad precision long double support, only used on arm64
139eade5b38SEd Maste.if ${MACHINE_CPUARCH} == "aarch64"
140eade5b38SEd MasteSRCF+=	addtf3 \
141eade5b38SEd Maste	comparetf2 \
142eade5b38SEd Maste	divtf3 \
143eade5b38SEd Maste	extenddftf2 \
144eade5b38SEd Maste	extendsftf2 \
145eade5b38SEd Maste	fixtfdi \
146eade5b38SEd Maste	fixtfsi \
147eade5b38SEd Maste	fixtfti \
148eade5b38SEd Maste	fixunstfdi \
149eade5b38SEd Maste	fixunstfsi \
150eade5b38SEd Maste	fixunstfti \
15195f23d6eSEd Maste	floatunsitf \
152eade5b38SEd Maste	multf3 \
153eade5b38SEd Maste	subtf3 \
154eade5b38SEd Maste	trunctfdf2 \
155eade5b38SEd Maste	trunctfsf2
156eade5b38SEd Maste.endif
157eade5b38SEd Maste
158a3cf0ef5SEd Schouten# These are already shipped by libc.a on arm and mips
159a3cf0ef5SEd Schouten.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
160a3cf0ef5SEd SchoutenSRCF+=	adddf3 \
161a3cf0ef5SEd Schouten	addsf3 \
162a3cf0ef5SEd Schouten	divdf3 \
163a3cf0ef5SEd Schouten	divsf3 \
164a3cf0ef5SEd Schouten	extendsfdf2 \
165a3cf0ef5SEd Schouten	fixdfsi \
166a3cf0ef5SEd Schouten	fixsfsi \
167a3cf0ef5SEd Schouten	floatsidf \
168a3cf0ef5SEd Schouten	floatsisf \
169a3cf0ef5SEd Schouten	muldf3 \
170a3cf0ef5SEd Schouten	mulsf3 \
171ef8821e5SEd Schouten	subdf3 \
172ef8821e5SEd Schouten	subsf3 \
173bb41cbb2SAndrew Turner	truncdfsf2
174bb41cbb2SAndrew Turner.endif
175bb41cbb2SAndrew Turner
176d6a052e0SAndrew Turner.if ${MACHINE_CPUARCH} != "arm"
177d6a052e0SAndrew TurnerSRCF+=	comparedf2 \
178d6a052e0SAndrew Turner	comparesf2
179d6a052e0SAndrew Turner.endif
180d6a052e0SAndrew Turner
1816d4766c1SAndrew Turner.if ${MACHINE_CPUARCH} != "mips"
182bb41cbb2SAndrew TurnerSRCF+=	divsi3 \
183bb41cbb2SAndrew Turner	modsi3 \
184a3cf0ef5SEd Schouten	udivsi3 \
185a3cf0ef5SEd Schouten	umodsi3
186a3cf0ef5SEd Schouten.endif
187a3cf0ef5SEd Schouten
1880315980bSEd Schouten# FreeBSD-specific atomic intrinsics.
189e1c0c642SDavid Chisnall.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
1902d5add2aSEd Schouten.PATH: ${.CURDIR}/../../sys/arm/arm
1912d5add2aSEd Schouten
1922d5add2aSEd SchoutenSRCF+=	stdatomic
193e1c0c642SDavid ChisnallCFLAGS+=	-DEMIT_SYNC_ATOMICS
194e737464fSEd Schouten.elif ${MACHINE_CPUARCH} == "mips"
195e737464fSEd Schouten.PATH: ${.CURDIR}/../../sys/mips/mips
196e737464fSEd Schouten
197e737464fSEd SchoutenSRCF+=	stdatomic
1986d57c750SEd Schouten.endif
1996d57c750SEd Schouten
200a3cf0ef5SEd Schouten.for file in ${SRCF}
201eabf853dSAndrew Turner. if ${MACHINE_ARCH:Marm*hf*} != "" && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
20273279d41SAndrew TurnerSRCS+= ${file}vfp.S
203eabf853dSAndrew Turner. elif !(${MACHINE_CPUARCH} == "arm" && ${MACHINE_ARCH:Marm*hf*} == "") && exists(${CRTSRC}/${CRTARCH}/${file}.S)
204a3cf0ef5SEd SchoutenSRCS+=	${file}.S
205a3cf0ef5SEd Schouten. else
206a3cf0ef5SEd SchoutenSRCS+=	${file}.c
207a3cf0ef5SEd Schouten. endif
208a3cf0ef5SEd Schouten.endfor
209a3cf0ef5SEd Schouten
2106d4766c1SAndrew Turner.if ${MACHINE_CPUARCH} == "arm"
211d6a052e0SAndrew TurnerSRCS+=	aeabi_div0.c \
212f4341a5aSDimitry Andric	aeabi_idivmod.S \
21379ef2c64SAndrew Turner	aeabi_ldivmod.S \
214d74bcf9dSAndrew Turner	aeabi_memcmp.S \
215d74bcf9dSAndrew Turner	aeabi_memcpy.S \
216d74bcf9dSAndrew Turner	aeabi_memmove.S \
217d74bcf9dSAndrew Turner	aeabi_memset.S \
21879ef2c64SAndrew Turner	aeabi_uidivmod.S \
219f4341a5aSDimitry Andric	aeabi_uldivmod.S \
220f4341a5aSDimitry Andric	bswapdi2.S \
221f4341a5aSDimitry Andric	bswapsi2.S \
222f4341a5aSDimitry Andric	switch16.S \
223f4341a5aSDimitry Andric	switch32.S \
224f4341a5aSDimitry Andric	switch8.S \
225f4341a5aSDimitry Andric	switchu8.S \
226d6a052e0SAndrew Turner	sync_synchronize.S
22779ef2c64SAndrew Turner.endif
22879ef2c64SAndrew Turner
229a3cf0ef5SEd Schouten.if ${MK_INSTALLLIB} != "no"
230a3cf0ef5SEd SchoutenSYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
231a3cf0ef5SEd Schouten.endif
232a3cf0ef5SEd Schouten.if ${MK_PROFILE} != "no"
233a3cf0ef5SEd SchoutenSYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
234a3cf0ef5SEd Schouten.endif
235a3cf0ef5SEd Schouten
236c42c9d56SKonstantin Belousov.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
23796cdb0abSKonstantin Belousov    ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*}
238153344e7SKonstantin BelousovAFLAGS+=--noexecstack
239127060d2SKonstantin BelousovACFLAGS+=-Wa,--noexecstack
240153344e7SKonstantin Belousov.endif
241153344e7SKonstantin Belousov
242153344e7SKonstantin Belousov
243a3cf0ef5SEd Schouten.include <bsd.lib.mk>
244