xref: /freebsd/lib/libcompiler_rt/Makefile (revision ec273ebf3b6aed5fba8c56b6ece5ad8693a48ea7)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5LIB=	compiler_rt
6NO_PIC=
7WARNS?=	2
8
9CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
10
11.if ${MACHINE_CPUARCH} == "amd64"
12CRTARCH=x86_64
13.else
14CRTARCH=${MACHINE_CPUARCH}
15.endif
16
17CRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins
18
19.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
20
21SRCF=	absvdi2 \
22	absvsi2 \
23	absvti2 \
24	addtf3 \
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	divtf3 \
48	divti3 \
49	divxc3 \
50	enable_execute_stack \
51	eprintf \
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	floatdixf \
72	floattidf \
73	floattisf \
74	floattixf \
75	floatundidf \
76	floatundisf \
77	floatundixf \
78	floatunsidf \
79	floatunsisf \
80	floatuntidf \
81	floatuntisf \
82	floatuntixf \
83	gcc_personality_v0 \
84	int_util \
85	lshrdi3 \
86	lshrti3 \
87	moddi3 \
88	modti3 \
89	muldc3 \
90	muldi3 \
91	mulodi4 \
92	mulosi4 \
93	muloti4 \
94	mulsc3 \
95	multf3 \
96	multi3 \
97	mulvdi3 \
98	mulvsi3 \
99	mulvti3 \
100	mulxc3 \
101	negdf2 \
102	negdi2 \
103	negsf2 \
104	negti2 \
105	negvdi2 \
106	negvsi2 \
107	negvti2 \
108	paritydi2 \
109	paritysi2 \
110	parityti2 \
111	popcountdi2 \
112	popcountsi2 \
113	popcountti2 \
114	powidf2 \
115	powisf2 \
116	powitf2 \
117	powixf2 \
118	subtf3 \
119	subvdi3 \
120	subvsi3 \
121	subvti3 \
122	trampoline_setup \
123	ucmpdi2 \
124	ucmpti2 \
125	udivdi3 \
126	udivmoddi4 \
127	udivmodsi4 \
128	udivmodti4 \
129	udivti3 \
130	umoddi3 \
131	umodti3
132
133# These are already shipped by libc.a on arm and mips
134.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
135SRCF+=	adddf3 \
136	addsf3 \
137	divdf3 \
138	divsf3 \
139	extendsfdf2 \
140	fixdfsi \
141	fixsfsi \
142	floatsidf \
143	floatsisf \
144	muldf3 \
145	mulsf3 \
146	subdf3 \
147	subsf3 \
148	truncdfsf2
149.endif
150
151.if ${MACHINE_CPUARCH} != "arm"
152SRCF+=	comparedf2 \
153	comparesf2
154.endif
155
156.if ${MACHINE_CPUARCH} != "mips"
157SRCF+=	divsi3 \
158	modsi3 \
159	udivsi3 \
160	umodsi3
161.endif
162
163# FreeBSD-specific atomic intrinsics.
164.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
165.PATH: ${.CURDIR}/../../sys/arm/arm
166
167SRCF+=	stdatomic
168CFLAGS+=	-DEMIT_SYNC_ATOMICS
169.elif ${MACHINE_CPUARCH} == "mips"
170.PATH: ${.CURDIR}/../../sys/mips/mips
171
172SRCF+=	stdatomic
173.endif
174
175.for file in ${SRCF}
176. if ${MACHINE_ARCH:Marm*hf*} != "" && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
177SRCS+= ${file}vfp.S
178. elif !(${MACHINE_CPUARCH} == "arm" && ${MACHINE_ARCH:Marm*hf*} == "") && exists(${CRTSRC}/${CRTARCH}/${file}.S)
179SRCS+=	${file}.S
180. else
181SRCS+=	${file}.c
182. endif
183.endfor
184
185.if ${MACHINE_CPUARCH} == "arm"
186SRCS+=	aeabi_div0.c \
187	aeabi_idivmod.S \
188	aeabi_ldivmod.S \
189	aeabi_memcmp.S \
190	aeabi_memcpy.S \
191	aeabi_memmove.S \
192	aeabi_memset.S \
193	aeabi_uidivmod.S \
194	aeabi_uldivmod.S \
195	bswapdi2.S \
196	bswapsi2.S \
197	switch16.S \
198	switch32.S \
199	switch8.S \
200	switchu8.S \
201	sync_synchronize.S
202.endif
203
204.if ${MK_INSTALLLIB} != "no"
205SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
206.endif
207.if ${MK_PROFILE} != "no"
208SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
209.endif
210
211.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
212    ${MACHINE_CPUARCH} == "powerpc"
213AFLAGS+=--noexecstack
214ACFLAGS+=-Wa,--noexecstack
215.endif
216
217
218.include <bsd.lib.mk>
219