Home | History | Annotate | Line # | Download | only in libkern
Makefile.compiler-rt revision 1.11
      1 # $NetBSD: Makefile.compiler-rt,v 1.11 2020/04/23 03:09:18 rin 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 	udivmodsi4.c
     69 .endif
     70 
     71 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
     72     ${MACHINE_ARCH} != "m68k"
     73 GENERIC_SRCS+= \
     74 	divsi3.c \
     75 	modsi3.c \
     76 	udivsi3.c \
     77 	umodsi3.c
     78 .endif
     79 
     80 .if ${MACHINE_CPU} != "aarch64"
     81 GENERIC_SRCS+= \
     82 	clzdi2.c \
     83 	ctzdi2.c \
     84 	ffsdi2.c
     85 .endif
     86 
     87 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
     88 GENERIC_SRCS+= \
     89 	ashldi3.c \
     90 	ashrdi3.c \
     91 	lshrdi3.c
     92 .endif
     93 
     94 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
     95 GENERIC_SRCS+= \
     96 	cmpdi2.c \
     97 	divdi3.c \
     98 	divmoddi4.c \
     99 	moddi3.c \
    100 	muldi3.c \
    101 	negdi2.c \
    102 	ucmpdi2.c \
    103 	udivdi3.c \
    104 	udivmoddi4.c \
    105 	umoddi3.c
    106 .endif
    107 
    108 .if ${MACHINE_CPU} == "arm"
    109 .  if !empty(MACHINE_ARCH:Mearm*)
    110 GENERIC_SRCS+= \
    111 	aeabi_idivmod.S \
    112 	aeabi_ldivmod.S \
    113 	aeabi_uidivmod.S \
    114 	aeabi_uldivmod.S \
    115 	__aeabi_idiv0.c \
    116 	__aeabi_ldiv0.c
    117 .  endif
    118 .endif
    119 
    120 .for src in ${GENERIC_SRCS}
    121 .  if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \
    122       exists(${COMPILER_RT_ARCH_DIR}/${src:R}.S)
    123 SRCS+=	${src:R}.S
    124 .  else
    125 SRCS+=	${src}
    126 COPTS.${src}+=	-Wno-missing-prototypes \
    127 		-Wno-old-style-definition \
    128 		-Wno-strict-prototypes \
    129 		-Wno-uninitialized
    130 .  endif
    131 .endfor
    132 
    133 CPPFLAGS.int_util.c+=	-DKERNEL_USE
    134 
    135 # XXX Explicit divide by zero in udivmoddi4.c -> abort().
    136 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
    137 . if ${MACHINE_CPU} != "arm"
    138 COPTS.udivmoddi4.c+=	-fnon-call-exceptions
    139 . endif
    140 .endif
    141