xref: /freebsd/lib/libcompiler_rt/Makefile (revision 852790874793186f2dfe59fd7c7a082c6920ed9c)
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	extendhfsf2 \
52	ffsdi2 \
53	ffsti2 \
54	fixdfdi \
55	fixdfti \
56	fixsfdi \
57	fixsfti \
58	fixunsdfdi \
59	fixunsdfsi \
60	fixunsdfti \
61	fixunssfdi \
62	fixunssfsi \
63	fixunssfti \
64	fixunsxfdi \
65	fixunsxfsi \
66	fixunsxfti \
67	fixxfdi \
68	fixxfti \
69	floatdidf \
70	floatdisf \
71	floatditf \
72	floatdixf \
73	floatsitf \
74	floattidf \
75	floattisf \
76	floattixf \
77	floatundidf \
78	floatundisf \
79	floatunditf \
80	floatundixf \
81	floatunsidf \
82	floatunsisf \
83	floatuntidf \
84	floatuntisf \
85	floatuntixf \
86	gcc_personality_v0 \
87	int_util \
88	lshrdi3 \
89	lshrti3 \
90	moddi3 \
91	modti3 \
92	muldc3 \
93	muldi3 \
94	mulodi4 \
95	mulosi4 \
96	muloti4 \
97	mulsc3 \
98	multi3 \
99	mulvdi3 \
100	mulvsi3 \
101	mulvti3 \
102	multc3 \
103	mulxc3 \
104	negdf2 \
105	negdi2 \
106	negsf2 \
107	negti2 \
108	negvdi2 \
109	negvsi2 \
110	negvti2 \
111	paritydi2 \
112	paritysi2 \
113	parityti2 \
114	popcountdi2 \
115	popcountsi2 \
116	popcountti2 \
117	powidf2 \
118	powisf2 \
119	powitf2 \
120	powixf2 \
121	subvdi3 \
122	subvsi3 \
123	subvti3 \
124	trampoline_setup \
125	truncdfhf2 \
126	truncsfhf2 \
127	ucmpdi2 \
128	ucmpti2 \
129	udivdi3 \
130	udivmoddi4 \
131	udivmodsi4 \
132	udivmodti4 \
133	udivti3 \
134	umoddi3 \
135	umodti3
136
137# 128-bit quad precision long double support, only used on arm64
138.if ${MACHINE_CPUARCH} == "aarch64"
139SRCF+=	addtf3 \
140	comparetf2 \
141	divtf3 \
142	extenddftf2 \
143	extendsftf2 \
144	fixtfdi \
145	fixtfsi \
146	fixtfti \
147	fixunstfdi \
148	fixunstfsi \
149	fixunstfti \
150	floatunsitf \
151	multf3 \
152	subtf3 \
153	trunctfdf2 \
154	trunctfsf2
155.endif
156
157# These are already shipped by libc.a on arm and mips
158.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
159SRCF+=	adddf3 \
160	addsf3 \
161	divdf3 \
162	divsf3 \
163	extendsfdf2 \
164	fixdfsi \
165	fixsfsi \
166	floatsidf \
167	floatsisf \
168	muldf3 \
169	mulsf3 \
170	subdf3 \
171	subsf3 \
172	truncdfsf2
173.endif
174
175.if ${MACHINE_CPUARCH} != "arm"
176SRCF+=	comparedf2 \
177	comparesf2
178.endif
179
180.if ${MACHINE_CPUARCH} != "mips"
181SRCF+=	divsi3 \
182	modsi3 \
183	udivsi3 \
184	umodsi3
185.endif
186
187# FreeBSD-specific atomic intrinsics.
188.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
189.PATH: ${.CURDIR}/../../sys/arm/arm
190
191SRCF+=	stdatomic
192CFLAGS+=	-DEMIT_SYNC_ATOMICS
193.elif ${MACHINE_CPUARCH} == "mips"
194.PATH: ${.CURDIR}/../../sys/mips/mips
195
196SRCF+=	stdatomic
197.endif
198
199.for file in ${SRCF}
200. if ${MACHINE_ARCH:Marm*hf*} != "" && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
201SRCS+= ${file}vfp.S
202. elif !(${MACHINE_CPUARCH} == "arm" && ${MACHINE_ARCH:Marm*hf*} == "") && exists(${CRTSRC}/${CRTARCH}/${file}.S)
203SRCS+=	${file}.S
204. else
205SRCS+=	${file}.c
206. endif
207.endfor
208
209.if ${MACHINE_CPUARCH} == "arm"
210SRCS+=	aeabi_div0.c \
211	aeabi_idivmod.S \
212	aeabi_ldivmod.S \
213	aeabi_memcmp.S \
214	aeabi_memcpy.S \
215	aeabi_memmove.S \
216	aeabi_memset.S \
217	aeabi_uidivmod.S \
218	aeabi_uldivmod.S \
219	bswapdi2.S \
220	bswapsi2.S \
221	switch16.S \
222	switch32.S \
223	switch8.S \
224	switchu8.S \
225	sync_synchronize.S
226.endif
227
228.if ${MK_INSTALLLIB} != "no"
229SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
230.endif
231.if ${MK_PROFILE} != "no"
232SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
233.endif
234
235.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
236    ${MACHINE_CPUARCH} == "powerpc"
237AFLAGS+=--noexecstack
238ACFLAGS+=-Wa,--noexecstack
239.endif
240
241
242.include <bsd.lib.mk>
243