1# $FreeBSD$ 2 3.include <bsd.compiler.mk> 4 5CRTARCH= ${MACHINE_CPUARCH:C/amd64/x86_64/} 6 7CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins 8 9.PATH: ${CRTSRC}/${CRTARCH} 10.PATH: ${CRTSRC} 11 12SRCF+= absvdi2 13SRCF+= absvsi2 14SRCF+= absvti2 15SRCF+= addvdi3 16SRCF+= addvsi3 17SRCF+= addvti3 18SRCF+= apple_versioning 19SRCF+= ashldi3 20SRCF+= ashlti3 21SRCF+= ashrdi3 22SRCF+= ashrti3 23SRCF+= atomic 24SRCF+= bswapdi2 25SRCF+= bswapsi2 26SRCF+= clear_cache 27SRCF+= clzdi2 28SRCF+= clzsi2 29SRCF+= clzti2 30SRCF+= cmpdi2 31SRCF+= cmpti2 32SRCF+= ctzdi2 33SRCF+= ctzsi2 34SRCF+= ctzti2 35SRCF+= divdc3 36SRCF+= divdi3 37SRCF+= divmoddi4 38SRCF+= divmodsi4 39SRCF+= divsc3 40SRCF+= divsi3 41SRCF+= divtc3 42SRCF+= divti3 43SRCF+= divxc3 44SRCF+= enable_execute_stack 45SRCF+= eprintf 46SRCF+= extendhfsf2 47SRCF+= ffsdi2 48SRCF+= ffssi2 49SRCF+= ffsti2 50SRCF+= fixdfdi 51SRCF+= fixdfti 52SRCF+= fixsfdi 53SRCF+= fixsfti 54SRCF+= fixunsdfdi 55SRCF+= fixunsdfsi 56SRCF+= fixunsdfti 57SRCF+= fixunssfdi 58SRCF+= fixunssfsi 59SRCF+= fixunssfti 60SRCF+= fixunsxfdi 61SRCF+= fixunsxfsi 62SRCF+= fixunsxfti 63SRCF+= fixxfdi 64SRCF+= fixxfti 65SRCF+= floatditf 66SRCF+= floattidf 67SRCF+= floattisf 68SRCF+= floattixf 69SRCF+= floatunditf 70SRCF+= floatunsidf 71SRCF+= floatunsisf 72SRCF+= floatuntidf 73SRCF+= floatuntisf 74SRCF+= floatuntixf 75SRCF+= int_util 76SRCF+= lshrdi3 77SRCF+= lshrti3 78SRCF+= moddi3 79SRCF+= modsi3 80SRCF+= modti3 81SRCF+= muldc3 82SRCF+= muldi3 83SRCF+= mulodi4 84SRCF+= mulosi4 85SRCF+= muloti4 86SRCF+= mulsc3 87SRCF+= multc3 88SRCF+= multi3 89SRCF+= mulvdi3 90SRCF+= mulvsi3 91SRCF+= mulvti3 92SRCF+= mulxc3 93SRCF+= negdf2 94SRCF+= negdi2 95SRCF+= negsf2 96SRCF+= negti2 97SRCF+= negvdi2 98SRCF+= negvsi2 99SRCF+= negvti2 100SRCF+= paritydi2 101SRCF+= paritysi2 102SRCF+= parityti2 103SRCF+= popcountdi2 104SRCF+= popcountsi2 105SRCF+= popcountti2 106SRCF+= powidf2 107SRCF+= powisf2 108SRCF+= powitf2 109SRCF+= powixf2 110SRCF+= subvdi3 111SRCF+= subvsi3 112SRCF+= subvti3 113SRCF+= trampoline_setup 114SRCF+= truncdfhf2 115SRCF+= truncsfhf2 116SRCF+= ucmpdi2 117SRCF+= ucmpti2 118SRCF+= udivdi3 119SRCF+= udivmoddi4 120SRCF+= udivmodsi4 121SRCF+= udivmodti4 122SRCF+= udivsi3 123SRCF+= udivti3 124SRCF+= umoddi3 125SRCF+= umodsi3 126SRCF+= umodti3 127 128.if "${COMPILER_TYPE}" == "clang" 129CFLAGS.atomic.c+= -Wno-atomic-alignment 130.endif 131 132# Avoid using SSE2 instructions on i386, if unsupported. 133.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) 134SRCS+= floatdidf.c 135SRCS+= floatdisf.c 136SRCS+= floatdixf.c 137SRCS+= floatundidf.c 138SRCS+= floatundisf.c 139SRCS+= floatundixf.c 140.else 141SRCF+= floatdidf 142SRCF+= floatdisf 143SRCF+= floatdixf 144SRCF+= floatundidf 145SRCF+= floatundisf 146SRCF+= floatundixf 147.endif 148 149# __cpu_model support, only used on x86 150.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 151SRCF+= cpu_model 152.endif 153 154# The fp_mode implementation for amd64 and i386 is shared, while other 155# architectures use the regular approach. 156.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 157SRCS+= i386/fp_mode.c 158.else 159SRCF+= fp_mode 160.endif 161 162# 163# 128-bit quad precision long double support, 164# only used on some architectures. 165# 166.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" 167SRCF+= addtf3 168SRCF+= comparetf2 169SRCF+= divtf3 170SRCF+= extenddftf2 171SRCF+= extendsftf2 172SRCF+= fixtfdi 173SRCF+= fixtfsi 174SRCF+= fixtfti 175SRCF+= fixunstfdi 176SRCF+= fixunstfsi 177SRCF+= fixunstfti 178SRCF+= floatsitf 179SRCF+= floattitf 180SRCF+= floatunsitf 181SRCF+= floatuntitf 182SRCF+= multf3 183SRCF+= subtf3 184SRCF+= trunctfdf2 185SRCF+= trunctfsf2 186.endif 187 188# These are already shipped by libc.a on some architectures. 189.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \ 190 ${MACHINE_CPUARCH} != "riscv" 191SRCF+= adddf3 192SRCF+= addsf3 193SRCF+= divdf3 194SRCF+= divsf3 195SRCF+= extendsfdf2 196SRCF+= fixdfsi 197SRCF+= fixsfsi 198SRCF+= floatsidf 199SRCF+= floatsisf 200SRCF+= muldf3 201SRCF+= mulsf3 202SRCF+= subdf3 203SRCF+= subsf3 204SRCF+= truncdfsf2 205.endif 206 207.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" 208SRCF+= comparedf2 209SRCF+= comparesf2 210.endif 211 212# FreeBSD-specific atomic intrinsics. 213.if ${MACHINE_CPUARCH} == "arm" 214.PATH: ${SRCTOP}/sys/arm/arm 215 216SRCF+= stdatomic 217CFLAGS+= -DEMIT_SYNC_ATOMICS 218.elif ${MACHINE_CPUARCH} == "mips" 219.PATH: ${SRCTOP}/sys/mips/mips 220 221SRCF+= stdatomic 222.endif 223 224.for file in ${SRCF} 225.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \ 226 && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) 227SRCS+= ${file}vfp.S 228. elif exists(${CRTSRC}/${CRTARCH}/${file}.S) 229SRCS+= ${file}.S 230. else 231SRCS+= ${file}.c 232. endif 233.endfor 234 235.if ${MACHINE_CPUARCH} == "arm" 236SRCS+= aeabi_div0.c 237SRCS+= aeabi_idivmod.S 238SRCS+= aeabi_ldivmod.S 239SRCS+= aeabi_memcmp.S 240SRCS+= aeabi_memcpy.S 241SRCS+= aeabi_memmove.S 242SRCS+= aeabi_memset.S 243SRCS+= aeabi_uidivmod.S 244SRCS+= aeabi_uldivmod.S 245SRCS+= switch16.S 246SRCS+= switch32.S 247SRCS+= switch8.S 248SRCS+= switchu8.S 249SRCS+= sync_synchronize.S 250.endif 251 252.if ${MACHINE_ARCH:Mriscv*sf} 253CFLAGS+= -D__SOFT_FP__ 254.endif 255