xref: /freebsd/lib/libcompiler_rt/Makefile (revision 416ba5c74546f32a993436a99516d35008e9f384)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5LIB=	compiler_rt
6NO_PIC=
7WARNS?=	2
8
9CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
10CFLAGS+=-I${.CURDIR}/../../contrib/libcxxrt
11
12.if ${MACHINE_CPUARCH} == "amd64"
13CRTARCH=x86_64
14.else
15CRTARCH=${MACHINE_CPUARCH}
16.endif
17
18CRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins
19
20.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
21
22SRCF=	absvdi2 \
23	absvsi2 \
24	absvti2 \
25	addvdi3 \
26	addvsi3 \
27	addvti3 \
28	apple_versioning \
29	ashldi3 \
30	ashlti3 \
31	ashrdi3 \
32	ashrti3 \
33	clear_cache \
34	clzdi2 \
35	clzsi2 \
36	clzti2 \
37	cmpdi2 \
38	cmpti2 \
39	ctzdi2 \
40	ctzsi2 \
41	ctzti2 \
42	divdc3 \
43	divdi3 \
44	divmoddi4 \
45	divmodsi4 \
46	divsc3 \
47	divti3 \
48	divxc3 \
49	enable_execute_stack \
50	eprintf \
51	ffsdi2 \
52	ffsti2 \
53	fixdfdi \
54	fixdfti \
55	fixsfdi \
56	fixsfti \
57	fixunsdfdi \
58	fixunsdfsi \
59	fixunsdfti \
60	fixunssfdi \
61	fixunssfsi \
62	fixunssfti \
63	fixunsxfdi \
64	fixunsxfsi \
65	fixunsxfti \
66	fixxfdi \
67	fixxfti \
68	floatdidf \
69	floatdisf \
70	floatditf \
71	floatdixf \
72	floatsitf \
73	floattidf \
74	floattisf \
75	floattixf \
76	floatundidf \
77	floatundisf \
78	floatunditf \
79	floatundixf \
80	floatunsidf \
81	floatunsisf \
82	floatuntidf \
83	floatuntisf \
84	floatuntixf \
85	gcc_personality_v0 \
86	int_util \
87	lshrdi3 \
88	lshrti3 \
89	moddi3 \
90	modti3 \
91	muldc3 \
92	muldi3 \
93	mulodi4 \
94	mulosi4 \
95	muloti4 \
96	mulsc3 \
97	multi3 \
98	mulvdi3 \
99	mulvsi3 \
100	mulvti3 \
101	multc3 \
102	mulxc3 \
103	negdf2 \
104	negdi2 \
105	negsf2 \
106	negti2 \
107	negvdi2 \
108	negvsi2 \
109	negvti2 \
110	paritydi2 \
111	paritysi2 \
112	parityti2 \
113	popcountdi2 \
114	popcountsi2 \
115	popcountti2 \
116	powidf2 \
117	powisf2 \
118	powitf2 \
119	powixf2 \
120	subvdi3 \
121	subvsi3 \
122	subvti3 \
123	trampoline_setup \
124	ucmpdi2 \
125	ucmpti2 \
126	udivdi3 \
127	udivmoddi4 \
128	udivmodsi4 \
129	udivmodti4 \
130	udivti3 \
131	umoddi3 \
132	umodti3
133
134# 128-bit quad precision long double support, only used on arm64
135.if ${MACHINE_CPUARCH} == "aarch64"
136SRCF+=	addtf3 \
137	comparetf2 \
138	divtf3 \
139	extenddftf2 \
140	extendsftf2 \
141	fixtfdi \
142	fixtfsi \
143	fixtfti \
144	fixunstfdi \
145	fixunstfsi \
146	fixunstfti \
147	floatunsitf \
148	multf3 \
149	subtf3 \
150	trunctfdf2 \
151	trunctfsf2
152.endif
153
154# These are already shipped by libc.a on arm and mips
155.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
156SRCF+=	adddf3 \
157	addsf3 \
158	divdf3 \
159	divsf3 \
160	extendsfdf2 \
161	fixdfsi \
162	fixsfsi \
163	floatsidf \
164	floatsisf \
165	muldf3 \
166	mulsf3 \
167	subdf3 \
168	subsf3 \
169	truncdfsf2
170.endif
171
172.if ${MACHINE_CPUARCH} != "arm"
173SRCF+=	comparedf2 \
174	comparesf2
175.endif
176
177.if ${MACHINE_CPUARCH} != "mips"
178SRCF+=	divsi3 \
179	modsi3 \
180	udivsi3 \
181	umodsi3
182.endif
183
184# FreeBSD-specific atomic intrinsics.
185.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
186.PATH: ${.CURDIR}/../../sys/arm/arm
187
188SRCF+=	stdatomic
189CFLAGS+=	-DEMIT_SYNC_ATOMICS
190.elif ${MACHINE_CPUARCH} == "mips"
191.PATH: ${.CURDIR}/../../sys/mips/mips
192
193SRCF+=	stdatomic
194.endif
195
196.for file in ${SRCF}
197. if ${MACHINE_ARCH:Marm*hf*} != "" && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
198SRCS+= ${file}vfp.S
199. elif !(${MACHINE_CPUARCH} == "arm" && ${MACHINE_ARCH:Marm*hf*} == "") && exists(${CRTSRC}/${CRTARCH}/${file}.S)
200SRCS+=	${file}.S
201. else
202SRCS+=	${file}.c
203. endif
204.endfor
205
206.if ${MACHINE_CPUARCH} == "arm"
207SRCS+=	aeabi_div0.c \
208	aeabi_idivmod.S \
209	aeabi_ldivmod.S \
210	aeabi_memcmp.S \
211	aeabi_memcpy.S \
212	aeabi_memmove.S \
213	aeabi_memset.S \
214	aeabi_uidivmod.S \
215	aeabi_uldivmod.S \
216	bswapdi2.S \
217	bswapsi2.S \
218	switch16.S \
219	switch32.S \
220	switch8.S \
221	switchu8.S \
222	sync_synchronize.S
223.endif
224
225.if ${MK_INSTALLLIB} != "no"
226SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
227.endif
228.if ${MK_PROFILE} != "no"
229SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
230.endif
231
232.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
233    ${MACHINE_CPUARCH} == "powerpc"
234AFLAGS+=--noexecstack
235ACFLAGS+=-Wa,--noexecstack
236.endif
237
238
239.include <bsd.lib.mk>
240