head	1.7;
access;
symbols
	RELENG_9_1_0_RELEASE:1.3.2.2.2.2
	RELENG_9_1:1.3.2.2.0.2
	RELENG_9_1_BP:1.3.2.2
	RELENG_9_0_0_RELEASE:1.3.2.1.2.1
	RELENG_9_0:1.3.2.1.0.2
	RELENG_9_0_BP:1.3.2.1
	RELENG_9:1.3.0.2
	RELENG_9_BP:1.3;
locks; strict;
comment	@# @;


1.7
date	2012.11.17.01.49.20;	author svnexp;	state Exp;
branches;
next	1.6;

1.6
date	2012.04.20.21.00.39;	author dim;	state Exp;
branches;
next	1.5;

1.5
date	2012.03.13.18.59.19;	author nwhitehorn;	state Exp;
branches;
next	1.4;

1.4
date	2012.03.11.20.04.09;	author kib;	state Exp;
branches;
next	1.3;

1.3
date	2011.06.27.16.24.36;	author nwhitehorn;	state Exp;
branches
	1.3.2.1;
next	1.2;

1.2
date	2011.01.13.20.44.31;	author dim;	state Exp;
branches;
next	1.1;

1.1
date	2010.07.10.03.45.55;	author nwhitehorn;	state Exp;
branches;
next	;

1.3.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.3.2.1.2.1;
next	1.3.2.2;

1.3.2.2
date	2012.04.27.06.49.35;	author dim;	state Exp;
branches
	1.3.2.2.2.1;
next	1.3.2.3;

1.3.2.3
date	2012.11.17.11.36.15;	author svnexp;	state Exp;
branches;
next	;

1.3.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.3.2.1.2.2;

1.3.2.1.2.2
date	2012.11.17.08.36.15;	author svnexp;	state Exp;
branches;
next	;

1.3.2.2.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.3.2.2.2.2;

1.3.2.2.2.2
date	2012.11.17.08.47.05;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Switching exporter and resync
@
text
@# $FreeBSD: head/lib/csu/powerpc64/Makefile 234502 2012-04-20 21:00:39Z dim $

.PATH: ${.CURDIR}/../common

SRCS=		crt1.c crti.S crtn.S
OBJS=		${SRCS:N*.h:R:S/$/.o/g}
OBJS+=		Scrt1.o gcrt1.o
CFLAGS+=	-I${.CURDIR}/../common \
		-I${.CURDIR}/../../libc/include \
		-mlongcall

all: ${OBJS}

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} ${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} ${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} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s

realinstall:
	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
	    ${OBJS} ${DESTDIR}${LIBDIR}

.include <bsd.lib.mk>
@


1.6
log
@SVN rev 234502 on 2012-04-20 21:00:39Z by dim

After r217375, some startup objects under lib/csu are built in a special
way: first they are compiled to assembly, then some sed'ing is done on
the assembly, and lastly the assembly is compiled to an object file.

This last step is done using ${CC}, and not ${AS}, because when the
compiler is clang, it outputs directives that are too advanced for our
old gas.  So we use clang's integrated assembler instead.  (When the
compiler is gcc, it just calls gas, and nothing is different, except one
extra fork.)

However, in the .s to .o rules in lib/csu/$ARCH/Makefile, I still passed
CFLAGS to the compiler, instead of ACFLAGS, which are specifically for
compiling .s files.

In case you are using '-g' for debug info anywhere in your CFLAGS, it
causes the .s files to already contain debug information in the assembly
itself.  In the next step, the .s files are also compiled using '-g',
and if the compiler is clang, it complains: "error: input can't have
.file dwarf directives when -g is used to generate dwarf debug info for
assembly code".

Fix this by using ${ACFLAGS} for compiling the .s files instead.

Reported by:	jasone
MFC after:	1 week
@
text
@d1 1
a1 1
# $FreeBSD$
@


1.5
log
@SVN rev 232932 on 2012-03-13 18:59:19Z by nwhitehorn

Work around a binutils bug on powerpc64 where the TOC would not be
properly reloaded when calling _fini() in large binaries with multiple
TOC sections (e.g. GCC), leading to a segmentation fault. Adding -mlongcall
to crt1 flags causes the compiler to emit explicit TOC load instructions
for all function calls, including _fini().

Reviewed by:	kib
Pointy hat to:	kib
@
text
@d25 1
a25 1
	${CC} ${CFLAGS} -c -o ${.TARGET} crt1.s
d32 1
a32 1
	${CC} ${CFLAGS} -c -o ${.TARGET} gcrt1.s
