1# $NetBSD: Makefile.compiler-rt,v 1.12 2020/04/24 00:22:57 rin 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/builtins/ppc 7COMPILER_RT_ARCH_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/ppc 8.else 9COMPILER_RT_CPU_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_CPU} 10COMPILER_RT_ARCH_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_ARCH} 11.endif 12 13.PATH: ${COMPILER_RT_CPU_DIR} 14.PATH: ${COMPILER_RT_ARCH_DIR} 15.PATH: ${COMPILER_RT_SRCDIR}/lib/builtins 16 17GENERIC_SRCS+= \ 18 absvdi2.c \ 19 absvsi2.c \ 20 absvti2.c \ 21 addvdi3.c \ 22 addvsi3.c \ 23 addvti3.c \ 24 ashlti3.c \ 25 ashrti3.c \ 26 clzti2.c \ 27 cmpti2.c \ 28 ctzti2.c \ 29 divti3.c \ 30 ffsti2.c \ 31 int_util.c \ 32 lshrti3.c \ 33 modti3.c \ 34 mulodi4.c \ 35 mulosi4.c \ 36 muloti4.c \ 37 multi3.c \ 38 mulvdi3.c \ 39 mulvsi3.c \ 40 mulvti3.c \ 41 negti2.c \ 42 negvdi2.c \ 43 negvsi2.c \ 44 negvti2.c \ 45 paritydi2.c \ 46 paritysi2.c \ 47 parityti2.c \ 48 popcountdi2.c \ 49 popcountsi2.c \ 50 popcountti2.c \ 51 subvdi3.c \ 52 subvsi3.c \ 53 subvti3.c \ 54 ucmpti2.c \ 55 udivmodti4.c \ 56 udivti3.c \ 57 umodti3.c 58 59.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 60GENERIC_SRCS+= \ 61 clzsi2.c \ 62 ctzsi2.c 63.endif 64 65.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \ 66 ${MACHINE_ARCH} != "m68k" 67GENERIC_SRCS+= \ 68 divmodsi4.c \ 69 divsi3.c \ 70 modsi3.c \ 71 udivmodsi4.c \ 72 udivsi3.c \ 73 umodsi3.c 74.endif 75 76.if ${MACHINE_CPU} != "aarch64" 77GENERIC_SRCS+= \ 78 clzdi2.c \ 79 ctzdi2.c \ 80 ffsdi2.c 81.endif 82 83.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 84GENERIC_SRCS+= \ 85 ashldi3.c \ 86 ashrdi3.c \ 87 lshrdi3.c 88.endif 89 90.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 91GENERIC_SRCS+= \ 92 cmpdi2.c \ 93 divdi3.c \ 94 divmoddi4.c \ 95 moddi3.c \ 96 muldi3.c \ 97 negdi2.c \ 98 ucmpdi2.c \ 99 udivdi3.c \ 100 udivmoddi4.c \ 101 umoddi3.c 102.endif 103 104.if ${MACHINE_CPU} == "arm" 105. if !empty(MACHINE_ARCH:Mearm*) 106GENERIC_SRCS+= \ 107 aeabi_idivmod.S \ 108 aeabi_ldivmod.S \ 109 aeabi_uidivmod.S \ 110 aeabi_uldivmod.S \ 111 __aeabi_idiv0.c \ 112 __aeabi_ldiv0.c 113. endif 114.endif 115 116.for src in ${GENERIC_SRCS} 117. if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \ 118 exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S) 119SRCS+= ${src:R}.S 120. else 121SRCS+= ${src} 122COPTS.${src}+= -Wno-missing-prototypes \ 123 -Wno-old-style-definition \ 124 -Wno-strict-prototypes \ 125 -Wno-uninitialized 126. endif 127.endfor 128 129CPPFLAGS.int_util.c+= -DKERNEL_USE 130 131# XXX Explicit divide by zero in udivmoddi4.c -> abort(). 132.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" 133. if ${MACHINE_CPU} != "arm" 134COPTS.udivmoddi4.c+= -fnon-call-exceptions 135. endif 136.endif 137