1# $FreeBSD$ 2 3.include <bsd.own.mk> 4 5LIB= compiler_rt 6NO_PIC= 7WARNS?= 2 8 9CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN 10 11.if ${MACHINE_CPUARCH} == "amd64" 12CRTARCH=x86_64 13.else 14CRTARCH=${MACHINE_CPUARCH} 15.endif 16 17CRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib 18 19.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC} 20 21SRCF= absvdi2 \ 22 absvsi2 \ 23 absvti2 \ 24 addvdi3 \ 25 addvsi3 \ 26 addvti3 \ 27 ashldi3 \ 28 ashlti3 \ 29 ashrdi3 \ 30 ashrti3 \ 31 clzdi2 \ 32 clzsi2 \ 33 clzti2 \ 34 cmpdi2 \ 35 cmpti2 \ 36 comparedf2 \ 37 comparesf2 \ 38 ctzdi2 \ 39 ctzsi2 \ 40 ctzti2 \ 41 divdc3 \ 42 divdi3 \ 43 divmoddi4 \ 44 divmodsi4 \ 45 divsc3 \ 46 divti3 \ 47 divxc3 \ 48 enable_execute_stack \ 49 eprintf \ 50 ffsdi2 \ 51 ffsti2 \ 52 fixdfdi \ 53 fixdfti \ 54 fixsfdi \ 55 fixsfti \ 56 fixunsdfdi \ 57 fixunsdfsi \ 58 fixunsdfti \ 59 fixunssfdi \ 60 fixunssfsi \ 61 fixunssfti \ 62 fixunsxfdi \ 63 fixunsxfsi \ 64 fixunsxfti \ 65 fixxfdi \ 66 fixxfti \ 67 floatdidf \ 68 floatdisf \ 69 floatdixf \ 70 floattidf \ 71 floattisf \ 72 floattixf \ 73 floatundidf \ 74 floatundisf \ 75 floatundixf \ 76 floatunsidf \ 77 floatunsisf \ 78 floatuntidf \ 79 floatuntisf \ 80 floatuntixf \ 81 int_util \ 82 lshrdi3 \ 83 lshrti3 \ 84 moddi3 \ 85 modti3 \ 86 muldc3 \ 87 muldi3 \ 88 mulodi4 \ 89 mulosi4 \ 90 muloti4 \ 91 mulsc3 \ 92 multi3 \ 93 mulvdi3 \ 94 mulvsi3 \ 95 mulvti3 \ 96 mulxc3 \ 97 negdf2 \ 98 negdi2 \ 99 negsf2 \ 100 negti2 \ 101 negvdi2 \ 102 negvsi2 \ 103 negvti2 \ 104 paritydi2 \ 105 paritysi2 \ 106 parityti2 \ 107 popcountdi2 \ 108 popcountsi2 \ 109 popcountti2 \ 110 powidf2 \ 111 powisf2 \ 112 powitf2 \ 113 powixf2 \ 114 subvdi3 \ 115 subvsi3 \ 116 subvti3 \ 117 trampoline_setup \ 118 ucmpdi2 \ 119 ucmpti2 \ 120 udivdi3 \ 121 udivmoddi4 \ 122 udivmodsi4 \ 123 udivmodti4 \ 124 udivti3 \ 125 umoddi3 \ 126 umodti3 127 128# Don't build clear_cache on ARM with clang as it is a builtin there. 129.if ${MACHINE_CPUARCH} != "arm" || ${COMPILER_TYPE} != "clang" 130SRCF+= clear_cache 131.endif 132 133# These are already shipped by libc.a on arm and mips 134.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" 135SRCF+= adddf3 \ 136 addsf3 \ 137 divdf3 \ 138 divsf3 \ 139 divsi3 \ 140 extendsfdf2 \ 141 fixdfsi \ 142 fixsfsi \ 143 floatsidf \ 144 floatsisf \ 145 modsi3 \ 146 muldf3 \ 147 mulsf3 \ 148 subdf3 \ 149 subsf3 \ 150 truncdfsf2 \ 151 udivsi3 \ 152 umodsi3 153.endif 154 155# FreeBSD-specific atomic intrinsics. Clang provides them as a builtin. 156.if (${MACHINE_CPUARCH} == "arm" && ${COMPILER_TYPE} != "clang") || \ 157 ${MACHINE_CPUARCH} == "mips" 158SRCF+= __sync_fetch_and_add_4 \ 159 __sync_fetch_and_and_4 \ 160 __sync_fetch_and_or_4 \ 161 __sync_fetch_and_sub_4 \ 162 __sync_fetch_and_xor_4 \ 163 __sync_lock_test_and_set_4 \ 164 __sync_val_compare_and_swap_4 165.endif 166.if ${MACHINE_ARCH:Mmips64*} != "" 167SRCF+= __sync_fetch_and_add_8 \ 168 __sync_fetch_and_and_8 \ 169 __sync_fetch_and_or_8 \ 170 __sync_fetch_and_sub_8 \ 171 __sync_fetch_and_xor_8 \ 172 __sync_lock_test_and_set_8 \ 173 __sync_val_compare_and_swap_8 174.endif 175 176.for file in ${SRCF} 177. if ${MACHINE_CPUARCH} != "arm" && exists(${CRTSRC}/${CRTARCH}/${file}.S) 178SRCS+= ${file}.S 179. else 180SRCS+= ${file}.c 181. endif 182.endfor 183 184.if ${MACHINE_CPUARCH} != "mips" 185. if ${MK_INSTALLLIB} != "no" 186SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a 187. endif 188. if ${MK_PROFILE} != "no" 189SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a 190. endif 191.endif 192 193.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ 194 ${MACHINE_CPUARCH} == "powerpc" 195AFLAGS+=--noexecstack 196ACFLAGS+=-Wa,--noexecstack 197.endif 198 199 200.include <bsd.lib.mk> 201