1# These are the functions which clang needs when it is targeting a previous
2# version of the OS. The issue is that the backend may use functions which were
3# not present in the libgcc that shipped on the platform. In such cases, we link
4# with a version of the library which contains private_extern definitions of all
5# the extra functions which might be referenced.
6
7Description := Static runtime libraries for clang/Darwin.
8
9# A function that ensures we don't try to build for architectures and SDKs
10# that we don't have working toolchains for. Arguments:
11# (1): List of architectures
12# (2): Library name
13# (3): SDK path
14# The result is a possibly empty subset of the architectures from argument 1.
15CheckArches = \
16  $(shell \
17    result=""; \
18    if [ "X$(3)" != X ]; then \
19      for arch in $(1); do \
20        if $(LD) -v 2>&1 | grep "configured to support" \
21             | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \
22          if $(CC) -arch $$arch \
23            -integrated-as \
24            $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \
25            -isysroot $(3) \
26            -o /dev/null > /dev/null 2> /dev/null; then \
27              result="$$result$$arch "; \
28          else \
29            printf 1>&2 \
30             "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \
31            printf 1>&2 " (clang or system libraries do not support it)\n"; \
32          fi; \
33        else \
34          printf 1>&2 \
35            "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\
36          printf 1>&2 " (ld does not support it)\n"; \
37        fi; \
38      done; \
39    fi; \
40    echo $$result)
41
42XCRun = \
43  $(shell \
44    result=`xcrun -find $(1) 2> /dev/null`; \
45    if [ "$$?" != "0" ]; then result=$(1); fi; \
46    echo $$result)
47# Prefer building with the internal SDKs.
48XCRunSdkPath = \
49  $(shell \
50    result=`xcrun --sdk $(1).internal --show-sdk-path 2> /dev/null`; \
51    if [ "$$?" != "0" ]; then \
52      result=`xcrun --sdk $(1) --show-sdk-path 2> /dev/null`; \
53      if [ "$$?" != "0" ]; then result=""; fi; \
54    fi; \
55    echo $$result)
56###
57
58CC       := $(call XCRun,clang)
59LD       := $(shell $(CC) -print-prog-name=ld)
60AR       := $(call XCRun,ar)
61RANLIB   := $(call XCRun,ranlib)
62STRIP    := $(call XCRun,strip)
63LIPO     := $(call XCRun,lipo)
64DSYMUTIL := $(call XCRun,dsymutil)
65
66OSX_SDK := $(call XCRunSdkPath,macosx)
67IOS_SDK := $(call XCRunSdkPath,iphoneos)
68IOSSIM_SDK := $(call XCRunSdkPath,iphonesimulator)
69
70Configs :=
71UniversalArchs :=
72
73# Configuration solely for providing access to an eprintf symbol, which may
74# still be referenced from Darwin system headers. This symbol is only ever
75# needed on i386.
76Configs += eprintf
77UniversalArchs.eprintf := $(call CheckArches,i386,eprintf,$(OSX_SDK))
78
79# Configuration for targeting 10.4. We need a few functions missing from
80# libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really
81# support targeting PowerPC.
82Configs += 10.4
83UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4,$(OSX_SDK))
84
85# Configuration for targeting iOS for a couple of functions that didn't
86# make it into libSystem.
87Configs += ios
88UniversalArchs.ios := $(call CheckArches,i386 x86_64,ios,$(IOSSIM_SDK))
89UniversalArchs.ios += $(call CheckArches,armv7 arm64,ios,$(IOS_SDK))
90
91# Configuration for targeting OSX. These functions may not be in libSystem
92# so we should provide our own.
93Configs += osx
94UniversalArchs.osx := $(call CheckArches,i386 x86_64 x86_64h,osx,$(OSX_SDK))
95
96# Configuration for use with kernel/kexts.
97Configs += cc_kext
98UniversalArchs.cc_kext := $(call CheckArches,i386 x86_64 x86_64h,cc_kext,$(OSX_SDK))
99
100# Configuration for use with iOS kernel/kexts
101Configs += cc_kext_ios
102UniversalArchs.cc_kext_ios += $(call CheckArches,armv7,cc_kext_ios,$(IOS_SDK))
103
104# Configurations which define the profiling support functions.
105Configs += profile_osx
106UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64 x86_64h,profile_osx,$(OSX_SDK))
107Configs += profile_ios
108UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64,profile_ios,$(IOSSIM_SDK))
109UniversalArchs.profile_ios += $(call CheckArches,armv7 arm64,profile_ios,$(IOS_SDK))
110
111# Configurations which define the ASAN support functions.
112Configs += asan_osx_dynamic
113UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,asan_osx_dynamic,$(OSX_SDK))
114
115Configs += asan_iossim_dynamic
116UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic,$(IOSSIM_SDK))
117
118Configs += ubsan_osx_dynamic
119UniversalArchs.ubsan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx_dynamic,$(OSX_SDK))
120
121Configs += ubsan_iossim_dynamic
122UniversalArchs.ubsan_iossim_dynamic := $(call CheckArches,i386 x86_64,ubsan_iossim_dynamic,$(IOSSIM_SDK))
123
124# Darwin 10.6 has a bug in cctools that makes it unable to use ranlib on our ARM
125# object files. If we are on that platform, strip out all ARM archs. We still
126# build the libraries themselves so that Clang can find them where it expects
127# them, even though they might not have an expected slice.
128ifneq ($(shell test -x /usr/bin/sw_vers && sw_vers -productVersion | grep 10.6),)
129UniversalArchs.ios := $(filter-out armv7, $(UniversalArchs.ios))
130UniversalArchs.cc_kext_ios := $(filter-out armv7, $(UniversalArchs.cc_kext_ios))
131UniversalArchs.profile_ios := $(filter-out armv7, $(UniversalArchs.profile_ios))
132endif
133
134# If RC_SUPPORTED_ARCHS is defined, treat it as a list of the architectures we
135# are intended to support and limit what we try to build to that.
136ifneq ($(RC_SUPPORTED_ARCHS),)
137$(foreach config,$(Configs),\
138  $(call Set,UniversalArchs.$(config),\
139	$(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config)))))
140endif
141
142# Remove empty configs if we end up dropping all the requested
143# archs for a particular config.
144$(foreach config,$(Configs),\
145  $(if $(strip $(UniversalArchs.$(config))),,\
146	$(call Set,Configs,$(filter-out $(config),$(Configs)))))
147
148###
149
150# Forcibly strip off any -arch, as that totally breaks our universal support.
151override CC := $(subst -arch ,-arch_,$(CC))
152override CC := $(patsubst -arch_%,,$(CC))
153
154CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer
155
156# Always set deployment target arguments for every build, these libraries should
157# never depend on the environmental overrides. We simply set them to minimum
158# supported deployment target -- nothing in the compiler-rt libraries should
159# actually depend on the deployment target.
160OSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.4
161IOS_DEPLOYMENT_ARGS := -mios-version-min=1.0
162IOS6_DEPLOYMENT_ARGS := -mios-version-min=6.0
163IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=1.0
164
165OSX_DEPLOYMENT_ARGS += -isysroot $(OSX_SDK)
166IOS_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
167IOS6_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
168IOSSIM_DEPLOYMENT_ARGS += -isysroot $(IOSSIM_SDK)
169
170CFLAGS.eprintf		:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
171CFLAGS.10.4		:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
172
173SANITIZER_MACOSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.7
174SANITIZER_IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=7.0 \
175  -isysroot $(IOSSIM_SDK)
176SANITIZER_CFLAGS := -fno-builtin -gline-tables-only -stdlib=libc++
177
178CFLAGS.asan_osx_dynamic := \
179	$(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \
180	$(SANITIZER_CFLAGS) \
181	-DMAC_INTERPOSE_FUNCTIONS=1 \
182	-DASAN_DYNAMIC=1
183
184CFLAGS.asan_iossim_dynamic := \
185	$(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \
186	$(SANITIZER_CFLAGS) \
187	-DMAC_INTERPOSE_FUNCTIONS=1 \
188	-DASAN_DYNAMIC=1
189
190CFLAGS.ubsan_osx_dynamic := \
191	$(CFLAGS) $(SANITIZER_MACOSX_DEPLOYMENT_ARGS) \
192	$(SANITIZER_CFLAGS)
193
194CFLAGS.ubsan_iossim_dynamic := \
195	$(CFLAGS) $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS) \
196	$(SANITIZER_CFLAGS)
197
198
199CFLAGS.ios.i386		:= $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
200CFLAGS.ios.x86_64	:= $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
201CFLAGS.ios.armv7	:= $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
202CFLAGS.ios.armv7k	:= $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
203CFLAGS.ios.armv7s	:= $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
204CFLAGS.ios.arm64	:= $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
205CFLAGS.osx.i386		:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
206CFLAGS.osx.x86_64	:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
207CFLAGS.osx.x86_64h	:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
208CFLAGS.cc_kext.i386	:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
209CFLAGS.cc_kext.x86_64	:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
210CFLAGS.cc_kext.x86_64h	:= $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
211CFLAGS.cc_kext_ios.armv7	:= $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
212CFLAGS.cc_kext_ios.armv7k	:= $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
213CFLAGS.cc_kext_ios.armv7s	:= $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
214CFLAGS.cc_kext_ios.arm64	:= $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
215CFLAGS.profile_osx.i386    := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
216CFLAGS.profile_osx.x86_64  := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
217CFLAGS.profile_osx.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
218CFLAGS.profile_ios.i386    := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
219CFLAGS.profile_ios.x86_64  := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
220CFLAGS.profile_ios.armv7  := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
221CFLAGS.profile_ios.armv7k := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
222CFLAGS.profile_ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
223CFLAGS.profile_ios.arm64  := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
224
225SANITIZER_LDFLAGS := -stdlib=libc++ -lc++ -lc++abi
226
227SHARED_LIBRARY.asan_osx_dynamic := 1
228LDFLAGS.asan_osx_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \
229  $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)
230
231SHARED_LIBRARY.asan_iossim_dynamic := 1
232LDFLAGS.asan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \
233  -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)
234
235SHARED_LIBRARY.ubsan_osx_dynamic := 1
236LDFLAGS.ubsan_osx_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_osx_dynamic.dylib \
237  $(SANITIZER_MACOSX_DEPLOYMENT_ARGS)
238
239SHARED_LIBRARY.ubsan_iossim_dynamic := 1
240LDFLAGS.ubsan_iossim_dynamic := $(SANITIZER_LDFLAGS) -install_name @rpath/libclang_rt.ubsan_iossim_dynamic.dylib \
241  -Wl,-ios_simulator_version_min,7.0.0 $(SANITIZER_IOSSIM_DEPLOYMENT_ARGS)
242
243ifneq ($(OSX_SDK),)
244CFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)
245LDFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)
246CFLAGS.ubsan_osx_dynamic += -isysroot $(OSX_SDK)
247LDFLAGS.ubsan_osx_dynamic += -isysroot $(OSX_SDK)
248endif
249
250ATOMIC_FUNCTIONS := \
251	atomic_flag_clear \
252	atomic_flag_clear_explicit \
253	atomic_flag_test_and_set \
254	atomic_flag_test_and_set_explicit \
255	atomic_signal_fence \
256	atomic_thread_fence
257
258FP16_FUNCTIONS := \
259	extendhfsf2 \
260	truncdfhf2 \
261	truncsfhf2
262
263FUNCTIONS.eprintf := eprintf
264FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
265
266FUNCTIONS.ios	    := divmodsi4 udivmodsi4 mulosi4 mulodi4 muloti4 \
267                       $(ATOMIC_FUNCTIONS) $(FP16_FUNCTIONS)
268# On x86, the divmod functions reference divsi.
269FUNCTIONS.ios.i386    := $(FUNCTIONS.ios) \
270                         divsi3 udivsi3
271FUNCTIONS.ios.x86_64  := $(FUNCTIONS.ios.i386)
272FUNCTIONS.ios.arm64   := mulsc3 muldc3 divsc3 divdc3 udivti3 umodti3 \
273                         $(ATOMIC_FUNCTIONS)
274
275FUNCTIONS.osx	:= mulosi4 mulodi4 muloti4 $(ATOMIC_FUNCTIONS) $(FP16_FUNCTIONS)
276
277FUNCTIONS.profile_osx := GCDAProfiling InstrProfiling InstrProfilingBuffer \
278                         InstrProfilingFile InstrProfilingPlatformDarwin \
279                         InstrProfilingRuntime InstrProfilingUtil \
280                         InstrProfilingWriter InstrProfilingValue
281FUNCTIONS.profile_ios := $(FUNCTIONS.profile_osx)
282
283FUNCTIONS.asan_osx_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \
284                              $(InterceptionFunctions) \
285                              $(SanitizerCommonFunctions) \
286                              $(AsanDynamicFunctions) \
287                              $(UbsanFunctions) $(UbsanCXXFunctions)
288
289FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \
290                                 $(InterceptionFunctions) \
291                                 $(SanitizerCommonFunctions) \
292                                 $(AsanDynamicFunctions) \
293                                 $(UbsanFunctions) $(UbsanCXXFunctions)
294
295FUNCTIONS.ubsan_osx_dynamic := $(UbsanFunctions) $(UbsanCXXFunctions) \
296                               $(SanitizerCommonFunctions) \
297                               $(UbsanStandaloneFunctions)
298
299FUNCTIONS.ubsan_iossim_dynamic := $(UbsanFunctions) $(UbsanCXXFunctions) \
300                                  $(SanitizerCommonFunctions) \
301                                  $(UbsanStandaloneFunctions)
302
303CCKEXT_PROFILE_FUNCTIONS := \
304	InstrProfiling \
305	InstrProfilingBuffer \
306	InstrProfilingPlatformDarwin
307
308CCKEXT_COMMON_FUNCTIONS := \
309	$(CCKEXT_PROFILE_FUNCTIONS) \
310	absvdi2 \
311	absvsi2 \
312	addvdi3 \
313	addvsi3 \
314	ashldi3 \
315	ashrdi3 \
316	bswapdi2 \
317	bswapsi2 \
318	clzdi2 \
319	clzsi2 \
320	cmpdi2 \
321	ctzdi2 \
322	ctzsi2 \
323	divdc3 \
324	divdi3 \
325	divsc3 \
326	divmodsi4 \
327	udivmodsi4 \
328	do_global_dtors \
329	eprintf \
330	extendhfsf2 \
331	ffsdi2 \
332	fixdfdi \
333	fixsfdi \
334	fixunsdfdi \
335	fixunsdfsi \
336	fixunssfdi \
337	fixunssfsi \
338	floatdidf \
339	floatdisf \
340	floatundidf \
341	floatundisf \
342	gcc_bcmp \
343	lshrdi3 \
344	moddi3 \
345	muldc3 \
346	muldi3 \
347	mulsc3 \
348	mulvdi3 \
349	mulvsi3 \
350	negdi2 \
351	negvdi2 \
352	negvsi2 \
353	paritydi2 \
354	paritysi2 \
355	popcountdi2 \
356	popcountsi2 \
357	powidf2 \
358	powisf2 \
359	subvdi3 \
360	subvsi3 \
361	truncdfhf2 \
362	truncsfhf2 \
363	ucmpdi2 \
364	udiv_w_sdiv \
365	udivdi3 \
366	udivmoddi4 \
367	umoddi3
368
369CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \
370	adddf3 \
371	addsf3 \
372	aeabi_cdcmpeq \
373	aeabi_cdrcmple \
374	aeabi_cfcmpeq \
375	aeabi_cfrcmple \
376	aeabi_dcmpeq \
377	aeabi_dcmpge \
378	aeabi_dcmpgt \
379	aeabi_dcmple \
380	aeabi_dcmplt \
381	aeabi_drsub \
382	aeabi_fcmpeq \
383	aeabi_fcmpge \
384	aeabi_fcmpgt \
385	aeabi_fcmple \
386	aeabi_fcmplt \
387	aeabi_frsub \
388	aeabi_idivmod \
389	aeabi_uidivmod \
390	cmpdf2 \
391	cmpsf2 \
392	div0 \
393	divdf3 \
394	divsf3 \
395	divsi3 \
396	extendsfdf2 \
397	ffssi2 \
398	fixdfsi \
399	fixsfsi \
400	floatsidf \
401	floatsisf \
402	floatunsidf \
403	floatunsisf \
404	comparedf2 \
405	comparesf2 \
406	modsi3 \
407	muldf3 \
408	mulsf3 \
409	mulodi4 \
410	negdf2 \
411	negsf2 \
412	subdf3 \
413	subsf3 \
414	switch16 \
415	switch32 \
416	switch8 \
417	switchu8 \
418	truncdfsf2 \
419	udivsi3 \
420	umodsi3 \
421	unorddf2 \
422	unordsf2
423
424CCKEXT_ARMVFP_FUNCTIONS := $(CCKEXT_ARM_FUNCTIONS) \
425	adddf3vfp \
426	addsf3vfp \
427	divdf3vfp \
428	divsf3vfp \
429	eqdf2vfp \
430	eqsf2vfp \
431	extendsfdf2vfp \
432	fixdfsivfp \
433	fixsfsivfp \
434	fixunsdfsivfp \
435	fixunssfsivfp \
436	floatsidfvfp \
437	floatsisfvfp \
438	floatunssidfvfp \
439	floatunssisfvfp \
440	gedf2vfp \
441	gesf2vfp \
442	gtdf2vfp \
443	gtsf2vfp \
444	ledf2vfp \
445	lesf2vfp \
446	ltdf2vfp \
447	ltsf2vfp \
448	muldf3vfp \
449	mulsf3vfp \
450	nedf2vfp \
451	nesf2vfp \
452	subdf3vfp \
453	subsf3vfp \
454	truncdfsf2vfp \
455	unorddf2vfp \
456	unordsf2vfp
457
458CCKEXT_ARM64_FUNCTIONS := \
459	$(CCKEXT_PROFILE_FUNCTIONS) \
460	divdc3 \
461	divsc3 \
462	muldc3 \
463	mulsc3 \
464	udivti3 \
465	umodti3
466
467FUNCTIONS.cc_kext_ios.armv7 := $(CCKEXT_ARMVFP_FUNCTIONS)
468FUNCTIONS.cc_kext_ios.armv7k := $(CCKEXT_ARMVFP_FUNCTIONS)
469FUNCTIONS.cc_kext_ios.armv7s := $(CCKEXT_ARMVFP_FUNCTIONS)
470FUNCTIONS.cc_kext_ios.arm64 := $(CCKEXT_ARM64_FUNCTIONS)
471
472CCKEXT_X86_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \
473	divxc3 \
474	fixunsxfdi \
475	fixunsxfsi \
476	fixxfdi \
477	floatdixf \
478	floatundixf \
479	mulxc3 \
480	powixf2
481
482FUNCTIONS.cc_kext.i386 := $(CCKEXT_X86_FUNCTIONS) \
483	ffssi2 \
484	i686.get_pc_thunk.eax \
485	i686.get_pc_thunk.ebp \
486	i686.get_pc_thunk.ebx \
487	i686.get_pc_thunk.ecx \
488	i686.get_pc_thunk.edi \
489	i686.get_pc_thunk.edx \
490	i686.get_pc_thunk.esi
491
492FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \
493	absvti2 \
494	addvti3 \
495	ashlti3 \
496	ashrti3 \
497	clzti2 \
498	cmpti2 \
499	ctzti2 \
500	divti3 \
501	ffsti2 \
502	fixdfti \
503	fixsfti \
504	fixunsdfti \
505	fixunssfti \
506	fixunsxfti \
507	fixxfti \
508	floattidf \
509	floattisf \
510	floattixf \
511	floatuntidf \
512	floatuntisf \
513	floatuntixf \
514	lshrti3 \
515	modti3 \
516	multi3 \
517	mulvti3 \
518	negti2 \
519	negvti2 \
520	parityti2 \
521	popcountti2 \
522	subvti3 \
523	ucmpti2 \
524	udivmodti4 \
525	udivti3 \
526	umodti3
527
528FUNCTIONS.cc_kext.x86_64h := $(FUNCTIONS.cc_kext.x86_64)
529
530# FIXME: Currently, compiler-rt is missing implementations for a number of the
531# functions that need to go into libcc_kext.a. Filter them out for now.
532CCKEXT_MISSING_FUNCTIONS := \
533	cmpdf2 cmpsf2 div0 \
534	ffssi2 \
535	udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \
536	bswapsi2 \
537	gcc_bcmp \
538	do_global_dtors \
539	i686.get_pc_thunk.eax i686.get_pc_thunk.ebp i686.get_pc_thunk.ebx \
540	i686.get_pc_thunk.ecx i686.get_pc_thunk.edi i686.get_pc_thunk.edx \
541	i686.get_pc_thunk.esi \
542	aeabi_cdcmpeq aeabi_cdrcmple aeabi_cfcmpeq aeabi_cfrcmple aeabi_dcmpeq \
543	aeabi_dcmpge aeabi_dcmpgt aeabi_dcmple aeabi_dcmplt aeabi_drsub aeabi_fcmpeq \
544	aeabi_fcmpge aeabi_fcmpgt aeabi_fcmple aeabi_fcmplt aeabi_frsub aeabi_idivmod \
545	aeabi_uidivmod
546
547FUNCTIONS.cc_kext_ios.armv7 := \
548	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7))
549FUNCTIONS.cc_kext_ios.armv7k := \
550	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7k))
551FUNCTIONS.cc_kext_ios.armv7s := \
552	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7s))
553FUNCTIONS.cc_kext_ios.arm64 := \
554	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.arm64))
555FUNCTIONS.cc_kext.i386 := \
556	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.i386))
557FUNCTIONS.cc_kext.x86_64 := \
558	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64))
559FUNCTIONS.cc_kext.x86_64h := \
560	$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64h))
561
562KERNEL_USE.cc_kext := 1
563KERNEL_USE.cc_kext_ios := 1
564
565VISIBILITY_HIDDEN := 1
566
567SHARED_LIBRARY_SUFFIX := dylib
568