Index: head/gnu/lib/csu/Makefile =================================================================== --- head/gnu/lib/csu/Makefile (revision 342973) +++ head/gnu/lib/csu/Makefile (revision 342974) @@ -1,77 +1,73 @@ # $FreeBSD$ .include MK_SSP= no GCCDIR= ${SRCTOP}/contrib/gcc GCCLIB= ${SRCTOP}/contrib/gcclibs CCDIR= ${SRCTOP}/gnu/usr.bin/cc .include "${CCDIR}/Makefile.tgt" .include "${CCDIR}/cc_tools/Makefile.hdrs" .PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR} SRCS= crtstuff.c ${COMMONHDRS} OBJS= crtbegin.o crtend.o crtbeginT.o SOBJS= crtbeginS.o crtendS.o CSTD?= gnu89 CFLAGS+= -DIN_GCC -DHAVE_LD_EH_FRAME_HDR -DDT_CONFIG -D__GLIBC__=3 CFLAGS.gcc+= -finhibit-size-directive -fno-toplevel-reorder CFLAGS+= -fno-inline-functions -fno-exceptions \ -fno-zero-initialized-in-bss -fno-asynchronous-unwind-tables \ -fno-omit-frame-pointer CFLAGS+= -I${GCCLIB}/include -I${GCCDIR}/config -I${GCCDIR} -I. \ -I${CCDIR}/cc_tools CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG} .if ${TARGET_CPUARCH} == "arm" CFLAGS+= -DTARGET_ARM_EABI .endif -.if ${MACHINE_CPUARCH} == "powerpc" -TGTOBJS= crtsavres.o -SRCS+= crtsavres.asm -.endif .if ${MACHINE_CPUARCH} == "sparc64" TGTOBJS= crtfastmath.o SRCS+= crtfastmath.c .endif BEGINSRC?= crtstuff.c ENDSRC?= crtstuff.c FILES= ${OBJS} ${SOBJS} ${TGTOBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .undef LIBRARIES_ONLY ${OBJS} ${SOBJS}: ${SRCS:M*.h} CLEANFILES= ${OBJS} ${SOBJS} ${TGTOBJS} crtbegin.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtbeginT.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN -DCRTSTUFFT_O \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtbeginS.o: ${BEGINSRC} ${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtend.o: ${ENDSRC} ${CC} ${CFLAGS} -g0 -DCRT_END \ -c -o ${.TARGET} ${.ALLSRC:N*.h} crtendS.o: ${ENDSRC} ${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \ -c -o ${.TARGET} ${.ALLSRC:N*.h} COMMONHDRS+= tm.h tconfig.h options.h CLEANFILES+= ${COMMONHDRS} optionlist cs-tconfig.h cs-tm.h .include Index: head/lib/csu/powerpc/Makefile =================================================================== --- head/lib/csu/powerpc/Makefile (revision 342973) +++ head/lib/csu/powerpc/Makefile (revision 342974) @@ -1,47 +1,47 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common -SRCS= crt1.c crti.S crtn.S +SRCS= crt1.c crti.S crtn.S crtsavres.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR:H}/common \ -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS FILES= ${OBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .undef LIBRARIES_ONLY CLEANFILES= ${OBJS} CLEANFILES+= crt1.s gcrt1.s Scrt1.s # See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not # directly compiled to .o files. crt1.s: crt1.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} crt1.o: crt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s gcrt1.s: crt1.c ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} gcrt1.o: gcrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s Scrt1.s: crt1.c ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} Scrt1.o: Scrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s .include Index: head/lib/csu/powerpc/crtsavres.S =================================================================== --- head/lib/csu/powerpc/crtsavres.S (nonexistent) +++ head/lib/csu/powerpc/crtsavres.S (revision 342974) @@ -0,0 +1,191 @@ +/*- + * SPDX-License-Identifier: BSD-1-Clause + * + * Copyright 2019 Justin Hibbits + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +.text + +/* + * The PowerPC ABI spec requires the following save/restore functions to be + * provided: + * + * _savefpr_N + * _restfpr_N + * _restfpr_N_x + * _savegpr_N + * _restgpr_N + * _restgpr_N_x + * + * With N ranging from 14 to 31, to save the nonvolatile registers. + */ + +#define _CRTENTRY(name) \ + .text; \ + .globl name; \ + .type name,@function; \ + name: + +#define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \ + stfd r,(-256 + r * 8)(11) + +SAVEFPR(14) +SAVEFPR(15) +SAVEFPR(16) +SAVEFPR(17) +SAVEFPR(18) +SAVEFPR(19) +SAVEFPR(20) +SAVEFPR(21) +SAVEFPR(22) +SAVEFPR(23) +SAVEFPR(24) +SAVEFPR(25) +SAVEFPR(26) +SAVEFPR(27) +SAVEFPR(28) +SAVEFPR(29) +SAVEFPR(30) +SAVEFPR(31) + blr + +#define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \ + lfd r,(-256 + r * 8)(11) + +RESTFPR(14) +RESTFPR(15) +RESTFPR(16) +RESTFPR(17) +RESTFPR(18) +RESTFPR(19) +RESTFPR(20) +RESTFPR(21) +RESTFPR(22) +RESTFPR(23) +RESTFPR(24) +RESTFPR(25) +RESTFPR(26) +RESTFPR(27) +RESTFPR(28) +RESTFPR(29) +RESTFPR(30) +RESTFPR(31) + blr + +#define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \ + stfd r,(-128 + r*4)(11) + +SAVEGPR(14) +SAVEGPR(15) +SAVEGPR(16) +SAVEGPR(17) +SAVEGPR(18) +SAVEGPR(19) +SAVEGPR(20) +SAVEGPR(21) +SAVEGPR(22) +SAVEGPR(23) +SAVEGPR(24) +SAVEGPR(25) +SAVEGPR(26) +SAVEGPR(27) +SAVEGPR(28) +SAVEGPR(29) +SAVEGPR(30) +SAVEGPR(31) + blr + +#define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \ + lwz r,(-128 + r*4)(11) + +RESTGPR(14) +RESTGPR(15) +RESTGPR(16) +RESTGPR(17) +RESTGPR(18) +RESTGPR(19) +RESTGPR(20) +RESTGPR(21) +RESTGPR(22) +RESTGPR(23) +RESTGPR(24) +RESTGPR(25) +RESTGPR(26) +RESTGPR(27) +RESTGPR(28) +RESTGPR(29) +RESTGPR(30) +RESTGPR(31) + blr + +#define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \ + lfd r,(-256 + r * 8)(11) + +RESTFPR_X(14) +RESTFPR_X(15) +RESTFPR_X(16) +RESTFPR_X(17) +RESTFPR_X(18) +RESTFPR_X(19) +RESTFPR_X(20) +RESTFPR_X(21) +RESTFPR_X(22) +RESTFPR_X(23) +RESTFPR_X(24) +RESTFPR_X(25) +RESTFPR_X(26) +RESTFPR_X(27) +RESTFPR_X(28) +RESTFPR_X(29) +RESTFPR_X(30) +RESTFPR_X(31) + lwz 0,4(11) + mtlr 0 + mr 1,11 + blr + +#define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \ + lwz r,(-128 + r*4)(11) + +RESTGPR_X(14) +RESTGPR_X(15) +RESTGPR_X(16) +RESTGPR_X(17) +RESTGPR_X(18) +RESTGPR_X(19) +RESTGPR_X(20) +RESTGPR_X(21) +RESTGPR_X(22) +RESTGPR_X(23) +RESTGPR_X(24) +RESTGPR_X(25) +RESTGPR_X(26) +RESTGPR_X(27) +RESTGPR_X(28) +RESTGPR_X(29) +RESTGPR_X(30) +RESTGPR_X(31) + lwz 0,4(11) + mtlr 0 + mr 1,11 + blr Property changes on: head/lib/csu/powerpc/crtsavres.S ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/lib/csu/powerpc64/Makefile =================================================================== --- head/lib/csu/powerpc64/Makefile (revision 342973) +++ head/lib/csu/powerpc64/Makefile (revision 342974) @@ -1,47 +1,51 @@ # $FreeBSD$ .PATH: ${.CURDIR:H}/common SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o gcrt1.o +OBJS+= crtsavres.o Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR:H}/common \ -I${SRCTOP}/lib/libc/include \ -mlongcall -DCRT_IRELOC_SUPPRESS FILES= ${OBJS} FILESMODE= ${LIBMODE} FILESOWN= ${LIBOWN} FILESGRP= ${LIBGRP} FILESDIR= ${LIBDIR} # These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. .undef LIBRARIES_ONLY CLEANFILES= ${OBJS} -CLEANFILES+= crt1.s gcrt1.s Scrt1.s +CLEANFILES+= crt1.s crtsavres.s gcrt1.s Scrt1.s # See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not # directly compiled to .o files. crt1.s: crt1.c ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} + +# On powerpc64 crtsavres is an empty file +crtsavres.s: + touch ${.TARGET} crt1.o: crt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} crt1.s gcrt1.s: crt1.c ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} gcrt1.o: gcrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s Scrt1.s: crt1.c ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c sed ${SED_FIX_NOTE} ${.TARGET} Scrt1.o: Scrt1.s ${CC} ${CFLAGS:N-g} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s .include