Makefile.compiler-rt revision 1.11
11.11Srin# $NetBSD: Makefile.compiler-rt,v 1.11 2020/04/23 03:09:18 rin Exp $
21.1Sjoerg
31.1SjoergCOMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
41.1Sjoerg
51.1Sjoerg.if ${MACHINE_ARCH} == "powerpc"
61.4SjoergCOMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
71.4SjoergCOMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
81.1Sjoerg.else
91.4SjoergCOMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_CPU}
101.4SjoergCOMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_ARCH}
111.1Sjoerg.endif
121.1Sjoerg
131.1Sjoerg.PATH: ${COMPILER_RT_CPU_DIR}
141.1Sjoerg.PATH: ${COMPILER_RT_ARCH_DIR}
151.4Sjoerg.PATH: ${COMPILER_RT_SRCDIR}/lib/builtins
161.1Sjoerg
171.1SjoergGENERIC_SRCS+= \
181.1Sjoerg	absvdi2.c \
191.1Sjoerg	absvsi2.c \
201.1Sjoerg	absvti2.c \
211.1Sjoerg	addvdi3.c \
221.1Sjoerg	addvsi3.c \
231.1Sjoerg	addvti3.c \
241.1Sjoerg	ashlti3.c \
251.1Sjoerg	ashrti3.c \
261.1Sjoerg	clzti2.c \
271.1Sjoerg	cmpti2.c \
281.1Sjoerg	ctzti2.c \
291.1Sjoerg	divti3.c \
301.1Sjoerg	ffsti2.c \
311.1Sjoerg	int_util.c \
321.1Sjoerg	lshrti3.c \
331.1Sjoerg	modti3.c \
341.1Sjoerg	mulodi4.c \
351.1Sjoerg	mulosi4.c \
361.1Sjoerg	muloti4.c \
371.1Sjoerg	multi3.c \
381.1Sjoerg	mulvdi3.c \
391.1Sjoerg	mulvsi3.c \
401.1Sjoerg	mulvti3.c \
411.1Sjoerg	negti2.c \
421.1Sjoerg	negvdi2.c \
431.1Sjoerg	negvsi2.c \
441.1Sjoerg	negvti2.c \
451.1Sjoerg	paritydi2.c \
461.1Sjoerg	paritysi2.c \
471.1Sjoerg	parityti2.c \
481.1Sjoerg	popcountdi2.c \
491.1Sjoerg	popcountsi2.c \
501.1Sjoerg	popcountti2.c \
511.1Sjoerg	subvdi3.c \
521.1Sjoerg	subvsi3.c \
531.1Sjoerg	subvti3.c \
541.1Sjoerg	ucmpti2.c \
551.1Sjoerg	udivmodti4.c \
561.1Sjoerg	udivti3.c \
571.1Sjoerg	umodti3.c
581.1Sjoerg
591.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
601.5SmattGENERIC_SRCS+= \
611.5Smatt	clzsi2.c \
621.5Smatt	ctzsi2.c
631.5Smatt.endif
641.5Smatt
651.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
661.5SmattGENERIC_SRCS+= \
671.5Smatt	divmodsi4.c \
681.11Srin	udivmodsi4.c
691.11Srin.endif
701.11Srin
711.11Srin.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
721.11Srin    ${MACHINE_ARCH} != "m68k"
731.11SrinGENERIC_SRCS+= \
741.5Smatt	divsi3.c \
751.5Smatt	modsi3.c \
761.5Smatt	udivsi3.c \
771.5Smatt	umodsi3.c
781.5Smatt.endif
791.5Smatt
801.9Sthorpej.if ${MACHINE_CPU} != "aarch64"
811.5SmattGENERIC_SRCS+= \
821.5Smatt	clzdi2.c \
831.5Smatt	ctzdi2.c \
841.5Smatt	ffsdi2.c
851.5Smatt.endif
861.5Smatt
871.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
881.5SmattGENERIC_SRCS+= \
891.5Smatt	ashldi3.c \
901.5Smatt	ashrdi3.c \
911.5Smatt	lshrdi3.c
921.5Smatt.endif
931.5Smatt
941.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
951.5SmattGENERIC_SRCS+= \
961.5Smatt	cmpdi2.c \
971.5Smatt	divdi3.c \
981.5Smatt	divmoddi4.c \
991.5Smatt	moddi3.c \
1001.5Smatt	muldi3.c \
1011.5Smatt	negdi2.c \
1021.5Smatt	ucmpdi2.c \
1031.5Smatt	udivdi3.c \
1041.5Smatt	udivmoddi4.c \
1051.5Smatt	umoddi3.c
1061.5Smatt.endif
1071.5Smatt
1081.1Sjoerg.if ${MACHINE_CPU} == "arm"
1091.2Sjoerg.  if !empty(MACHINE_ARCH:Mearm*)
1101.1SjoergGENERIC_SRCS+= \
1111.1Sjoerg	aeabi_idivmod.S \
1121.1Sjoerg	aeabi_ldivmod.S \
1131.1Sjoerg	aeabi_uidivmod.S \
1141.3Sjoerg	aeabi_uldivmod.S \
1151.3Sjoerg	__aeabi_idiv0.c \
1161.3Sjoerg	__aeabi_ldiv0.c
1171.1Sjoerg.  endif
1181.1Sjoerg.endif
1191.1Sjoerg
1201.1Sjoerg.for src in ${GENERIC_SRCS}
1211.1Sjoerg.  if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \
1221.1Sjoerg      exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S)
1231.1SjoergSRCS+=	${src:R}.S
1241.1Sjoerg.  else
1251.1SjoergSRCS+=	${src}
1261.1SjoergCOPTS.${src}+=	-Wno-missing-prototypes \
1271.1Sjoerg		-Wno-old-style-definition \
1281.1Sjoerg		-Wno-strict-prototypes \
1291.1Sjoerg		-Wno-uninitialized
1301.1Sjoerg.  endif
1311.1Sjoerg.endfor
1321.1Sjoerg
1331.1SjoergCPPFLAGS.int_util.c+=	-DKERNEL_USE
1341.6Smrg
1351.6Smrg# XXX Explicit divide by zero in udivmoddi4.c -> abort().
1361.10Smrg.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
1371.8Smrg. if ${MACHINE_CPU} != "arm"
1381.6SmrgCOPTS.udivmoddi4.c+=	-fnon-call-exceptions
1391.8Smrg. endif
1401.6Smrg.endif
141