1a3cf0ef5SEd Schouten# $FreeBSD$ 2a3cf0ef5SEd Schouten 3c6063d0dSWarner Losh.include <src.opts.mk> 4a3cf0ef5SEd Schouten 5a3cf0ef5SEd SchoutenLIB= compiler_rt 6a3cf0ef5SEd SchoutenNO_PIC= 7a3cf0ef5SEd SchoutenWARNS?= 2 8a3cf0ef5SEd Schouten 9a1896337SEd SchoutenCFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBILITY_HIDDEN 10a3cf0ef5SEd Schouten 11a3cf0ef5SEd Schouten.if ${MACHINE_CPUARCH} == "amd64" 12a3cf0ef5SEd SchoutenCRTARCH=x86_64 13a3cf0ef5SEd Schouten.else 14a3cf0ef5SEd SchoutenCRTARCH=${MACHINE_CPUARCH} 15a3cf0ef5SEd Schouten.endif 16a3cf0ef5SEd Schouten 17*f4341a5aSDimitry AndricCRTSRC=${.CURDIR}/../../contrib/compiler-rt/lib/builtins 18a3cf0ef5SEd Schouten 19a3cf0ef5SEd Schouten.PATH: ${CRTSRC}/${CRTARCH} ${CRTSRC} 20a3cf0ef5SEd Schouten 21a3cf0ef5SEd SchoutenSRCF= absvdi2 \ 22a3cf0ef5SEd Schouten absvsi2 \ 23a3cf0ef5SEd Schouten absvti2 \ 24*f4341a5aSDimitry Andric addtf3 \ 25a3cf0ef5SEd Schouten addvdi3 \ 26a3cf0ef5SEd Schouten addvsi3 \ 27a3cf0ef5SEd Schouten addvti3 \ 28*f4341a5aSDimitry Andric apple_versioning \ 29a3cf0ef5SEd Schouten ashldi3 \ 30a3cf0ef5SEd Schouten ashlti3 \ 31a3cf0ef5SEd Schouten ashrdi3 \ 32a3cf0ef5SEd Schouten ashrti3 \ 338b02079fSAndrew Turner clear_cache \ 34a3cf0ef5SEd Schouten clzdi2 \ 35a3cf0ef5SEd Schouten clzsi2 \ 36a3cf0ef5SEd Schouten clzti2 \ 37a3cf0ef5SEd Schouten cmpdi2 \ 38a3cf0ef5SEd Schouten cmpti2 \ 39a3cf0ef5SEd Schouten comparedf2 \ 40a3cf0ef5SEd Schouten comparesf2 \ 41a3cf0ef5SEd Schouten ctzdi2 \ 42a3cf0ef5SEd Schouten ctzsi2 \ 43a3cf0ef5SEd Schouten ctzti2 \ 44a3cf0ef5SEd Schouten divdc3 \ 45a3cf0ef5SEd Schouten divdi3 \ 46ef8821e5SEd Schouten divmoddi4 \ 47ef8821e5SEd Schouten divmodsi4 \ 48a3cf0ef5SEd Schouten divsc3 \ 49*f4341a5aSDimitry Andric divtf3 \ 50a3cf0ef5SEd Schouten divti3 \ 51a3cf0ef5SEd Schouten divxc3 \ 52a3cf0ef5SEd Schouten enable_execute_stack \ 53a3cf0ef5SEd Schouten eprintf \ 54a3cf0ef5SEd Schouten ffsdi2 \ 55a3cf0ef5SEd Schouten ffsti2 \ 56a3cf0ef5SEd Schouten fixdfdi \ 57a3cf0ef5SEd Schouten fixdfti \ 58a3cf0ef5SEd Schouten fixsfdi \ 59a3cf0ef5SEd Schouten fixsfti \ 60a3cf0ef5SEd Schouten fixunsdfdi \ 61a3cf0ef5SEd Schouten fixunsdfsi \ 62a3cf0ef5SEd Schouten fixunsdfti \ 63a3cf0ef5SEd Schouten fixunssfdi \ 64a3cf0ef5SEd Schouten fixunssfsi \ 65a3cf0ef5SEd Schouten fixunssfti \ 66a3cf0ef5SEd Schouten fixunsxfdi \ 67a3cf0ef5SEd Schouten fixunsxfsi \ 68a3cf0ef5SEd Schouten fixunsxfti \ 69a3cf0ef5SEd Schouten fixxfdi \ 70a3cf0ef5SEd Schouten fixxfti \ 71a3cf0ef5SEd Schouten floatdidf \ 72a3cf0ef5SEd Schouten floatdisf \ 73a3cf0ef5SEd Schouten floatdixf \ 74a3cf0ef5SEd Schouten floattidf \ 75a3cf0ef5SEd Schouten floattisf \ 76a3cf0ef5SEd Schouten floattixf \ 77a3cf0ef5SEd Schouten floatundidf \ 78a3cf0ef5SEd Schouten floatundisf \ 79a3cf0ef5SEd Schouten floatundixf \ 80a3cf0ef5SEd Schouten floatunsidf \ 81a3cf0ef5SEd Schouten floatunsisf \ 82a3cf0ef5SEd Schouten floatuntidf \ 83a3cf0ef5SEd Schouten floatuntisf \ 84a3cf0ef5SEd Schouten floatuntixf \ 85*f4341a5aSDimitry Andric gcc_personality_v0 \ 867686ff74SEd Schouten int_util \ 87a3cf0ef5SEd Schouten lshrdi3 \ 88a3cf0ef5SEd Schouten lshrti3 \ 89a3cf0ef5SEd Schouten moddi3 \ 90a3cf0ef5SEd Schouten modti3 \ 91a3cf0ef5SEd Schouten muldc3 \ 92a3cf0ef5SEd Schouten muldi3 \ 937686ff74SEd Schouten mulodi4 \ 947686ff74SEd Schouten mulosi4 \ 957686ff74SEd Schouten muloti4 \ 96a3cf0ef5SEd Schouten mulsc3 \ 97*f4341a5aSDimitry Andric multf3 \ 98a3cf0ef5SEd Schouten multi3 \ 99a3cf0ef5SEd Schouten mulvdi3 \ 100a3cf0ef5SEd Schouten mulvsi3 \ 101a3cf0ef5SEd Schouten mulvti3 \ 102a3cf0ef5SEd Schouten mulxc3 \ 103a3cf0ef5SEd Schouten negdf2 \ 104a3cf0ef5SEd Schouten negdi2 \ 105a3cf0ef5SEd Schouten negsf2 \ 106a3cf0ef5SEd Schouten negti2 \ 107a3cf0ef5SEd Schouten negvdi2 \ 108a3cf0ef5SEd Schouten negvsi2 \ 109a3cf0ef5SEd Schouten negvti2 \ 110a3cf0ef5SEd Schouten paritydi2 \ 111a3cf0ef5SEd Schouten paritysi2 \ 112a3cf0ef5SEd Schouten parityti2 \ 113a3cf0ef5SEd Schouten popcountdi2 \ 114a3cf0ef5SEd Schouten popcountsi2 \ 115a3cf0ef5SEd Schouten popcountti2 \ 116a3cf0ef5SEd Schouten powidf2 \ 117a3cf0ef5SEd Schouten powisf2 \ 118a3cf0ef5SEd Schouten powitf2 \ 119a3cf0ef5SEd Schouten powixf2 \ 120*f4341a5aSDimitry Andric subtf3 \ 121a3cf0ef5SEd Schouten subvdi3 \ 122a3cf0ef5SEd Schouten subvsi3 \ 123a3cf0ef5SEd Schouten subvti3 \ 124a3cf0ef5SEd Schouten trampoline_setup \ 125a3cf0ef5SEd Schouten ucmpdi2 \ 126a3cf0ef5SEd Schouten ucmpti2 \ 127a3cf0ef5SEd Schouten udivdi3 \ 128a3cf0ef5SEd Schouten udivmoddi4 \ 129ef8821e5SEd Schouten udivmodsi4 \ 130a3cf0ef5SEd Schouten udivmodti4 \ 131a3cf0ef5SEd Schouten udivti3 \ 132a3cf0ef5SEd Schouten umoddi3 \ 133a3cf0ef5SEd Schouten umodti3 134a3cf0ef5SEd Schouten 135a3cf0ef5SEd Schouten# These are already shipped by libc.a on arm and mips 136a3cf0ef5SEd Schouten.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" 137a3cf0ef5SEd SchoutenSRCF+= adddf3 \ 138a3cf0ef5SEd Schouten addsf3 \ 139a3cf0ef5SEd Schouten divdf3 \ 140a3cf0ef5SEd Schouten divsf3 \ 141a3cf0ef5SEd Schouten extendsfdf2 \ 142a3cf0ef5SEd Schouten fixdfsi \ 143a3cf0ef5SEd Schouten fixsfsi \ 144a3cf0ef5SEd Schouten floatsidf \ 145a3cf0ef5SEd Schouten floatsisf \ 146a3cf0ef5SEd Schouten muldf3 \ 147a3cf0ef5SEd Schouten mulsf3 \ 148ef8821e5SEd Schouten subdf3 \ 149ef8821e5SEd Schouten subsf3 \ 150bb41cbb2SAndrew Turner truncdfsf2 151bb41cbb2SAndrew Turner.endif 152bb41cbb2SAndrew Turner 1536d4766c1SAndrew Turner.if ${MACHINE_CPUARCH} != "mips" 154bb41cbb2SAndrew TurnerSRCF+= divsi3 \ 155bb41cbb2SAndrew Turner modsi3 \ 156a3cf0ef5SEd Schouten udivsi3 \ 157a3cf0ef5SEd Schouten umodsi3 158a3cf0ef5SEd Schouten.endif 159a3cf0ef5SEd Schouten 1600315980bSEd Schouten# FreeBSD-specific atomic intrinsics. 161e1c0c642SDavid Chisnall.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6" 1622d5add2aSEd Schouten.PATH: ${.CURDIR}/../../sys/arm/arm 1632d5add2aSEd Schouten 1642d5add2aSEd SchoutenSRCF+= stdatomic 165e1c0c642SDavid ChisnallCFLAGS+= -DEMIT_SYNC_ATOMICS 166e737464fSEd Schouten.elif ${MACHINE_CPUARCH} == "mips" 167e737464fSEd Schouten.PATH: ${.CURDIR}/../../sys/mips/mips 168e737464fSEd Schouten 169e737464fSEd SchoutenSRCF+= stdatomic 1706d57c750SEd Schouten.endif 1716d57c750SEd Schouten 172a3cf0ef5SEd Schouten.for file in ${SRCF} 173eabf853dSAndrew Turner. if ${MACHINE_ARCH:Marm*hf*} != "" && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) 17473279d41SAndrew TurnerSRCS+= ${file}vfp.S 175eabf853dSAndrew Turner. elif !(${MACHINE_CPUARCH} == "arm" && ${MACHINE_ARCH:Marm*hf*} == "") && exists(${CRTSRC}/${CRTARCH}/${file}.S) 176a3cf0ef5SEd SchoutenSRCS+= ${file}.S 177a3cf0ef5SEd Schouten. else 178a3cf0ef5SEd SchoutenSRCS+= ${file}.c 179a3cf0ef5SEd Schouten. endif 180a3cf0ef5SEd Schouten.endfor 181a3cf0ef5SEd Schouten 1826d4766c1SAndrew Turner.if ${MACHINE_CPUARCH} == "arm" 183*f4341a5aSDimitry AndricSRCS+= aeabi_dcmp.S \ 184*f4341a5aSDimitry Andric aeabi_div0.S \ 185*f4341a5aSDimitry Andric aeabi_fcmp.S \ 186*f4341a5aSDimitry Andric aeabi_idivmod.S \ 18779ef2c64SAndrew Turner aeabi_ldivmod.S \ 188d74bcf9dSAndrew Turner aeabi_memcmp.S \ 189d74bcf9dSAndrew Turner aeabi_memcpy.S \ 190d74bcf9dSAndrew Turner aeabi_memmove.S \ 191d74bcf9dSAndrew Turner aeabi_memset.S \ 19279ef2c64SAndrew Turner aeabi_uidivmod.S \ 193*f4341a5aSDimitry Andric aeabi_uldivmod.S \ 194*f4341a5aSDimitry Andric bswapdi2.S \ 195*f4341a5aSDimitry Andric bswapsi2.S \ 196*f4341a5aSDimitry Andric eqdf2.S \ 197*f4341a5aSDimitry Andric eqsf2.S \ 198*f4341a5aSDimitry Andric floatunssidf.S \ 199*f4341a5aSDimitry Andric floatunssisf.S \ 200*f4341a5aSDimitry Andric gedf2.S \ 201*f4341a5aSDimitry Andric gesf2.S \ 202*f4341a5aSDimitry Andric gtdf2.S \ 203*f4341a5aSDimitry Andric gtsf2.S \ 204*f4341a5aSDimitry Andric ledf2.S \ 205*f4341a5aSDimitry Andric lesf2.S \ 206*f4341a5aSDimitry Andric ltdf2.S \ 207*f4341a5aSDimitry Andric ltsf2.S \ 208*f4341a5aSDimitry Andric nedf2.S \ 209*f4341a5aSDimitry Andric nesf2.S \ 210*f4341a5aSDimitry Andric restore_vfp_d8_d15_regs.S \ 211*f4341a5aSDimitry Andric save_vfp_d8_d15_regs.S \ 212*f4341a5aSDimitry Andric switch16.S \ 213*f4341a5aSDimitry Andric switch32.S \ 214*f4341a5aSDimitry Andric switch8.S \ 215*f4341a5aSDimitry Andric switchu8.S \ 216*f4341a5aSDimitry Andric sync_fetch_and_add_4.S \ 217*f4341a5aSDimitry Andric sync_fetch_and_add_8.S \ 218*f4341a5aSDimitry Andric sync_fetch_and_and_4.S \ 219*f4341a5aSDimitry Andric sync_fetch_and_and_8.S \ 220*f4341a5aSDimitry Andric sync_fetch_and_max_4.S \ 221*f4341a5aSDimitry Andric sync_fetch_and_max_8.S \ 222*f4341a5aSDimitry Andric sync_fetch_and_min_4.S \ 223*f4341a5aSDimitry Andric sync_fetch_and_min_8.S \ 224*f4341a5aSDimitry Andric sync_fetch_and_nand_4.S \ 225*f4341a5aSDimitry Andric sync_fetch_and_nand_8.S \ 226*f4341a5aSDimitry Andric sync_fetch_and_or_4.S \ 227*f4341a5aSDimitry Andric sync_fetch_and_or_8.S \ 228*f4341a5aSDimitry Andric sync_fetch_and_sub_4.S \ 229*f4341a5aSDimitry Andric sync_fetch_and_sub_8.S \ 230*f4341a5aSDimitry Andric sync_fetch_and_umax_4.S \ 231*f4341a5aSDimitry Andric sync_fetch_and_umax_8.S \ 232*f4341a5aSDimitry Andric sync_fetch_and_umin_4.S \ 233*f4341a5aSDimitry Andric sync_fetch_and_umin_8.S \ 234*f4341a5aSDimitry Andric sync_fetch_and_xor_4.S \ 235*f4341a5aSDimitry Andric sync_fetch_and_xor_8.S \ 236*f4341a5aSDimitry Andric sync_synchronize.S \ 237*f4341a5aSDimitry Andric unorddf2.S \ 238*f4341a5aSDimitry Andric unordsf2.S 23979ef2c64SAndrew Turner.endif 24079ef2c64SAndrew Turner 241a3cf0ef5SEd Schouten.if ${MK_INSTALLLIB} != "no" 242a3cf0ef5SEd SchoutenSYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a 243a3cf0ef5SEd Schouten.endif 244a3cf0ef5SEd Schouten.if ${MK_PROFILE} != "no" 245a3cf0ef5SEd SchoutenSYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a 246a3cf0ef5SEd Schouten.endif 247a3cf0ef5SEd Schouten 248c42c9d56SKonstantin Belousov.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ 249c42c9d56SKonstantin Belousov ${MACHINE_CPUARCH} == "powerpc" 250153344e7SKonstantin BelousovAFLAGS+=--noexecstack 251127060d2SKonstantin BelousovACFLAGS+=-Wa,--noexecstack 252153344e7SKonstantin Belousov.endif 253153344e7SKonstantin Belousov 254153344e7SKonstantin Belousov 255a3cf0ef5SEd Schouten.include <bsd.lib.mk> 256