xref: /minix/lib/libc/compiler_rt/Makefile.inc (revision e3b78ef1)
1# $NetBSD: Makefile.inc,v 1.1 2013/07/04 22:14:43 joerg Exp $
2
3COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
4
5.if ${MACHINE_ARCH} == "powerpc"
6COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/ppc
7COMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/ppc
8.else
9COMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/${MACHINE_CPU}
10COMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/${MACHINE_ARCH}
11.endif
12
13.if defined(__MINIX)
14LIBC_MACHINE_CPU?=      ${MACHINE_CPU}
15.endif # defined(__MINIX)
16
17.if !empty(LIBC_MACHINE_ARCH:Mearm*) && defined(__MINIX)
18# BJG - we skip these for minix/x86 as the .S versions give problems
19# for dynamic binaries.
20.PATH: ${COMPILER_RT_CPU_DIR}
21.PATH: ${COMPILER_RT_ARCH_DIR}
22.endif # .if !empty(LIBC_MACHINE_ARCH:Mearm*) && defined(__MINIX)
23.PATH: ${COMPILER_RT_SRCDIR}/lib
24
25# Complex support needs parts of libm
26#GENERIC_SRCS+=
27#	mulxc3.c \
28#	mulsc3.c \
29#	divxc3.c \
30#	divdc3.c \
31#	divsc3.c
32
33# Implemented on top of our atomic interface.
34#GENERIC_SRCS+= atomic.c
35
36.if ${HAVE_LIBGCC_EH:Uyes} == "no"
37GENERIC_SRCS+= \
38	gcc_personality_v0.c
39.endif
40
41.if 0
42# Conflicts with soft-float
43GENERIC_SRCS+= \
44	comparedf2.c \
45	comparesf2.c \
46	adddf3.c \
47	addsf3.c \
48	addtf3.c \
49	divdf3.c \
50	divsf3.c \
51	divtf3.c \
52	extendsfdf2.c \
53	extendsftf2.c \
54	extenddftf2.c \
55	fixdfsi.c \
56	fixdfti.c \
57	fixsfsi.c \
58	fixsfti.c \
59	floatsidf.c \
60	floatsisf.c \
61	floatunsidf.c \
62	floatunsisf.c \
63	muldf3.c \
64	mulsf3.c \
65	multf3.c \
66	subdf3.c \
67	subsf3.c \
68	subtf3.c \
69	truncdfsf2.c \
70	trunctfdf2.c \
71	trunctfsf2.c
72.endif
73
74GENERIC_SRCS+= \
75	absvsi2.c \
76	absvti2.c \
77	addvsi3.c \
78	addvti3.c \
79	ashlti3.c \
80	ashrti3.c \
81	clzti2.c \
82	cmpti2.c \
83	ctzti2.c \
84	divti3.c \
85	ffsti2.c \
86	fixsfdi.c \
87	fixdfdi.c \
88	fixunsdfdi.c \
89	fixunsdfsi.c \
90	fixunssfdi.c \
91	fixunssfsi.c \
92	fixunsxfdi.c \
93	fixunsxfsi.c \
94	fixxfdi.c \
95	floatdidf.c \
96	floatdisf.c \
97	floatdixf.c \
98	floatundidf.c \
99	floatundisf.c \
100	floatundixf.c \
101	int_util.c \
102	lshrti3.c \
103	modti3.c \
104	muldc3.c \
105	mulosi4.c \
106	muloti4.c \
107	multi3.c \
108	mulvsi3.c \
109	mulvti3.c \
110	negdf2.c \
111	negsf2.c \
112	negti2.c \
113	negvsi2.c \
114	negvti2.c \
115	paritysi2.c \
116	parityti2.c \
117	popcountsi2.c \
118	popcountti2.c \
119	powidf2.c \
120	powisf2.c \
121	powitf2.c \
122	powixf2.c \
123	subvsi3.c \
124	subvti3.c \
125	ucmpti2.c \
126	udivmodti4.c \
127	udivti3.c \
128	umodti3.c
129
130.if ${MACHINE_ARCH} != "aarch64"
131GENERIC_SRCS+= \
132	fixunsdfti.c \
133	fixunssfti.c \
134	fixunsxfti.c \
135	fixxfti.c \
136	floattidf.c \
137	floattisf.c \
138	floattixf.c \
139	floatuntidf.c \
140	floatuntisf.c \
141	floatuntixf.c
142.endif
143
144# These have h/w instructions which are always used.
145.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "aarch64" \
146    && ${LIBC_MACHINE_CPU} != "powerpc" && ${LIBC_MACHINE_CPU} != "or1k"
147GENERIC_SRCS+= \
148	clzsi2.c
149.endif
150
151# These have h/w instructions which are always used.
152.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_ARCH} != "vax" \
153    && ${LIBC_MACHINE_CPU} != "aarch64" && ${LIBC_MACHINE_CPU} != "powerpc" \
154    && ${LIBC_MACHINE_CPU} != "or1k"
155GENERIC_SRCS+= \
156	ctzsi2.c
157.endif
158
159# These have h/w instructions which are always used.
160.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "powerpc" \
161    && ${LIBC_MACHINE_CPU} != "aarch64" && ${LIBC_MACHINE_ARCH} != "vax"
162GENERIC_SRCS+= \
163	divmodsi4.c \
164	divsi3.c \
165	modsi3.c \
166	udivmodsi4.c \
167	umodsi3.c
168
169. if ${LIBC_MACHINE_CPU} != "sh3"
170# On sh3 __udivsi3 is gcc "millicode" with special calling convention
171# (less registers clobbered than usual).  Each DSO that needs it gets
172# its own hidden copy from libgcc.a.
173GENERIC_SRCS+= \
174	udivsi3.c
175. endif
176.endif
177
178
179GENERIC_SRCS+= \
180	absvdi2.c \
181	addvdi3.c \
182	mulodi4.c \
183	mulvdi3.c \
184	negvdi2.c \
185	paritydi2.c \
186	popcountdi2.c \
187	subvdi3.c
188
189# These have h/w instructions which are always used.
190.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "powerpc64" \
191    && ${LIBC_MACHINE_ARCH} != "aarch64" && ${LIBC_MACHINE_CPU} != "or1k"
192GENERIC_SRCS+= \
193	clzdi2.c \
194	ctzdi2.c \
195	ffsdi2.c
196.endif
197
198# Don't need these on 64-bit machines.
199.if empty(LIBC_MACHINE_ARCH:M*64*) && ${LIBC_MACHINE_ARCH} != "alpha"
200GENERIC_SRCS+= \
201	cmpdi2.c \
202	ashldi3.c \
203	ashrdi3.c \
204	divdi3.c \
205	divmoddi4.c \
206	lshrdi3.c \
207	moddi3.c \
208	muldi3.c \
209	negdi2.c \
210	ucmpdi2.c \
211	udivdi3.c \
212	udivmoddi4.c \
213	umoddi3.c
214.endif
215
216.if ${LIBC_MACHINE_ARCH} == "powerpc" || ${LIBC_MACHINE_ARCH} == "powerpc64"
217GENERIC_SRCS+= \
218	fixtfdi.c \
219	fixunstfdi.c \
220	floatditf.c \
221	floatunditf.c \
222	gcc_qadd.c \
223	gcc_qdiv.c \
224	gcc_qmul.c \
225	gcc_qsub.c
226.endif
227
228.if ${LIBC_MACHINE_CPU} == "aarch64"
229GENERIC_SRCS+= \
230	clear_cache.c
231.endif
232
233.if ${LIBC_MACHINE_CPU} == "arm"
234.if !empty(LIBC_MACHINE_ARCH:Mearm*)
235GENERIC_SRCS+= \
236	aeabi_idivmod.S \
237	aeabi_ldivmod.S \
238	aeabi_uidivmod.S \
239	aeabi_uldivmod.S
240.endif
241GENERIC_SRCS+= \
242	clear_cache.c
243# Not yet, overlaps with softfloat
244#	aeabi_dcmp.S \
245#	aeabi_fcmp.S
246# Not yet, requires ARMv6
247#GENERIC_SRCS+= \
248#	bswapdi2.S \
249#	bswapsi2.S
250.endif
251
252.if !defined(__MINIX)
253.for src in ${GENERIC_SRCS}
254.  if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \
255      exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S)
256SRCS+=	${src:R}.S
257.  else
258SRCS+=	${src}
259.    if ${src:E} != "cc"
260COPTS.${src}+=	-Wno-missing-prototypes \
261		-Wno-old-style-definition \
262		-Wno-strict-prototypes \
263		-Wno-uninitialized \
264		-Wno-cast-qual
265.    endif
266.  endif
267.endfor
268.else
269# For MINIX: do not pull in the assembly symbols, as they are not PIC ready
270.for src in ${GENERIC_SRCS}
271SRCS+=	${src}
272.    if ${src:E} != "cc"
273COPTS.${src}+=	-Wno-missing-prototypes \
274		-Wno-old-style-definition \
275		-Wno-strict-prototypes \
276		-Wno-uninitialized \
277		-Wno-cast-qual
278.    endif
279.endfor
280
281.for src in muldc3.c
282COPTS.${src}+=	-fbuiltin
283.endfor
284.endif # !defined(__MINIX)
285