1215125Sed# $FreeBSD$
2215125Sed
3215125Sed.include <bsd.own.mk>
4215125Sed
5215125SedLIB=	compiler_rt
6215125SedNO_PIC=
7215125SedWARNS?=	2
8215125Sed
9215129SedCFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN
10215125Sed
11215125Sed.if ${MACHINE_CPUARCH} == "amd64"
12215125SedCRTARCH=x86_64
13215125Sed.else
14215125SedCRTARCH=${MACHINE_CPUARCH}
15215125Sed.endif
16215125Sed
17215125SedCRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib
18215125Sed
19215125Sed.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC}
20215125Sed
21215125SedSRCF=	absvdi2 \
22215125Sed	absvsi2 \
23215125Sed	absvti2 \
24215125Sed	addvdi3 \
25215125Sed	addvsi3 \
26215125Sed	addvti3 \
27215125Sed	ashldi3 \
28215125Sed	ashlti3 \
29215125Sed	ashrdi3 \
30215125Sed	ashrti3 \
31215125Sed	clear_cache \
32215125Sed	clzdi2 \
33215125Sed	clzsi2 \
34215125Sed	clzti2 \
35215125Sed	cmpdi2 \
36215125Sed	cmpti2 \
37215125Sed	comparedf2 \
38215125Sed	comparesf2 \
39215125Sed	ctzdi2 \
40215125Sed	ctzsi2 \
41215125Sed	ctzti2 \
42215125Sed	divdc3 \
43215125Sed	divdi3 \
44222656Sed	divmoddi4 \
45222656Sed	divmodsi4 \
46215125Sed	divsc3 \
47215125Sed	divti3 \
48215125Sed	divxc3 \
49215125Sed	enable_execute_stack \
50215125Sed	eprintf \
51215125Sed	ffsdi2 \
52215125Sed	ffsti2 \
53215125Sed	fixdfdi \
54215125Sed	fixdfti \
55215125Sed	fixsfdi \
56215125Sed	fixsfti \
57215125Sed	fixunsdfdi \
58215125Sed	fixunsdfsi \
59215125Sed	fixunsdfti \
60215125Sed	fixunssfdi \
61215125Sed	fixunssfsi \
62215125Sed	fixunssfti \
63215125Sed	fixunsxfdi \
64215125Sed	fixunsxfsi \
65215125Sed	fixunsxfti \
66215125Sed	fixxfdi \
67215125Sed	fixxfti \
68215125Sed	floatdidf \
69215125Sed	floatdisf \
70215125Sed	floatdixf \
71215125Sed	floattidf \
72215125Sed	floattisf \
73215125Sed	floattixf \
74215125Sed	floatundidf \
75215125Sed	floatundisf \
76215125Sed	floatundixf \
77215125Sed	floatunsidf \
78215125Sed	floatunsisf \
79215125Sed	floatuntidf \
80215125Sed	floatuntisf \
81215125Sed	floatuntixf \
82236015Smarius	int_util \
83215125Sed	lshrdi3 \
84215125Sed	lshrti3 \
85215125Sed	moddi3 \
86215125Sed	modti3 \
87215125Sed	muldc3 \
88215125Sed	muldi3 \
89236015Smarius	mulodi4 \
90236015Smarius	mulosi4 \
91236015Smarius	muloti4 \
92215125Sed	mulsc3 \
93215125Sed	multi3 \
94215125Sed	mulvdi3 \
95215125Sed	mulvsi3 \
96215125Sed	mulvti3 \
97215125Sed	mulxc3 \
98215125Sed	negdf2 \
99215125Sed	negdi2 \
100215125Sed	negsf2 \
101215125Sed	negti2 \
102215125Sed	negvdi2 \
103215125Sed	negvsi2 \
104215125Sed	negvti2 \
105215125Sed	paritydi2 \
106215125Sed	paritysi2 \
107215125Sed	parityti2 \
108215125Sed	popcountdi2 \
109215125Sed	popcountsi2 \
110215125Sed	popcountti2 \
111215125Sed	powidf2 \
112215125Sed	powisf2 \
113215125Sed	powitf2 \
114215125Sed	powixf2 \
115215125Sed	subvdi3 \
116215125Sed	subvsi3 \
117215125Sed	subvti3 \
118215125Sed	trampoline_setup \
119215125Sed	ucmpdi2 \
120215125Sed	ucmpti2 \
121215125Sed	udivdi3 \
122215125Sed	udivmoddi4 \
123222656Sed	udivmodsi4 \
124215125Sed	udivmodti4 \
125215125Sed	udivti3 \
126215125Sed	umoddi3 \
127215125Sed	umodti3
128215125Sed
129215125Sed# These are already shipped by libc.a on arm and mips
130215125Sed.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
131215125SedSRCF+=	adddf3 \
132215125Sed	addsf3 \
133215125Sed	divdf3 \
134215125Sed	divsf3 \
135215125Sed	divsi3 \
136215125Sed	extendsfdf2 \
137215125Sed	fixdfsi \
138215125Sed	fixsfsi \
139215125Sed	floatsidf \
140215125Sed	floatsisf \
141215125Sed	modsi3 \
142215125Sed	muldf3 \
143215125Sed	mulsf3 \
144222656Sed	subdf3 \
145222656Sed	subsf3 \
146215125Sed	truncdfsf2 \
147215125Sed	udivsi3 \
148215125Sed	umodsi3
149215125Sed.endif
150215125Sed
151236016Smarius# FreeBSD-specific atomic intrinsics.
152236016Smarius.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
153236016SmariusSRCF+=	__sync_fetch_and_add_4 \
154236016Smarius	__sync_fetch_and_and_4 \
155236016Smarius	__sync_fetch_and_or_4 \
156236016Smarius	__sync_fetch_and_sub_4 \
157236016Smarius	__sync_fetch_and_xor_4 \
158236016Smarius	__sync_lock_test_and_set_4 \
159236016Smarius	__sync_val_compare_and_swap_4
160236016Smarius.endif
161236016Smarius.if ${MACHINE_ARCH:Mmips64*} != ""
162236016SmariusSRCF+=	__sync_fetch_and_add_8 \
163236016Smarius	__sync_fetch_and_and_8 \
164236016Smarius	__sync_fetch_and_or_8 \
165236016Smarius	__sync_fetch_and_sub_8 \
166236016Smarius	__sync_fetch_and_xor_8 \
167236016Smarius	__sync_lock_test_and_set_8 \
168236016Smarius	__sync_val_compare_and_swap_8
169236016Smarius.endif
170236016Smarius
171215125Sed.for file in ${SRCF}
172215125Sed. if ${MACHINE_CPUARCH} != "arm" && exists(${CRTSRC}/${CRTARCH}/${file}.S)
173215125SedSRCS+=	${file}.S
174215125Sed. else
175215125SedSRCS+=	${file}.c
176215125Sed. endif
177215125Sed.endfor
178215125Sed
179236014Smarius.if ${MACHINE_CPUARCH} != "mips"
180215185Sed. if ${MK_INSTALLLIB} != "no"
181215125SedSYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
182215185Sed. endif
183215185Sed. if ${MK_PROFILE} != "no"
184215125SedSYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
185215185Sed. endif
186215125Sed.endif
187215125Sed
188217393Skib.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
189217393Skib    ${MACHINE_CPUARCH} == "powerpc"
190217101SkibAFLAGS+=--noexecstack
191217102SkibACFLAGS+=-Wa,--noexecstack
192217101Skib.endif
193217101Skib
194217101Skib
195215125Sed.include <bsd.lib.mk>
196