d39 1
a39 1
	${CC} ${CFLAGS} -c -o ${.TARGET} Scrt1.s
@


1.4
log
@SVN rev 232832 on 2012-03-11 20:04:09Z by kib

Stop calling _init/_fini methods from crt1 for dynamic binaries.  Do
call preinit, init and fini arrays methods from crt1 for static binaries.

Mark new crt1 with FreeBSD-specific ELF note.

Move some common crt1 code into new MI file ignore_init.c, to reduce
duplication.  Also, conservatively adjust nearby sources for style.

Reviewed by:	kan
Tested by:	andrew (arm), flo (sparc64)
MFC after:	3 weeks
@
text
@d9 2
a10 1
		-I${.CURDIR}/../../libc/include
@


1.3
log
@SVN rev 223599 on 2011-06-27 16:24:36Z by nwhitehorn

Build Scrt.o on powerpc64. Its introduction on other platforms got lost
during the period of time the powerpc64 port was on a project branch.
@
text
@d21 1
a21 1
	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
d28 1
a28 1
	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
d35 1
a35 1
	sed -i "" -e '/\.note\.ABI-tag/s/progbits/note/' ${.TARGET}
@


1.3.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.3.2.2
log
@SVN rev 234726 on 2012-04-27 06:49:35Z by dim

MFC r234502:

After r217375, some startup objects under lib/csu are built in a special
way: first they are compiled to assembly, then some sed'ing is done on
the assembly, and lastly the assembly is compiled to an object file.

This last step is done using ${CC}, and not ${AS}, because when the
compiler is clang, it outputs directives that are too advanced for our
old gas.  So we use clang's integrated assembler instead.  (When the
compiler is gcc, it just calls gas, and nothing is different, except one
extra fork.)

However, in the .s to .o rules in lib/csu/$ARCH/Makefile, I still passed
CFLAGS to the compiler, instead of ACFLAGS, which are specifically for
compiling .s files.

In case you are using '-g' for debug info anywhere in your CFLAGS, it
causes the .s files to already contain debug information in the assembly
itself.  In the next step, the .s files are also compiled using '-g',
and if the compiler is clang, it complains: "error: input can't have
.file dwarf directives when -g is used to generate dwarf debug info for
assembly code".

Fix this by using ${ACFLAGS} for compiling the .s files instead.

Reported by:	jasone
@
text
@d24 1
a24 1
	${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s
d31 1
a31 1
	${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s
d38 1
a38 1
	${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s
@


1.3.2.3
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d1 1
a1 1
# $FreeBSD: stable/9/lib/csu/powerpc64/Makefile 234726 2012-04-27 06:49:35Z dim $
@


1.3.2.2.2.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.3.2.2.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.1/lib/csu/powerpc64/Makefile 234726 2012-04-27 06:49:35Z dim $
@


1.3.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.3.2.1.2.2
log
@Switch importer
@
text
@d1 1
a1 1
# $FreeBSD: releng/9.0/lib/csu/powerpc64/Makefile 223599 2011-06-27 16:24:36Z nwhitehorn $
@


1.2
log
@SVN rev 217375 on 2011-01-13 20:44:31Z by dim

Apply a workaround for a binutils issue with the .note.ABI-tag section
generated from lib/csu/common/crtbrand.c (which ultimately ends up in
executables and shared libraries, via crt1.o, gcrt1.o or Scrt1.o).

For all arches except sparc, gcc emits the section directive for the
abitag struct in crtbrand.c with a PROGBITS type.  However, newer
versions of binutils (after 2.16.90) require the section to be of NOTE
type, to guarantee that the .note.ABI-tag section correctly ends up in
the first page of the final executable.

Unfortunately, there is no clean way to tell gcc to use another section
type, so crtbrand.c (or the C files that include it) must be compiled in
multiple steps:

- Compile the .c file to a .s file.
- Edit the .s file to change the 'progbits' type to 'note', for the section
  directive that defines the .note.ABI-tag section.
- Compile the .s file to an object file.

These steps are done in the invididual Makefiles for each applicable arch.

Reviewed by:	kib
@
text
@d7 2
a8 3
OBJS+=		gcrt1.o
CFLAGS+=	-Wall -Wno-unused \
		-I${.CURDIR}/../common \
d14 1
a14 1
CLEANFILES+=	crt1.s gcrt1.s
d33 7
@


1.1
log
@SVN rev 209869 on 2010-07-10 03:45:55Z by nwhitehorn

C startup support for 64-bit PowerPC.

Obtained from:	projects/ppc64
@
text
@d15 1
d17 16
a32 2
gcrt1.o: crt1.c
	${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
@

