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 extendsfdf2 \ 140 fixdfsi \ 141 fixsfsi \ 142 floatsidf \ 143 floatsisf \ 144 muldf3 \ 145 mulsf3 \ 146 subdf3 \ 147 subsf3 \ 148 truncdfsf2 149.endif 150 151.if ${MACHINE_CPUARCH} != "mips" && \ 152 (${MACHINE_CPUARCH} != "arm" || ${MK_ARM_EABI} != "no") 153SRCF+= divsi3 \ 154 modsi3 \ 155 udivsi3 \ 156 umodsi3 157.endif 158 159# FreeBSD-specific atomic intrinsics. 160.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" 161SRCF+= __sync_fetch_and_add_4 \ 162 __sync_fetch_and_and_4 \ 163 __sync_fetch_and_or_4 \ 164 __sync_fetch_and_sub_4 \ 165 __sync_fetch_and_xor_4 \ 166 __sync_lock_test_and_set_4 \ 167 __sync_synchronize \ 168 __sync_val_compare_and_swap_4 169.endif 170.if ${MACHINE_ARCH:Mmips64*} != "" 171SRCF+= __sync_fetch_and_add_8 \ 172 __sync_fetch_and_and_8 \ 173 __sync_fetch_and_or_8 \ 174 __sync_fetch_and_sub_8 \ 175 __sync_fetch_and_xor_8 \ 176 __sync_lock_test_and_set_8 \ 177 __sync_val_compare_and_swap_8 178.endif 179 180.for file in ${SRCF} 181. if ${MACHINE_CPUARCH} != "arm" && exists(${CRTSRC}/${CRTARCH}/${file}.S) 182SRCS+= ${file}.S 183. else 184SRCS+= ${file}.c 185. endif 186.endfor 187 188.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 189SRCS+= aeabi_idivmod.S \ 190 aeabi_ldivmod.S \ 191 aeabi_memcmp.S \ 192 aeabi_memcpy.S \ 193 aeabi_memmove.S \ 194 aeabi_memset.S \ 195 aeabi_uidivmod.S \ 196 aeabi_uldivmod.S 197.endif 198 199.if ${MK_INSTALLLIB} != "no" 200SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a 201.endif 202.if ${MK_PROFILE} != "no" 203SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a 204.endif 205 206.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ 207 ${MACHINE_CPUARCH} == "powerpc" 208AFLAGS+=--noexecstack 209ACFLAGS+=-Wa,--noexecstack 210.endif 211 212 213.include <bsd.lib.mk> 214