1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
2010-05-12 19:59:32 +00:00
|
|
|
|
2016-02-05 21:01:08 +00:00
|
|
|
PACKAGE= clibs
|
2002-05-07 00:55:51 +00:00
|
|
|
GCCDIR= ${.CURDIR}/../../../contrib/gcc
|
2007-05-19 04:25:59 +00:00
|
|
|
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
|
2016-04-18 18:13:58 +00:00
|
|
|
CCDIR= ${.CURDIR}/../../usr.bin/cc
|
2016-01-09 00:42:07 +00:00
|
|
|
COMPILERRTDIR= ${.CURDIR}/../../../contrib/compiler-rt
|
|
|
|
UNWINDINCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/include
|
|
|
|
UNWINDSRCDIR= ${.CURDIR}/../../../contrib/llvm/projects/libunwind/src
|
1999-03-31 06:40:40 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
SHLIB_NAME= libgcc_s.so.1
|
2015-06-15 19:28:07 +00:00
|
|
|
SHLIBDIR?= /lib
|
2002-05-07 00:55:51 +00:00
|
|
|
|
2014-05-06 04:22:01 +00:00
|
|
|
.include <src.opts.mk>
|
2009-07-14 21:19:13 +00:00
|
|
|
#
|
|
|
|
# libgcc is linked in last and thus cannot depend on ssp symbols coming
|
|
|
|
# from earlier libraries. Disable stack protection for this library.
|
|
|
|
#
|
|
|
|
MK_SSP= no
|
|
|
|
|
2016-04-18 18:13:58 +00:00
|
|
|
.include "${CCDIR}/Makefile.tgt"
|
|
|
|
.include "${CCDIR}/cc_tools/Makefile.hdrs"
|
2003-06-13 22:07:39 +00:00
|
|
|
|
2014-10-01 08:26:51 +00:00
|
|
|
.if ${TARGET_CPUARCH} == "arm"
|
2013-01-17 05:56:28 +00:00
|
|
|
CFLAGS+= -DTARGET_ARM_EABI
|
|
|
|
.endif
|
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}/config ${GCCDIR}
|
1996-09-19 15:53:53 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
|
2007-05-19 04:25:59 +00:00
|
|
|
-DHAVE_GTHR_DEFAULT \
|
|
|
|
-I${GCCLIB}/include \
|
|
|
|
-I${GCCDIR}/config -I${GCCDIR} -I. \
|
2016-04-18 18:13:58 +00:00
|
|
|
-I${CCDIR}/cc_tools
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
LDFLAGS+= -nodefaultlibs
|
2014-11-25 21:18:18 +00:00
|
|
|
LIBADD+= c
|
2002-05-07 00:55:51 +00:00
|
|
|
|
2016-02-24 22:27:18 +00:00
|
|
|
SOBJS= # added to below in various ways depending on TARGET_CPUARCH
|
2002-05-17 04:18:33 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
#---------------------------------------------------------------------------
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
|
|
|
# Library members defined in libgcc2.c.
|
2014-01-19 00:38:18 +00:00
|
|
|
# When upgrading GCC, obtain the following list from mklibgcc.in
|
|
|
|
#
|
2007-05-19 04:25:59 +00:00
|
|
|
LIB2FUNCS= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \
|
2012-12-18 07:26:55 +00:00
|
|
|
_cmpdi2 _ucmpdi2 \
|
2004-07-28 05:27:21 +00:00
|
|
|
_enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \
|
|
|
|
_addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
|
|
|
|
_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \
|
2007-05-19 04:25:59 +00:00
|
|
|
_popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \
|
|
|
|
_powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 \
|
2014-01-19 00:38:18 +00:00
|
|
|
_divxc3 _divtc3 _bswapsi2 _bswapdi2
|
2012-12-18 07:26:55 +00:00
|
|
|
.if ${COMPILER_TYPE} != "clang" || ${TARGET_CPUARCH} != "arm"
|
|
|
|
LIB2FUNCS+= _clear_cache
|
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
# The floating-point conversion routines that involve a single-word integer.
|
|
|
|
.for mode in sf df xf
|
|
|
|
LIB2FUNCS+= _fixuns${mode}si
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
# Likewise double-word routines.
|
2016-01-26 14:45:21 +00:00
|
|
|
.if ${TARGET_CPUARCH} != "aarch64" && ${TARGET_CPUARCH} != "arm" && \
|
|
|
|
${TARGET_CPUARCH} != "riscv64"
|
|
|
|
# These are implemented in an ARM specific file but will not be filtered out.
|
|
|
|
# RISCVTODO: can't compile
|
2007-05-19 04:25:59 +00:00
|
|
|
.for mode in sf df xf tf
|
|
|
|
LIB2FUNCS+= _fix${mode}di _fixuns${mode}di
|
|
|
|
LIB2FUNCS+= _floatdi${mode} _floatundi${mode}
|
|
|
|
.endfor
|
2013-01-17 05:56:28 +00:00
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
LIB2ADD = $(LIB2FUNCS_EXTRA)
|
|
|
|
LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
|
|
|
|
|
|
|
|
# Additional sources to handle exceptions; overridden by targets as needed.
|
2016-01-09 00:42:07 +00:00
|
|
|
.if ${MK_LLVM_LIBUNWIND} != "no"
|
|
|
|
|
|
|
|
.PATH: ${COMPILERRTDIR}/lib/builtins
|
|
|
|
.PATH: ${UNWINDSRCDIR}
|
|
|
|
LIB2ADDEH = gcc_personality_v0.c \
|
|
|
|
int_util.c \
|
|
|
|
Unwind-EHABI.cpp \
|
|
|
|
Unwind-sjlj.c \
|
|
|
|
UnwindLevel1-gcc-ext.c \
|
|
|
|
UnwindLevel1.c \
|
|
|
|
UnwindRegistersRestore.S \
|
2016-01-22 19:03:39 +00:00
|
|
|
UnwindRegistersSave.S \
|
|
|
|
libunwind.cpp
|
2016-01-09 00:42:07 +00:00
|
|
|
|
2016-07-08 21:17:24 +00:00
|
|
|
CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY
|
2016-01-09 00:42:07 +00:00
|
|
|
.if empty(CXXFLAGS:M-std=*)
|
|
|
|
CXXFLAGS+= -std=c++11
|
|
|
|
.endif
|
|
|
|
CXXFLAGS+= -fno-rtti
|
2016-01-19 17:40:29 +00:00
|
|
|
STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
|
2016-01-09 00:42:07 +00:00
|
|
|
|
|
|
|
.else # MK_LLVM_LIBUNWIND
|
|
|
|
|
|
|
|
.if ${TARGET_CPUARCH} == "arm"
|
2016-07-27 16:34:19 +00:00
|
|
|
LIB2ADDEH = unwind-arm.c libunwind-arm.S pr-support.c unwind-c.c
|
2016-01-09 00:42:07 +00:00
|
|
|
.else
|
2007-05-19 04:25:59 +00:00
|
|
|
LIB2ADDEH = unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c gthr-gnat.c \
|
|
|
|
unwind-c.c
|
2016-01-09 00:42:07 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif # MK_LLVM_LIBUNWIND
|
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
LIB2ADDEHSTATIC = $(LIB2ADDEH)
|
|
|
|
LIB2ADDEHSHARED = $(LIB2ADDEH)
|
|
|
|
|
|
|
|
# List of extra C and assembler files to add to static and shared libgcc2.
|
|
|
|
# Assembler files should have names ending in `.asm'.
|
|
|
|
LIB2FUNCS_EXTRA =
|
|
|
|
|
|
|
|
# List of extra C and assembler files to add to static libgcc2.
|
|
|
|
# Assembler files should have names ending in `.asm'.
|
|
|
|
LIB2FUNCS_STATIC_EXTRA =
|
2001-12-18 03:05:22 +00:00
|
|
|
|
|
|
|
# Defined in libgcc2.c, included only in the static library.
|
2007-05-19 04:25:59 +00:00
|
|
|
# KAN: Excluded _sf_to_tf and _df_to_tf as TPBIT_FUNCS are not
|
|
|
|
# built on any of our platforms.
|
2004-07-28 05:27:21 +00:00
|
|
|
LIB2FUNCS_ST = _eprintf __gcc_bcmp
|
1998-03-23 12:23:13 +00:00
|
|
|
|
2001-12-18 03:05:22 +00:00
|
|
|
FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
|
|
|
|
_fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
|
|
|
|
_lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
|
2007-05-19 04:25:59 +00:00
|
|
|
_sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
|
2001-12-18 03:05:22 +00:00
|
|
|
|
|
|
|
DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
|
|
|
|
_fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
|
|
|
|
_lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
|
2007-05-19 04:25:59 +00:00
|
|
|
_df_to_sf _thenan_df _df_to_usi _usi_to_df
|
2004-07-28 05:27:21 +00:00
|
|
|
|
|
|
|
TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
|
|
|
|
_fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
|
|
|
|
_lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
|
|
|
|
_tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
|
2001-12-18 03:05:22 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
# These might cause a divide overflow trap and so are compiled with
|
|
|
|
# unwinder info.
|
|
|
|
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
2002-05-07 00:55:51 +00:00
|
|
|
# Platform specific bits.
|
2007-05-19 04:25:59 +00:00
|
|
|
# When upgrading GCC, get the following definitions from config/<cpu>/t-*
|
2001-12-18 03:05:22 +00:00
|
|
|
#
|
2010-11-10 06:39:49 +00:00
|
|
|
.if ${TARGET_CPUARCH} == "arm"
|
2002-05-07 00:55:51 +00:00
|
|
|
# from config/arm/t-strongarm-elf
|
2004-07-28 05:27:21 +00:00
|
|
|
CFLAGS+= -Dinhibit_libc -fno-inline
|
2013-12-22 17:51:33 +00:00
|
|
|
CFLAGS.clang+= -fheinous-gnu-extensions
|
2012-12-18 07:26:55 +00:00
|
|
|
|
2004-07-28 05:27:21 +00:00
|
|
|
LIB1ASMSRC = lib1funcs.asm
|
2007-05-19 04:25:59 +00:00
|
|
|
LIB1ASMFUNCS = _dvmd_tls _bb_init_func
|
2013-03-17 01:03:41 +00:00
|
|
|
# Some compilers generate __aeabi_ functions libgcc_s is missing
|
2014-11-25 21:18:18 +00:00
|
|
|
LIBADD+= compiler_rt
|
1999-04-04 20:41:50 +00:00
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2011-01-07 20:26:33 +00:00
|
|
|
.if ${TARGET_CPUARCH} == mips
|
2010-01-08 23:11:23 +00:00
|
|
|
LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
|
2011-01-27 14:16:12 +00:00
|
|
|
# ABIs other than o32 need this
|
2012-03-29 02:54:35 +00:00
|
|
|
.if ${TARGET_ARCH} != "mips" && ${TARGET_ARCH} != "mipsel"
|
Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain.
o) Add TARGET_ABI to the MIPS toolchain build process. This sets the default
ABI to one of o32, n32 or n64. If it is not set, o32 is assumed as that is
the current default.
o) Set the default GCC cpu type to any specified TARGET_CPUTYPE. This is
necessary to have a working "cc" if e.g. mips64 is specified, as binutils
will refuse to link objects using different ISAs in some cases.
o) Add support for n32 and n64 ABIs to binutils and GCC.
o) Add additional required libgcc2 stubs for n32 and n64.
o) Add support for the "mips64r2" architecture to GCC. Add the "octeon"
o) When static linking, wrap default libraries in --start-group and
--end-group. This is required for static linking to work on n64 with the
interdependencies between libraries there. This is what other OSes that
support n64 seem to do, as well.
o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the
former being what libgcc, etc., check and the latter seemingly being a
misspelling of a hand merge from a Linux spec.
o) When no TARGET_CPUTYPE is specified at build time, make GCC take the default
ISA from the ABI. Our old defaults were too liberal and assumed that 64-bit
ABIs should default to the MIPS64 ISA and that 32-bit ABIs should default to
the MIPS32 ISA, when we are supporting or will support some systems based on
earlier 32-bit and 64-bit ISAs, most notably MIPS-III.
o) Merge a new opcode file (and support code) from a later version of binutils
and add flags and code necessary to support Octeon-specific instructions.
This should also make merging opcodes for other modern architectures easier.
Reviewed by: imp
2010-06-02 11:06:03 +00:00
|
|
|
LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
|
|
|
|
LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
|
|
|
|
LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c
|
|
|
|
LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c
|
|
|
|
.endif
|
2010-01-08 23:11:23 +00:00
|
|
|
.endif
|
|
|
|
|
2010-11-14 01:50:40 +00:00
|
|
|
.if ${TARGET_ARCH} == "powerpc"
|
2002-05-07 00:55:51 +00:00
|
|
|
# from config/rs6000/t-ppccomm
|
2008-02-24 19:22:53 +00:00
|
|
|
LIB2FUNCS_EXTRA = tramp.asm
|
2002-05-17 03:08:15 +00:00
|
|
|
LIB2FUNCS_STATIC_EXTRA = eabi.asm
|
2002-05-07 00:55:51 +00:00
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2010-11-14 01:50:40 +00:00
|
|
|
.if ${TARGET_ARCH} == "powerpc64"
|
2010-07-10 02:29:22 +00:00
|
|
|
# from config/rs6000/t-ppccomm
|
|
|
|
LIB2FUNCS_EXTRA = tramp.asm
|
|
|
|
.endif
|
|
|
|
|
2010-11-10 06:39:49 +00:00
|
|
|
.if ${TARGET_CPUARCH} == "sparc64"
|
2002-05-07 00:55:51 +00:00
|
|
|
# from config/sparc/t-elf
|
2007-05-19 04:25:59 +00:00
|
|
|
LIB1ASMSRC = lb1spc.asm
|
2002-05-07 00:55:51 +00:00
|
|
|
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
|
|
|
.endif
|
1994-08-02 20:15:59 +00:00
|
|
|
|
2002-05-07 00:55:51 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
|
2002-05-12 12:44:04 +00:00
|
|
|
# Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
|
|
|
|
# defined as optimized assembly code in LIB1ASMFUNCS.
|
|
|
|
.if defined(LIB1ASMFUNCS)
|
|
|
|
.for sym in ${LIB1ASMFUNCS}
|
2004-08-04 03:13:51 +00:00
|
|
|
LIB2FUNCS:= ${LIB2FUNCS:S/${sym}//g}
|
2002-05-12 12:44:04 +00:00
|
|
|
LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
2016-01-09 00:42:07 +00:00
|
|
|
COMMONHDRS= tm.h tconfig.h options.h gthr-default.h
|
2016-01-22 02:28:17 +00:00
|
|
|
.if ${MK_LLVM_LIBUNWIND} != "no"
|
|
|
|
# unwind.h is a generated file when MK_LLVM_LIBUNWIND == "no", and a stale
|
|
|
|
# copy may be left behind in OBJDIR when switching, so remove it explicitly.
|
|
|
|
beforebuild:
|
|
|
|
@rm -f ${.OBJDIR}/unwind.h
|
|
|
|
.else
|
2016-01-09 00:42:07 +00:00
|
|
|
COMMONHDRS+= unwind.h
|
|
|
|
.endif
|
2002-05-12 14:05:58 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Helpful shortcuts for compiler invocations.
|
|
|
|
#
|
|
|
|
HIDE = -fvisibility=hidden -DHIDE_EXPORTS
|
|
|
|
CC_T = ${CC} -c ${CFLAGS} ${HIDE} -fPIC
|
|
|
|
CC_P = ${CC} -c ${CFLAGS} ${HIDE} -p -fPIC
|
2016-01-27 20:20:35 +00:00
|
|
|
CC_S = ${CC} -c ${CFLAGS} ${SHARED_CFLAGS} ${PICFLAG} -DSHARED
|
2002-05-07 00:55:51 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Functions from libgcc2.c
|
|
|
|
#
|
|
|
|
STD_CFLAGS =
|
|
|
|
DIV_CFLAGS = -fexceptions -fnon-call-exceptions
|
2002-05-07 00:55:51 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
STD_FUNCS = ${LIB2FUNCS}
|
|
|
|
DIV_FUNCS = ${LIB2_DIVMOD_FUNCS}
|
|
|
|
|
|
|
|
STD_CFILE = libgcc2.c
|
|
|
|
DIV_CFILE = libgcc2.c
|
|
|
|
|
|
|
|
OBJ_GRPS = STD DIV
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Floating point emulation functions
|
|
|
|
#
|
2010-11-10 06:39:49 +00:00
|
|
|
.if ${TARGET_CPUARCH} == "armNOT_YET" || \
|
|
|
|
${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64"
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT
|
|
|
|
DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES
|
1999-04-04 16:36:35 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
FPBIT_CFILE = config/fp-bit.c
|
|
|
|
DPBIT_CFILE = config/fp-bit.c
|
|
|
|
|
|
|
|
OBJ_GRPS += FPBIT DPBIT
|
1994-08-02 20:15:59 +00:00
|
|
|
.endif
|
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Generic build rules for object groups defined above
|
|
|
|
#
|
|
|
|
.for T in ${OBJ_GRPS}
|
|
|
|
${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/}
|
|
|
|
${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/}
|
|
|
|
${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/}
|
2016-02-24 22:27:18 +00:00
|
|
|
SOBJS += ${${T}_FUNCS:S/$/.So/}
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS}
|
|
|
|
${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
|
|
|
${${T}_OBJS_P}: ${${T}_CFILE} ${COMMONHDRS}
|
|
|
|
${CC_P} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
|
|
|
${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHDRS}
|
|
|
|
${CC_S} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Extra objects coming from separate files
|
|
|
|
#
|
|
|
|
.if !empty(LIB2ADD)
|
|
|
|
SOBJS += ${LIB2ADD:R:S/$/.So/}
|
1994-08-02 20:15:59 +00:00
|
|
|
.endif
|
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Objects that should be in static library only.
|
|
|
|
#
|
2007-08-14 20:49:57 +00:00
|
|
|
SYMS_ST = ${LIB2FUNCS_ST} ${LIB2ADD_ST}
|
2007-05-19 04:25:59 +00:00
|
|
|
STAT_OBJS_T = ${SYMS_ST:S/$/.o/}
|
|
|
|
STAT_OBJS_P = ${SYMS_ST:S/$/.po/}
|
|
|
|
STATICOBJS = ${SYMS_ST:S/$/.o/}
|
2002-05-12 14:05:58 +00:00
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
${STAT_OBJS_T}: ${STD_CFILE} ${COMMONHDRS}
|
|
|
|
${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
|
|
|
${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDRS}
|
|
|
|
${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Assembler files.
|
|
|
|
#
|
|
|
|
.if defined(LIB1ASMSRC)
|
|
|
|
ASM_T = ${LIB1ASMFUNCS:S/$/.o/}
|
|
|
|
ASM_P = ${LIB1ASMFUNCS:S/$/.po/}
|
|
|
|
ASM_S = ${LIB1ASMFUNCS:S/$/.So/}
|
|
|
|
ASM_V = ${LIB1ASMFUNCS:S/$/.vis/}
|
2016-02-24 22:27:18 +00:00
|
|
|
SOBJS += ${LIB1ASMFUNCS:S/$/.So/}
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis
|
|
|
|
${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis}
|
|
|
|
${ASM_P}: ${LIB1ASMSRC} ${.PREFIX}.vis
|
|
|
|
${CC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.TARGET} -include ${.PREFIX}.vis ${.ALLSRC:N*.h:N*.vis}
|
|
|
|
${ASM_S}: ${LIB1ASMSRC}
|
|
|
|
${CC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
|
2002-05-18 09:46:12 +00:00
|
|
|
-o ${.TARGET} ${.ALLSRC:N*.h}
|
2007-05-19 04:25:59 +00:00
|
|
|
${ASM_V}: ${LIB1ASMSRC}
|
|
|
|
${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
|
|
|
|
-o ${.PREFIX}.vo ${.ALLSRC:N*.h}
|
2012-04-21 16:02:00 +00:00
|
|
|
( ${NM} -pg ${.PREFIX}.vo | \
|
2007-05-19 04:25:59 +00:00
|
|
|
awk 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t.hidden ", $$3 }'\
|
|
|
|
) > ${.TARGET}
|
|
|
|
|
|
|
|
CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo/}
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
|
|
|
|
2007-05-19 04:25:59 +00:00
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Exception handling / unwinding support.
|
|
|
|
#
|
|
|
|
EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/}
|
|
|
|
EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/}
|
|
|
|
EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/}
|
|
|
|
EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN
|
2016-01-26 14:45:21 +00:00
|
|
|
.if ${TARGET_CPUARCH} != "riscv64"
|
|
|
|
# RISCVTODO: unwinding support
|
2007-05-19 04:25:59 +00:00
|
|
|
SOBJS += ${EH_OBJS_S}
|
2016-01-26 14:45:21 +00:00
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
|
2016-01-09 00:42:07 +00:00
|
|
|
.for _src in ${LIB2ADDEHSTATIC:M*.c}
|
2007-05-19 04:25:59 +00:00
|
|
|
${_src:R:S/$/.o/}: ${_src} ${COMMONHDRS}
|
|
|
|
${CC_T} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
|
|
|
|
${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS}
|
|
|
|
${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
|
|
|
|
.endfor
|
2016-01-09 00:42:07 +00:00
|
|
|
.for _src in ${LIB2ADDEHSHARED:M*.c}
|
2007-05-19 04:25:59 +00:00
|
|
|
${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS}
|
|
|
|
${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC}
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
|
|
|
|
CLEANFILES += ${COMMONHDRS}
|
|
|
|
CLEANFILES += cs-*.h option*
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
2009-12-14 01:51:23 +00:00
|
|
|
# Build symbol version map
|
2007-05-19 04:25:59 +00:00
|
|
|
#
|
|
|
|
SHLIB_MKMAP = ${GCCDIR}/mkmap-symver.awk
|
|
|
|
SHLIB_MKMAP_OPTS =
|
|
|
|
SHLIB_MAPFILES = ${GCCDIR}/libgcc-std.ver
|
2014-10-01 08:26:51 +00:00
|
|
|
.if ${TARGET_CPUARCH} == "arm"
|
2013-01-17 05:56:28 +00:00
|
|
|
SHLIB_MAPFILES += ${GCCDIR}/config/arm/libgcc-bpabi.ver
|
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
VERSION_MAP = libgcc.map
|
|
|
|
|
2016-02-24 22:27:18 +00:00
|
|
|
libgcc.map: ${SHLIB_MKMAP} ${SHLIB_MAPFILES} ${SOBJS}
|
2012-04-21 16:02:00 +00:00
|
|
|
( ${NM} -pg ${SOBJS};echo %% ; \
|
2007-05-19 04:25:59 +00:00
|
|
|
cat ${SHLIB_MAPFILES} \
|
|
|
|
| sed -e '/^[ ]*#/d' \
|
|
|
|
-e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
|
|
|
|
| ${CC} ${CFLAGS} -E -xassembler-with-cpp -; \
|
|
|
|
) | awk -f ${SHLIB_MKMAP} ${SHLIB_MKMAP_OPTS} > ${.TARGET}
|
|
|
|
|
|
|
|
CLEANFILES += libgcc.map
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------
|
|
|
|
#
|
2009-12-14 01:51:23 +00:00
|
|
|
# Build additional static libgcc_eh[_p].a libraries.
|
2007-05-19 04:25:59 +00:00
|
|
|
#
|
2010-11-11 15:24:57 +00:00
|
|
|
libgcc_eh.a: ${EH_OBJS_T}
|
|
|
|
@${ECHO} building static gcc_eh library
|
2007-05-19 04:25:59 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-02-24 21:19:44 +00:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
|
2014-04-12 12:44:09 +00:00
|
|
|
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
|
2007-05-19 04:25:59 +00:00
|
|
|
|
2015-06-16 23:36:20 +00:00
|
|
|
_LIBS+= libgcc_eh.a
|
2007-05-19 04:25:59 +00:00
|
|
|
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no"
|
2010-11-11 15:24:57 +00:00
|
|
|
libgcc_eh_p.a: ${EH_OBJS_P}
|
|
|
|
@${ECHO} building profiled gcc_eh library
|
2007-05-19 04:25:59 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-02-24 21:19:44 +00:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
|
2014-04-12 12:44:09 +00:00
|
|
|
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
|
2015-06-16 23:36:20 +00:00
|
|
|
|
|
|
|
_LIBS+= libgcc_eh_p.a
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
_libinstall: _lib-eh-install
|
|
|
|
|
|
|
|
_lib-eh-install:
|
2009-02-13 16:51:36 +00:00
|
|
|
.if ${MK_INSTALLLIB} != "no"
|
2007-05-19 04:25:59 +00:00
|
|
|
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2010-11-11 15:24:57 +00:00
|
|
|
${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR}
|
2009-02-13 16:51:36 +00:00
|
|
|
.endif
|
2007-05-19 04:25:59 +00:00
|
|
|
.if ${MK_PROFILE} != "no"
|
|
|
|
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2010-11-11 15:24:57 +00:00
|
|
|
${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR}
|
2002-05-12 14:05:58 +00:00
|
|
|
.endif
|
|
|
|
|
2010-11-11 15:24:57 +00:00
|
|
|
CLEANFILES+= libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
|
2007-05-19 04:25:59 +00:00
|
|
|
|
1994-08-02 20:15:59 +00:00
|
|
|
.include <bsd.lib.mk>
|
2007-05-19 04:25:59 +00:00
|
|
|
|
|
|
|
.SUFFIXES: .vis .vo
|