1# $FreeBSD: stable/10/gnu/lib/libgcc/Makefile 249702 2013-04-20 14:44:28Z ed $
| 1# $FreeBSD: stable/10/gnu/lib/libgcc/Makefile 260096 2013-12-30 20:15:46Z dim $
|
2 3GCCDIR= ${.CURDIR}/../../../contrib/gcc 4GCCLIB= ${.CURDIR}/../../../contrib/gcclibs 5 6SHLIB_NAME= libgcc_s.so.1 7SHLIBDIR?= /lib 8 9.include <bsd.own.mk> 10# 11# libgcc is linked in last and thus cannot depend on ssp symbols coming 12# from earlier libraries. Disable stack protection for this library. 13# 14MK_SSP= no 15 16.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" 17 18.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 19CFLAGS+= -DTARGET_ARM_EABI 20.endif 21 22.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR} 23 24CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ 25 -DHAVE_GTHR_DEFAULT \ 26 -I${GCCLIB}/include \ 27 -I${GCCDIR}/config -I${GCCDIR} -I. \ 28 -I${.CURDIR}/../../usr.bin/cc/cc_tools 29 30LDFLAGS+= -nodefaultlibs 31LDADD+= -lc 32 33OBJS= # added to below in various ways depending on TARGET_CPUARCH 34 35#--------------------------------------------------------------------------- 36# 37# When upgrading GCC, get the following defintions straight from Makefile.in 38# 39# Library members defined in libgcc2.c. 40LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \ 41 _cmpdi2 _ucmpdi2 \ 42 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \ 43 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \ 44 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \ 45 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \ 46 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \ 47 _divxc3 _divtc3 48.if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm" 49LIB2FUNCS+= _clear_cache 50.endif 51 52# The floating-point conversion routines that involve a single-word integer. 53.for mode in sf df xf 54LIB2FUNCS+= _fixuns${mode}si 55.endfor 56 57# Likewise double-word routines. 58.if ${TARGET_CPUARCH} != "arm" || ${MK_ARM_EABI} == "no" 59# These are implemented in an ARM specific file but will not be filtered out 60.for mode in sf df xf tf 61LIB2FUNCS+= _fix${mode}di _fixuns${mode}di 62LIB2FUNCS+= _floatdi${mode} _floatundi${mode} 63.endfor 64.endif 65 66LIB2ADD = $(LIB2FUNCS_EXTRA) 67LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) 68 69# Additional sources to handle exceptions; overridden by targets as needed. 70LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \ 71 unwind-c.c 72LIB2ADDEHSTATIC = $(LIB2ADDEH) 73LIB2ADDEHSHARED = $(LIB2ADDEH) 74 75# List of extra C and assembler files to add to static and shared libgcc2. 76# Assembler files should have names ending in `.asm'. 77LIB2FUNCS_EXTRA = 78 79# List of extra C and assembler files to add to static libgcc2. 80# Assembler files should have names ending in `.asm'. 81LIB2FUNCS_STATIC_EXTRA = 82 83# Defined in libgcc2.c, included only in the static library. 84# KAN: Excluded _sf_to_tf and _df_to_tf as TPBIT_FUNCS are not 85# built on any of our platforms. 86LIB2FUNCS_ST = _eprintf __gcc_bcmp 87 88FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ 89 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ 90 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ 91 _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf 92 93DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ 94 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ 95 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \ 96 _df_to_sf _thenan_df _df_to_usi _usi_to_df 97 98TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \ 99 _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \ 100 _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \ 101 _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf 102 103# These might cause a divide overflow trap and so are compiled with 104# unwinder info. 105LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 106 107#----------------------------------------------------------------------- 108# 109# Platform specific bits. 110# When upgrading GCC, get the following definitions from config/<cpu>/t-* 111# 112.if ${TARGET_CPUARCH} == "arm" 113# from config/arm/t-strongarm-elf 114CFLAGS+= -Dinhibit_libc -fno-inline
| 2 3GCCDIR= ${.CURDIR}/../../../contrib/gcc 4GCCLIB= ${.CURDIR}/../../../contrib/gcclibs 5 6SHLIB_NAME= libgcc_s.so.1 7SHLIBDIR?= /lib 8 9.include <bsd.own.mk> 10# 11# libgcc is linked in last and thus cannot depend on ssp symbols coming 12# from earlier libraries. Disable stack protection for this library. 13# 14MK_SSP= no 15 16.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" 17 18.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 19CFLAGS+= -DTARGET_ARM_EABI 20.endif 21 22.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR} 23 24CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \ 25 -DHAVE_GTHR_DEFAULT \ 26 -I${GCCLIB}/include \ 27 -I${GCCDIR}/config -I${GCCDIR} -I. \ 28 -I${.CURDIR}/../../usr.bin/cc/cc_tools 29 30LDFLAGS+= -nodefaultlibs 31LDADD+= -lc 32 33OBJS= # added to below in various ways depending on TARGET_CPUARCH 34 35#--------------------------------------------------------------------------- 36# 37# When upgrading GCC, get the following defintions straight from Makefile.in 38# 39# Library members defined in libgcc2.c. 40LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \ 41 _cmpdi2 _ucmpdi2 \ 42 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \ 43 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \ 44 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \ 45 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \ 46 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \ 47 _divxc3 _divtc3 48.if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm" 49LIB2FUNCS+= _clear_cache 50.endif 51 52# The floating-point conversion routines that involve a single-word integer. 53.for mode in sf df xf 54LIB2FUNCS+= _fixuns${mode}si 55.endfor 56 57# Likewise double-word routines. 58.if ${TARGET_CPUARCH} != "arm" || ${MK_ARM_EABI} == "no" 59# These are implemented in an ARM specific file but will not be filtered out 60.for mode in sf df xf tf 61LIB2FUNCS+= _fix${mode}di _fixuns${mode}di 62LIB2FUNCS+= _floatdi${mode} _floatundi${mode} 63.endfor 64.endif 65 66LIB2ADD = $(LIB2FUNCS_EXTRA) 67LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA) 68 69# Additional sources to handle exceptions; overridden by targets as needed. 70LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \ 71 unwind-c.c 72LIB2ADDEHSTATIC = $(LIB2ADDEH) 73LIB2ADDEHSHARED = $(LIB2ADDEH) 74 75# List of extra C and assembler files to add to static and shared libgcc2. 76# Assembler files should have names ending in `.asm'. 77LIB2FUNCS_EXTRA = 78 79# List of extra C and assembler files to add to static libgcc2. 80# Assembler files should have names ending in `.asm'. 81LIB2FUNCS_STATIC_EXTRA = 82 83# Defined in libgcc2.c, included only in the static library. 84# KAN: Excluded _sf_to_tf and _df_to_tf as TPBIT_FUNCS are not 85# built on any of our platforms. 86LIB2FUNCS_ST = _eprintf __gcc_bcmp 87 88FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ 89 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ 90 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ 91 _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf 92 93DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ 94 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ 95 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \ 96 _df_to_sf _thenan_df _df_to_usi _usi_to_df 97 98TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \ 99 _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \ 100 _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \ 101 _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf 102 103# These might cause a divide overflow trap and so are compiled with 104# unwinder info. 105LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 106 107#----------------------------------------------------------------------- 108# 109# Platform specific bits. 110# When upgrading GCC, get the following definitions from config/<cpu>/t-* 111# 112.if ${TARGET_CPUARCH} == "arm" 113# from config/arm/t-strongarm-elf 114CFLAGS+= -Dinhibit_libc -fno-inline
|
115.if ${COMPILER_TYPE} == "clang" 116CFLAGS+= -fheinous-gnu-extensions 117.endif
| 115CFLAGS.clang+= -fheinous-gnu-extensions
|
118 119LIB1ASMSRC = lib1funcs.asm 120LIB1ASMFUNCS = _dvmd_tls _bb_init_func 121.if ${MK_ARM_EABI} != "no" 122LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c 123# Some compilers generate __aeabi_ functions libgcc_s is missing 124DPADD+= ${LIBGCC} 125LDADD+= -lgcc 126.else 127LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c 128.endif 129.endif 130 131.if ${TARGET_CPUARCH} == mips 132LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c 133# ABIs other than o32 need this 134.if ${TARGET_ARCH} != "mips" && ${TARGET_ARCH} != "mipsel" 135LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c 136LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c 137LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c 138LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c 139.endif 140.endif 141 142.if ${TARGET_CPUARCH} == "ia64" 143# from config/ia64/t-ia64 144LIB1ASMSRC = lib1funcs.asm 145LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \ 146 __divdi3 __moddi3 __udivdi3 __umoddi3 \ 147 __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ 148 __nonlocal_goto __restore_stack_nonlocal __trampoline \ 149 _fixtfdi _fixunstfdi _floatditf 150LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c 151.endif 152 153.if ${TARGET_ARCH} == "powerpc" 154# from config/rs6000/t-ppccomm 155LIB2FUNCS_EXTRA = tramp.asm 156LIB2FUNCS_STATIC_EXTRA = eabi.asm 157.endif 158 159.if ${TARGET_ARCH} == "powerpc64" 160# from config/rs6000/t-ppccomm 161LIB2FUNCS_EXTRA = tramp.asm 162.endif 163 164.if ${TARGET_CPUARCH} == "sparc64" 165# from config/sparc/t-elf 166LIB1ASMSRC = lb1spc.asm 167LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 168.endif 169 170#----------------------------------------------------------------------- 171 172# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are 173# defined as optimized assembly code in LIB1ASMFUNCS. 174.if defined(LIB1ASMFUNCS) 175.for sym in ${LIB1ASMFUNCS} 176LIB2FUNCS:= ${LIB2FUNCS:S/${sym}//g} 177LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g} 178.endfor 179.endif 180 181COMMONHDRS= tm.h tconfig.h options.h unwind.h gthr-default.h 182 183#----------------------------------------------------------------------- 184# 185# Helpful shortcuts for compiler invocations. 186# 187HIDE = -fvisibility=hidden -DHIDE_EXPORTS 188CC_T = ${CC} -c ${CFLAGS} ${HIDE} -fPIC 189CC_P = ${CC} -c ${CFLAGS} ${HIDE} -p -fPIC 190CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED 191 192#----------------------------------------------------------------------- 193# 194# Functions from libgcc2.c 195# 196STD_CFLAGS = 197DIV_CFLAGS = -fexceptions -fnon-call-exceptions 198 199STD_FUNCS = ${LIB2FUNCS} 200DIV_FUNCS = ${LIB2_DIVMOD_FUNCS} 201 202STD_CFILE = libgcc2.c 203DIV_CFILE = libgcc2.c 204 205OBJ_GRPS = STD DIV 206 207#----------------------------------------------------------------------- 208# 209# Floating point emulation functions 210# 211.if ${TARGET_CPUARCH} == "armNOT_YET" || \ 212 ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64" 213 214FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT 215DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES 216 217FPBIT_CFILE = config/fp-bit.c 218DPBIT_CFILE = config/fp-bit.c 219 220OBJ_GRPS += FPBIT DPBIT 221.endif 222 223#----------------------------------------------------------------------- 224# 225# Generic build rules for object groups defined above 226# 227.for T in ${OBJ_GRPS} 228${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/} 229${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/} 230${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/} 231OBJS += ${${T}_FUNCS:S/$/.o/} 232 233${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS} 234 ${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 235${${T}_OBJS_P}: ${${T}_CFILE} ${COMMONHDRS} 236 ${CC_P} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 237${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHDRS} 238 ${CC_S} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 239.endfor 240 241#----------------------------------------------------------------------- 242# 243# Extra objects coming from separate files 244# 245.if !empty(LIB2ADD) 246OBJS += ${LIB2ADD:R:S/$/.o/} 247SOBJS += ${LIB2ADD:R:S/$/.So/} 248POBJS += ${LIB2ADD:R:S/$/.po/} 249.endif 250 251#----------------------------------------------------------------------- 252# 253# Objects that should be in static library only. 254# 255SYMS_ST = ${LIB2FUNCS_ST} ${LIB2ADD_ST} 256STAT_OBJS_T = ${SYMS_ST:S/$/.o/} 257STAT_OBJS_P = ${SYMS_ST:S/$/.po/} 258STATICOBJS = ${SYMS_ST:S/$/.o/} 259 260${STAT_OBJS_T}: ${STD_CFILE} ${COMMONHDRS} 261 ${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 262${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDRS} 263 ${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 264 265#----------------------------------------------------------------------- 266# 267# Assembler files. 268# 269.if defined(LIB1ASMSRC) 270ASM_T = ${LIB1ASMFUNCS:S/$/.o/} 271ASM_P = ${LIB1ASMFUNCS:S/$/.po/} 272ASM_S = ${LIB1ASMFUNCS:S/$/.So/} 273ASM_V = ${LIB1ASMFUNCS:S/$/.vis/} 274OBJS += ${LIB1ASMFUNCS:S/$/.o/} 275 276${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis 277 ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ 278 -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis} 279${ASM_P}: ${LIB1ASMSRC} ${.PREFIX}.vis 280 ${CC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \ 281 -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis} 282${ASM_S}: ${LIB1ASMSRC} 283 ${CC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \ 284 -o ${.TARGET} ${.ALLSRC:N*.h} 285${ASM_V}: ${LIB1ASMSRC} 286 ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ 287 -o ${.PREFIX}.vo ${.ALLSRC:N*.h} 288 ( ${NM} -pg ${.PREFIX}.vo | \ 289 awk 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden ", $$3 }'\ 290 ) > ${.TARGET} 291 292CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo/} 293.endif 294 295#----------------------------------------------------------------------- 296# 297# Exception handling / unwinding support. 298# 299EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/} 300EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/} 301EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} 302EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN 303SOBJS += ${EH_OBJS_S} 304 305.for _src in ${LIB2ADDEHSTATIC} 306${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS} 307 ${CC_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 308${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS} 309 ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 310.endfor 311.for _src in ${LIB2ADDEHSHARED} 312${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} 313 ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 314.endfor 315 316 317#----------------------------------------------------------------------- 318# 319# Generated headers 320# 321${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile 322 ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} 323 324CLEANFILES += ${COMMONHDRS} 325CLEANFILES += cs-*.h option* 326 327#----------------------------------------------------------------------- 328# 329# Build symbol version map 330# 331SHLIB_MKMAP = ${GCCDIR}/mkmap-symver.awk 332SHLIB_MKMAP_OPTS = 333SHLIB_MAPFILES = ${GCCDIR}/libgcc-std.ver 334.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 335SHLIB_MAPFILES += ${GCCDIR}/config/arm/libgcc-bpabi.ver 336.endif 337VERSION_MAP = libgcc.map 338 339libgcc.map: ${SHLIB_MKMAP} ${SHLIB_MAPFILES} ${SOBJS} ${OBJS:R:S/$/.So/} 340 ( ${NM} -pg ${SOBJS};echo %% ; \ 341 cat ${SHLIB_MAPFILES} \ 342 | sed -e '/^[ ]*#/d' \ 343 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \ 344 | ${CC} ${CFLAGS} -E -xassembler-with-cpp -; \ 345 ) | awk -f ${SHLIB_MKMAP} ${SHLIB_MKMAP_OPTS} > ${.TARGET} 346 347CLEANFILES += libgcc.map 348 349#----------------------------------------------------------------------- 350# 351# Build additional static libgcc_eh[_p].a libraries. 352# 353libgcc_eh.a: ${EH_OBJS_T} 354 @${ECHO} building static gcc_eh library 355 @rm -f ${.TARGET} 356 @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q` 357 ${RANLIB} ${.TARGET} 358 359all: libgcc_eh.a 360 361.if ${MK_PROFILE} != "no" 362libgcc_eh_p.a: ${EH_OBJS_P} 363 @${ECHO} building profiled gcc_eh library 364 @rm -f ${.TARGET} 365 @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q` 366 ${RANLIB} ${.TARGET} 367all: libgcc_eh_p.a 368.endif 369 370_libinstall: _lib-eh-install 371 372_lib-eh-install: 373.if ${MK_INSTALLLIB} != "no" 374 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 375 ${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR} 376.endif 377.if ${MK_PROFILE} != "no" 378 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 379 ${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR} 380.endif 381 382CLEANFILES+= libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P} 383 384.include <bsd.lib.mk> 385 386.SUFFIXES: .vis .vo
| 116 117LIB1ASMSRC = lib1funcs.asm 118LIB1ASMFUNCS = _dvmd_tls _bb_init_func 119.if ${MK_ARM_EABI} != "no" 120LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c 121# Some compilers generate __aeabi_ functions libgcc_s is missing 122DPADD+= ${LIBGCC} 123LDADD+= -lgcc 124.else 125LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c 126.endif 127.endif 128 129.if ${TARGET_CPUARCH} == mips 130LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c 131# ABIs other than o32 need this 132.if ${TARGET_ARCH} != "mips" && ${TARGET_ARCH} != "mipsel" 133LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c 134LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c 135LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c 136LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c 137.endif 138.endif 139 140.if ${TARGET_CPUARCH} == "ia64" 141# from config/ia64/t-ia64 142LIB1ASMSRC = lib1funcs.asm 143LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \ 144 __divdi3 __moddi3 __udivdi3 __umoddi3 \ 145 __divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \ 146 __nonlocal_goto __restore_stack_nonlocal __trampoline \ 147 _fixtfdi _fixunstfdi _floatditf 148LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c 149.endif 150 151.if ${TARGET_ARCH} == "powerpc" 152# from config/rs6000/t-ppccomm 153LIB2FUNCS_EXTRA = tramp.asm 154LIB2FUNCS_STATIC_EXTRA = eabi.asm 155.endif 156 157.if ${TARGET_ARCH} == "powerpc64" 158# from config/rs6000/t-ppccomm 159LIB2FUNCS_EXTRA = tramp.asm 160.endif 161 162.if ${TARGET_CPUARCH} == "sparc64" 163# from config/sparc/t-elf 164LIB1ASMSRC = lb1spc.asm 165LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 166.endif 167 168#----------------------------------------------------------------------- 169 170# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are 171# defined as optimized assembly code in LIB1ASMFUNCS. 172.if defined(LIB1ASMFUNCS) 173.for sym in ${LIB1ASMFUNCS} 174LIB2FUNCS:= ${LIB2FUNCS:S/${sym}//g} 175LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g} 176.endfor 177.endif 178 179COMMONHDRS= tm.h tconfig.h options.h unwind.h gthr-default.h 180 181#----------------------------------------------------------------------- 182# 183# Helpful shortcuts for compiler invocations. 184# 185HIDE = -fvisibility=hidden -DHIDE_EXPORTS 186CC_T = ${CC} -c ${CFLAGS} ${HIDE} -fPIC 187CC_P = ${CC} -c ${CFLAGS} ${HIDE} -p -fPIC 188CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED 189 190#----------------------------------------------------------------------- 191# 192# Functions from libgcc2.c 193# 194STD_CFLAGS = 195DIV_CFLAGS = -fexceptions -fnon-call-exceptions 196 197STD_FUNCS = ${LIB2FUNCS} 198DIV_FUNCS = ${LIB2_DIVMOD_FUNCS} 199 200STD_CFILE = libgcc2.c 201DIV_CFILE = libgcc2.c 202 203OBJ_GRPS = STD DIV 204 205#----------------------------------------------------------------------- 206# 207# Floating point emulation functions 208# 209.if ${TARGET_CPUARCH} == "armNOT_YET" || \ 210 ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64" 211 212FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT 213DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES 214 215FPBIT_CFILE = config/fp-bit.c 216DPBIT_CFILE = config/fp-bit.c 217 218OBJ_GRPS += FPBIT DPBIT 219.endif 220 221#----------------------------------------------------------------------- 222# 223# Generic build rules for object groups defined above 224# 225.for T in ${OBJ_GRPS} 226${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/} 227${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/} 228${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/} 229OBJS += ${${T}_FUNCS:S/$/.o/} 230 231${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS} 232 ${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 233${${T}_OBJS_P}: ${${T}_CFILE} ${COMMONHDRS} 234 ${CC_P} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 235${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHDRS} 236 ${CC_S} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 237.endfor 238 239#----------------------------------------------------------------------- 240# 241# Extra objects coming from separate files 242# 243.if !empty(LIB2ADD) 244OBJS += ${LIB2ADD:R:S/$/.o/} 245SOBJS += ${LIB2ADD:R:S/$/.So/} 246POBJS += ${LIB2ADD:R:S/$/.po/} 247.endif 248 249#----------------------------------------------------------------------- 250# 251# Objects that should be in static library only. 252# 253SYMS_ST = ${LIB2FUNCS_ST} ${LIB2ADD_ST} 254STAT_OBJS_T = ${SYMS_ST:S/$/.o/} 255STAT_OBJS_P = ${SYMS_ST:S/$/.po/} 256STATICOBJS = ${SYMS_ST:S/$/.o/} 257 258${STAT_OBJS_T}: ${STD_CFILE} ${COMMONHDRS} 259 ${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 260${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDRS} 261 ${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} 262 263#----------------------------------------------------------------------- 264# 265# Assembler files. 266# 267.if defined(LIB1ASMSRC) 268ASM_T = ${LIB1ASMFUNCS:S/$/.o/} 269ASM_P = ${LIB1ASMFUNCS:S/$/.po/} 270ASM_S = ${LIB1ASMFUNCS:S/$/.So/} 271ASM_V = ${LIB1ASMFUNCS:S/$/.vis/} 272OBJS += ${LIB1ASMFUNCS:S/$/.o/} 273 274${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis 275 ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ 276 -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis} 277${ASM_P}: ${LIB1ASMSRC} ${.PREFIX}.vis 278 ${CC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \ 279 -o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis} 280${ASM_S}: ${LIB1ASMSRC} 281 ${CC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \ 282 -o ${.TARGET} ${.ALLSRC:N*.h} 283${ASM_V}: ${LIB1ASMSRC} 284 ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ 285 -o ${.PREFIX}.vo ${.ALLSRC:N*.h} 286 ( ${NM} -pg ${.PREFIX}.vo | \ 287 awk 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden ", $$3 }'\ 288 ) > ${.TARGET} 289 290CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo/} 291.endif 292 293#----------------------------------------------------------------------- 294# 295# Exception handling / unwinding support. 296# 297EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/} 298EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/} 299EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} 300EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN 301SOBJS += ${EH_OBJS_S} 302 303.for _src in ${LIB2ADDEHSTATIC} 304${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS} 305 ${CC_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 306${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS} 307 ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 308.endfor 309.for _src in ${LIB2ADDEHSHARED} 310${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} 311 ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} 312.endfor 313 314 315#----------------------------------------------------------------------- 316# 317# Generated headers 318# 319${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile 320 ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET} 321 322CLEANFILES += ${COMMONHDRS} 323CLEANFILES += cs-*.h option* 324 325#----------------------------------------------------------------------- 326# 327# Build symbol version map 328# 329SHLIB_MKMAP = ${GCCDIR}/mkmap-symver.awk 330SHLIB_MKMAP_OPTS = 331SHLIB_MAPFILES = ${GCCDIR}/libgcc-std.ver 332.if ${TARGET_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no" 333SHLIB_MAPFILES += ${GCCDIR}/config/arm/libgcc-bpabi.ver 334.endif 335VERSION_MAP = libgcc.map 336 337libgcc.map: ${SHLIB_MKMAP} ${SHLIB_MAPFILES} ${SOBJS} ${OBJS:R:S/$/.So/} 338 ( ${NM} -pg ${SOBJS};echo %% ; \ 339 cat ${SHLIB_MAPFILES} \ 340 | sed -e '/^[ ]*#/d' \ 341 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \ 342 | ${CC} ${CFLAGS} -E -xassembler-with-cpp -; \ 343 ) | awk -f ${SHLIB_MKMAP} ${SHLIB_MKMAP_OPTS} > ${.TARGET} 344 345CLEANFILES += libgcc.map 346 347#----------------------------------------------------------------------- 348# 349# Build additional static libgcc_eh[_p].a libraries. 350# 351libgcc_eh.a: ${EH_OBJS_T} 352 @${ECHO} building static gcc_eh library 353 @rm -f ${.TARGET} 354 @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q` 355 ${RANLIB} ${.TARGET} 356 357all: libgcc_eh.a 358 359.if ${MK_PROFILE} != "no" 360libgcc_eh_p.a: ${EH_OBJS_P} 361 @${ECHO} building profiled gcc_eh library 362 @rm -f ${.TARGET} 363 @${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q` 364 ${RANLIB} ${.TARGET} 365all: libgcc_eh_p.a 366.endif 367 368_libinstall: _lib-eh-install 369 370_lib-eh-install: 371.if ${MK_INSTALLLIB} != "no" 372 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 373 ${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR} 374.endif 375.if ${MK_PROFILE} != "no" 376 ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 377 ${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR} 378.endif 379 380CLEANFILES+= libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P} 381 382.include <bsd.lib.mk> 383 384.SUFFIXES: .vis .vo
|