File:  [DragonFly] / src / gnu / lib / gcc3 / libgcc / Attic / Makefile
Revision 1.3: download - view: text, annotated - select for diffs
Fri Mar 5 21:38:44 2004 UTC (10 years, 5 months ago) by joerg
Branches: MAIN
CVS tags: HEAD
Propolice for GCC 3.3 based on:
http://www.trl.ibm.com/projects/security/ssp/gcc3_3/protector-3.3-7.tar.gz

protector.[ch] has been in integrated into cc3/cc_int and the protector.dif
has been splitted and integrated into cc3/cc_int/patches using the new
patch infrastructure. The old bsd-format.patch has been moved there as well.

The build order in gnu/ has been adjusted since lib/gcc3/libgcc depends on
"make depend" in usr.bin/cc3/cc_int for inclusion of the patched files.

The second stage loader has been adjusted to link when parts are compiled
using -fstack-protector.

    1: # $FreeBSD: src/gnu/lib/libgcc/Makefile,v 1.50 2003/07/11 05:29:11 kan Exp $
    2: # $DragonFly: src/gnu/lib/gcc3/libgcc/Makefile,v 1.3 2004/03/05 21:38:44 joerg Exp $
    3: 
    4: .include "../Makefile.inc"
    5: .include "${.CURDIR}/../../../usr.bin/cc3/Makefile.tgt"
    6: 
    7: .PATH: ${.OBJDIR}/../../../usr.bin/cc3/cc_int
    8: .PATH: ${.CURDIR}/../../../usr.bin/cc3/cc_int
    9: .PATH: ${GCCDIR}/gcc/config/${GCC_CPU} ${GCCDIR}/gcc
   10: 
   11: # allow to be overridden for the a.out case
   12: .if !defined(LIB) || ${LIB} != "gcc_r"
   13: LIB=	gcc
   14: .endif
   15: 
   16: #SHLIB_MAJOR=	1
   17: 
   18: # We need to install libgcc_pic.a as well, for use by shared libs.
   19: INSTALL_PIC_ARCHIVE=    yes     
   20: 
   21: #
   22: # XXX This is a hack, but it seems to work.
   23: # libgcc2.a is meant to be compiled by *this* version of gcc.
   24: #
   25: # Normally, this does not make any difference, since we only have gcc, but
   26: # when bootstrapping from gcc-2.6.3, we have to use the freshly built 2.7.2
   27: # compiler for some of the libgcc2.c __attribute__ stuff.
   28: #
   29: # We now depend on a bootstrap pass (normally in `make world') to build
   30: # and install the new version of gcc before we get here.  This makes
   31: # finding the new version (XCC) easy but may break finding the old version
   32: # (CC).
   33: #
   34: XCC=	${CC}
   35: XCXX=	${CXX}
   36: 
   37: CFLAGS+=	-fexceptions
   38: CFLAGS+=	-DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
   39: 		-DFINE_GRAINED_LIBRARIES
   40: CFLAGS+=	-D_PTHREADS -DGTHREAD_USE_WEAK
   41: CFLAGS+=	-I. -I${CCTOOLS_SRC} -I${CCTOOLS_OBJ} \
   42: 		-I${DFLYH} -I${GCCDIR}/include -I${GCCDIR}/gcc/config \
   43: 		-I${GCCDIR}/gcc
   44: 
   45: OBJS=		# added to below in various ways depending on TARGET_ARCH
   46: 
   47: #---------------------------------------------------------------------------
   48: #
   49: # When upgrading GCC, get the following defintions straight from Makefile.in
   50: #
   51: 
   52: # Library members defined in libgcc2.c.
   53: # Variable length limited to 255 charactes when passed to a shell script.
   54: LIB2FUNCS_1 = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
   55:     _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
   56:     _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
   57: 
   58: LIB2FUNCS_2 = _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf \
   59:     _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 \
   60:     _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
   61:     _stack_smash_handler
   62: 
   63: # Defined in libgcc2.c, included only in the static library.
   64: LIB2FUNCS_ST = _eprintf _bb __gcc_bcmp
   65: 
   66: FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
   67:     _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
   68:     _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
   69:     _sf_to_df _thenan_sf _sf_to_usi _usi_to_sf
   70: 
   71: DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
   72:     _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
   73:     _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
   74:     _df_to_sf _thenan_df _df_to_usi _usi_to_df
   75: 
   76: # These might cause a divide overflow trap and so are compiled with
   77: # unwinder info.
   78: LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
   79: 
   80: MACHMODE_H = machmode.h machmode.def
   81: 
   82: LIB2ADD = $(LIB2FUNCS_EXTRA)
   83: LIB2ADD_ST = $(LIB2FUNCS_STATIC_EXTRA)
   84: 
   85: # Additional sources to handle exceptions; overridden on ia64.
   86: LIB2ADDEH = unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c unwind-c.c
   87: 
   88: #-----------------------------------------------------------------------
   89: #
   90: #	Platform specific bits.
   91: #	When upgrading GCC, get the following defintions from config/<cpu>/t-*
   92: #
   93: 
   94: .if ${TARGET_ARCH} == "alpha"
   95: #	from config/alpha/t-alpha
   96: LIB2FUNCS_EXTRA = qrnnd.asm
   97: .endif
   98: 
   99: .if ${TARGET_ARCH} == "arm"
  100: #	from config/arm/t-strongarm-elf
  101: LIB1ASMSRC = lib1funcs.asm
  102: LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
  103: # We want fine grained libraries, so use the new code to build the
  104: # floating point emulation libraries.
  105: XXX fix this: NEED_FP_EMULATION set to "yes" with different rules per platform
  106: .endif
  107: 
  108: .if ${TARGET_ARCH} == "ia64"
  109: #	from config/ia64/t-ia64
  110: LIB1ASMSRC    = lib1funcs.asm
  111: LIB1ASMFUNCS  = __divtf3 __divdf3 __divsf3 \
  112: 	__divdi3 __moddi3 __udivdi3 __umoddi3 \
  113: 	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
  114: 	__nonlocal_goto __restore_stack_nonlocal __trampoline
  115: LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
  116: .endif
  117: 
  118: .if ${TARGET_ARCH} == "powerpc"
  119: #	from config/rs6000/t-ppccomm
  120: LIB2FUNCS_EXTRA = tramp.asm
  121: # This one can't end up in shared libgcc
  122: LIB2FUNCS_STATIC_EXTRA = eabi.asm
  123: # We want fine grained libraries, so use the new code to build the
  124: # floating point emulation libraries.
  125: OBJS+=	dp-bit.o fp-bit.o
  126: .endif
  127: 
  128: .if ${TARGET_ARCH} == "sparc64"
  129: #	from config/sparc/t-elf
  130: # We want fine grained libraries, so use the new code to build the
  131: # floating point emulation libraries.
  132: LIB1ASMSRC = lb1spc.asm
  133: LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
  134: OBJS+=	dp-bit.o fp-bit.o
  135: .endif
  136: 
  137: dp-bit.o: config/fp-bit.c
  138: 	${XCC} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  139: 
  140: dp-bit.So: config/fp-bit.c
  141: 	${XCC} ${PICFLAG} -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  142: 
  143: dp-bit.po: config/fp-bit.c
  144: 	${XCC} -p -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  145: 
  146: fp-bit.o: config/fp-bit.c
  147: 	${XCC} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  148: 
  149: fp-bit.So: config/fp-bit.c
  150: 	${XCC} ${PICFLAG} -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  151: 
  152: fp-bit.po: config/fp-bit.c
  153: 	${XCC} -p -DFLOAT=1 -c ${CFLAGS} -o ${.TARGET} ${.ALLSRC:M*fp-bit*}
  154: 
  155: #-----------------------------------------------------------------------
  156: 
  157: # Remove any objects from LIB2FUNCS and LIB2_DIVMOD_FUNCS that are
  158: # defined as optimized assembly code in LIB1ASMFUNCS.
  159: .if defined(LIB1ASMFUNCS)
  160: .for sym in ${LIB1ASMFUNCS}
  161: LIB2FUNCS_1:=	${LIB2FUNCS_1:S/${sym}//g}
  162: LIB2FUNCS_2:=	${LIB2FUNCS_2:S/${sym}//g}
  163: LIB2_DIVMOD_FUNCS:= ${LIB2_DIVMOD_FUNCS:S/${sym}//g}
  164: .endfor
  165: .endif
  166: 
  167: ASM_T=		${LIB1ASMFUNCS:S/$/.o/}
  168: ASM_P=		${LIB1ASMFUNCS:S/$/.po/}
  169: ASM_S=		${LIB1ASMFUNCS:S/$/.So/}
  170: 
  171: SYMS=		${LIB2FUNCS_1}		\
  172: 		${LIB2FUNCS_2}		\
  173: 		${LIB2_DIVMOD_FUNCS}
  174: .if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
  175: SYMS+=		${FPBIT_FUNCS} ${DPBIT_FUNCS}
  176: .endif
  177: SYMS_ST=	${LIB2FUNCS_ST}		\
  178: 		${LIB2ADD_ST}
  179: OBJS+=		${SYMS:S/$/.o/} ${LIB1ASMFUNCS:S/$/.o/}
  180: OBJS_T=		${SYMS:S/$/.o/}  ${SYMS_ST:S/$/.o/}
  181: OBJS_P=		${SYMS:S/$/.po/} ${SYMS_ST:S/$/.po/}
  182: OBJS_S=		${SYMS:S/$/.So/}
  183: STATICOBJS=	${SYMS_ST:S/$/.o/}
  184: SRCS=		${LIB2ADD} ${LIB2ADDEH}
  185: 
  186: .if exists(${CCTOOLS_OBJ})
  187: TCONFIG_H = ${CCTOOLS_OBJ}/tconfig.h
  188: .else
  189: TCONFIG_H = ${CCTOOLS_SRC}/tconfig.h
  190: .endif
  191: 
  192: ${TCONFIG_H}: ${CCTOOLS_SRC}/Makefile
  193: 	cd ${CCTOOLS_SRC} && make tconfig.h
  194: 
  195: ${OBJS} beforedepend: ${TCONFIG_H}
  196: 
  197: ${OBJS_T}: libgcc2.c
  198: 	${XCC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  199: 
  200: .if !defined(NOPIC)
  201: ${OBJS_S}: libgcc2.c
  202: 	${XCC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  203: .endif
  204: 
  205: .if !defined(NOPROFILE)
  206: ${OBJS_P}: libgcc2.c
  207: 	${XCC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
  208: .endif
  209: 
  210: .if defined(LIB1ASMSRC)
  211: .for _lib1asmsrc in ${LIB1ASMSRC}
  212: ${ASM_T}: ${_lib1asmsrc}
  213: 	${XCC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \
  214: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  215: 
  216: .if !defined(NOPIC)
  217: ${ASM_S}: ${_lib1asmsrc}
  218: 	${XCC} -x assembler-with-cpp -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} \
  219: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  220: .endif
  221: 
  222: .if !defined(NOPROFILE)
  223: ${ASM_P}: ${_lib1asmsrc}
  224: 	${XCC} -x assembler-with-cpp -p -c ${CFLAGS} -DL${.PREFIX} \
  225: 	    -o ${.TARGET} ${.ALLSRC:N*.h}
  226: .endif
  227: .endfor
  228: .endif
  229: 
  230: .include <bsd.lib.mk>