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