1 # $NetBSD: Makefile.compiler-rt,v 1.9 2019/04/05 14:00:16 thorpej Exp $ 2 3 COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist 4 5 .if ${MACHINE_ARCH} == "powerpc" 6 COMPILER_RT_CPU_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/ppc 7 COMPILER_RT_ARCH_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/ppc 8 .else 9 COMPILER_RT_CPU_DIR= ${COMPILER_RT_SRCDIR}/lib/builtins/${MACHINE_CPU} 10 COMPILER_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 17 GENERIC_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" 60 GENERIC_SRCS+= \ 61 clzsi2.c \ 62 ctzsi2.c 63 .endif 64 65 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 66 GENERIC_SRCS+= \ 67 divmodsi4.c \ 68 divsi3.c \ 69 modsi3.c \ 70 udivmodsi4.c \ 71 udivsi3.c \ 72 umodsi3.c 73 .endif 74 75 .if ${MACHINE_CPU} != "aarch64" 76 GENERIC_SRCS+= \ 77 clzdi2.c \ 78 ctzdi2.c \ 79 ffsdi2.c 80 .endif 81 82 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 83 GENERIC_SRCS+= \ 84 ashldi3.c \ 85 ashrdi3.c \ 86 lshrdi3.c 87 .endif 88 89 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" 90 GENERIC_SRCS+= \ 91 cmpdi2.c \ 92 divdi3.c \ 93 divmoddi4.c \ 94 moddi3.c \ 95 muldi3.c \ 96 negdi2.c \ 97 ucmpdi2.c \ 98 udivdi3.c \ 99 udivmoddi4.c \ 100 umoddi3.c 101 .endif 102 103 .if ${MACHINE_CPU} == "arm" 104 . if !empty(MACHINE_ARCH:Mearm*) 105 GENERIC_SRCS+= \ 106 aeabi_idivmod.S \ 107 aeabi_ldivmod.S \ 108 aeabi_uidivmod.S \ 109 aeabi_uldivmod.S \ 110 __aeabi_idiv0.c \ 111 __aeabi_ldiv0.c 112 . endif 113 .endif 114 115 .for src in ${GENERIC_SRCS} 116 . if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \ 117 exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S) 118 SRCS+= ${src:R}.S 119 . else 120 SRCS+= ${src} 121 COPTS.${src}+= -Wno-missing-prototypes \ 122 -Wno-old-style-definition \ 123 -Wno-strict-prototypes \ 124 -Wno-uninitialized 125 . endif 126 .endfor 127 128 CPPFLAGS.int_util.c+= -DKERNEL_USE 129 130 # XXX Explicit divide by zero in udivmoddi4.c -> abort(). 131 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc" 132 . if ${MACHINE_CPU} != "arm" 133 COPTS.udivmoddi4.c+= -fnon-call-exceptions 134 . endif 135 .endif 136