Makefile.compiler-rt revision 1.13
11.13Srin# $NetBSD: Makefile.compiler-rt,v 1.13 2021/06/16 05:21:09 rin Exp $
21.1Sjoerg
31.13SrinCOMPILER_RT_DIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt
41.13SrinCOMPILER_RT_SRCDIR=	${COMPILER_RT_DIR}/dist
51.1Sjoerg
61.1Sjoerg.if ${MACHINE_ARCH} == "powerpc"
71.4SjoergCOMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
81.4SjoergCOMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/ppc
91.1Sjoerg.else
101.4SjoergCOMPILER_RT_CPU_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_CPU}
111.4SjoergCOMPILER_RT_ARCH_DIR=	${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_ARCH}
121.1Sjoerg.endif
131.1Sjoerg
141.1Sjoerg.PATH: ${COMPILER_RT_CPU_DIR}
151.1Sjoerg.PATH: ${COMPILER_RT_ARCH_DIR}
161.4Sjoerg.PATH: ${COMPILER_RT_SRCDIR}/lib/builtins
171.1Sjoerg
181.1SjoergGENERIC_SRCS+= \
191.1Sjoerg	absvdi2.c \
201.1Sjoerg	absvsi2.c \
211.1Sjoerg	absvti2.c \
221.1Sjoerg	addvdi3.c \
231.1Sjoerg	addvsi3.c \
241.1Sjoerg	addvti3.c \
251.1Sjoerg	ashlti3.c \
261.1Sjoerg	ashrti3.c \
271.1Sjoerg	clzti2.c \
281.1Sjoerg	cmpti2.c \
291.1Sjoerg	ctzti2.c \
301.1Sjoerg	divti3.c \
311.1Sjoerg	ffsti2.c \
321.1Sjoerg	int_util.c \
331.1Sjoerg	lshrti3.c \
341.1Sjoerg	modti3.c \
351.1Sjoerg	mulodi4.c \
361.1Sjoerg	mulosi4.c \
371.1Sjoerg	muloti4.c \
381.1Sjoerg	multi3.c \
391.1Sjoerg	mulvdi3.c \
401.1Sjoerg	mulvsi3.c \
411.1Sjoerg	mulvti3.c \
421.1Sjoerg	negti2.c \
431.1Sjoerg	negvdi2.c \
441.1Sjoerg	negvsi2.c \
451.1Sjoerg	negvti2.c \
461.1Sjoerg	paritydi2.c \
471.1Sjoerg	paritysi2.c \
481.1Sjoerg	parityti2.c \
491.1Sjoerg	popcountdi2.c \
501.1Sjoerg	popcountsi2.c \
511.1Sjoerg	popcountti2.c \
521.1Sjoerg	subvdi3.c \
531.1Sjoerg	subvsi3.c \
541.1Sjoerg	subvti3.c \
551.1Sjoerg	ucmpti2.c \
561.1Sjoerg	udivmodti4.c \
571.1Sjoerg	udivti3.c \
581.1Sjoerg	umodti3.c
591.1Sjoerg
601.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
611.5SmattGENERIC_SRCS+= \
621.5Smatt	clzsi2.c \
631.5Smatt	ctzsi2.c
641.5Smatt.endif
651.5Smatt
661.11Srin.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
671.11Srin    ${MACHINE_ARCH} != "m68k"
681.11SrinGENERIC_SRCS+= \
691.12Srin	divmodsi4.c \
701.5Smatt	divsi3.c \
711.5Smatt	modsi3.c \
721.12Srin	udivmodsi4.c \
731.5Smatt	udivsi3.c \
741.5Smatt	umodsi3.c
751.5Smatt.endif
761.5Smatt
771.9Sthorpej.if ${MACHINE_CPU} != "aarch64"
781.5SmattGENERIC_SRCS+= \
791.5Smatt	clzdi2.c \
801.5Smatt	ctzdi2.c \
811.5Smatt	ffsdi2.c
821.5Smatt.endif
831.5Smatt
841.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
851.5SmattGENERIC_SRCS+= \
861.5Smatt	ashldi3.c \
871.5Smatt	ashrdi3.c \
881.5Smatt	lshrdi3.c
891.5Smatt.endif
901.5Smatt
911.5Smatt.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
921.5SmattGENERIC_SRCS+= \
931.5Smatt	cmpdi2.c \
941.5Smatt	divdi3.c \
951.5Smatt	divmoddi4.c \
961.5Smatt	moddi3.c \
971.5Smatt	muldi3.c \
981.5Smatt	negdi2.c \
991.5Smatt	ucmpdi2.c \
1001.5Smatt	udivdi3.c \
1011.5Smatt	udivmoddi4.c \
1021.5Smatt	umoddi3.c
1031.5Smatt.endif
1041.5Smatt
1051.1Sjoerg.if ${MACHINE_CPU} == "arm"
1061.2Sjoerg.  if !empty(MACHINE_ARCH:Mearm*)
1071.1SjoergGENERIC_SRCS+= \
1081.1Sjoerg	aeabi_idivmod.S \
1091.1Sjoerg	aeabi_ldivmod.S \
1101.1Sjoerg	aeabi_uidivmod.S \
1111.3Sjoerg	aeabi_uldivmod.S \
1121.3Sjoerg	__aeabi_idiv0.c \
1131.3Sjoerg	__aeabi_ldiv0.c
1141.1Sjoerg.  endif
1151.1Sjoerg.endif
1161.1Sjoerg
1171.1Sjoerg.for src in ${GENERIC_SRCS}
1181.1Sjoerg.  if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \
1191.1Sjoerg      exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S)
1201.1SjoergSRCS+=	${src:R}.S
1211.1Sjoerg.  else
1221.1SjoergSRCS+=	${src}
1231.1SjoergCOPTS.${src}+=	-Wno-missing-prototypes \
1241.1Sjoerg		-Wno-old-style-definition \
1251.1Sjoerg		-Wno-strict-prototypes \
1261.1Sjoerg		-Wno-uninitialized
1271.1Sjoerg.  endif
1281.1Sjoerg.endfor
1291.1Sjoerg
1301.1SjoergCPPFLAGS.int_util.c+=	-DKERNEL_USE
1311.6Smrg
1321.6Smrg# XXX Explicit divide by zero in udivmoddi4.c -> abort().
1331.10Smrg.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
1341.8Smrg. if ${MACHINE_CPU} != "arm"
1351.6SmrgCOPTS.udivmoddi4.c+=	-fnon-call-exceptions
1361.8Smrg. endif
1371.6Smrg.endif
1381.13Srin
1391.13Srin# XXX This makes no binary changes at the moment.
1401.13Srin.include "${COMPILER_RT_DIR}/abi.mk"
141