* Bring back the guts of crt{i,n}.S. This allows C++ exceptions to work
when using the egcs and gcc-devel ports, along with GCC built from stock public FSF sources. With out this change, FreeBSD will be removed from the list of systems GCC 3.0 must be evaluated on before release. With the effort some of us put into getting FreeBSD on this list, we should not turn this effort into a waste, else we might not be worth fighting for in the future. (note that Alpha and IA-64 versions of crt{i,n}.S are needed) * Switch from our own crt{begin,in} to those created from GCC's crtstuff.c. This will allow us to switch to DWARF2 exceptions in the future, along with staying in sync with any future GCC requirements. * Break out our ELF branding bits into a seperate file. Currently this is now included by our crt1.c files (since this functionality was part of our native crtbegin.c). Later crtbrand.o will be merged in the creation of crti.o.
This commit is contained in:
parent
7ca2f6ae1f
commit
ae7c8a2bb8
@ -650,6 +650,7 @@ includes:
|
||||
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
|
||||
cd ${.CURDIR}/lib/csu/${MACHINE_ARCH}; ${MAKE} beforeinstall
|
||||
.endif
|
||||
cd ${.CURDIR}/gnu/lib/csu; ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libatm; ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libdevstat; ${MAKE} beforeinstall
|
||||
@ -745,7 +746,7 @@ _libkeycap= usr.sbin/pcvt/keycap
|
||||
.endif
|
||||
|
||||
libraries:
|
||||
.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
|
||||
.for _lib in ${_csu} gnu/lib/csu lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
|
||||
${_kerberos5_lib} gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses \
|
||||
lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
|
||||
lib/libz lib gnu/lib \
|
||||
|
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= libdialog libgcc libgcc_r libgmp libmp libregex libreadline
|
||||
SUBDIR= csu libdialog libgcc libgcc_r libgmp libmp libregex libreadline
|
||||
|
||||
.if !defined(NO_CXX)
|
||||
SUBDIR+= libstdc++
|
||||
|
56
gnu/lib/csu/Makefile
Normal file
56
gnu/lib/csu/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
# $FreeBSD$
|
||||
|
||||
GCCDIR= ${.CURDIR}/../../../contrib/gcc.295
|
||||
.PATH: ${GCCDIR}
|
||||
|
||||
SRCS= crtstuff.c tm.h
|
||||
OBJS= crtbegin.o crtend.o
|
||||
SOBJS= crtbegin.So crtend.So
|
||||
CFLAGS+= -I${GCCDIR}/config -I. -DIN_GCC \
|
||||
-finhibit-size-directive -fno-inline-functions \
|
||||
-fno-exceptions -fno-omit-frame-pointer
|
||||
NOMAN= true
|
||||
NOPIC= true
|
||||
NOPROFILE= true
|
||||
INTERNALLIB= true
|
||||
CLEANFILES+= tm.h
|
||||
|
||||
CRTS_CFLAGS= -DCRTSTUFFS_O ${PICFLAG}
|
||||
|
||||
all: ${OBJS} ${SOBJS}
|
||||
|
||||
crtbegin.o: crtstuff.c tm.h
|
||||
${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
|
||||
-c -o ${.TARGET} ${GCCDIR}/crtstuff.c
|
||||
|
||||
crtbegin.So: crtstuff.c tm.h
|
||||
${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
|
||||
-c -o ${.TARGET} ${GCCDIR}/crtstuff.c
|
||||
|
||||
crtend.o: crtstuff.c tm.h
|
||||
${CC} ${CFLAGS} -g0 -DCRT_END \
|
||||
-c -o ${.TARGET} ${GCCDIR}/crtstuff.c
|
||||
|
||||
crtend.So: crtstuff.c tm.h
|
||||
${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
|
||||
-c -o ${.TARGET} ${GCCDIR}/crtstuff.c
|
||||
|
||||
# KEEP THIS IN SYNC with src/gnu/usr.bin/cc/cc_tools/Makefile !!
|
||||
tm.h:
|
||||
echo '#include "${MACHINE_ARCH}/${MACHINE_ARCH}.h"' > ${.TARGET}
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
echo '#include "${MACHINE_ARCH}/att.h"' >> ${.TARGET}
|
||||
.endif
|
||||
echo '#include <freebsd.h>' >> ${.TARGET}
|
||||
echo '#include "${MACHINE_ARCH}/freebsd.h"' >> ${.TARGET}
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
echo '#include "${MACHINE_ARCH}/perform.h"' >> ${.TARGET}
|
||||
.endif
|
||||
|
||||
realinstall:
|
||||
.for file in ${OBJS} ${SOBJS}
|
||||
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
|
||||
.endfor
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -2,11 +2,11 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
SRCS= crt1.c crtbegin.c crtend.c
|
||||
OBJS= crt1.o crtbegin.o crtend.o
|
||||
SRCS= crt1.c
|
||||
OBJS= crt1.o
|
||||
OBJS+= gcrt1.o
|
||||
SOBJS= crtbegin.So crtend.So
|
||||
CFLAGS+= -Wall -Wno-unused
|
||||
CFLAGS+= -Wall -Wno-unused \
|
||||
-I${.CURDIR}/../common
|
||||
NOMAN= true
|
||||
NOPIC= true
|
||||
NOPROFILE= true
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "crtbrand.c"
|
||||
|
||||
struct Struct_Obj_Entry;
|
||||
struct ps_strings;
|
||||
|
@ -2,11 +2,11 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
SRCS= crt1.c crtbegin.c crtend.c crti.S crtn.S
|
||||
SRCS= crt1.c crti.S crtn.S
|
||||
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
OBJS+= gcrt1.o
|
||||
SOBJS= crtbegin.So crtend.So
|
||||
CFLAGS+= -elf -Wall -fkeep-inline-functions
|
||||
CFLAGS+= -elf -Wall -fkeep-inline-functions \
|
||||
-I${.CURDIR}/../common
|
||||
LDFLAGS+= -elf
|
||||
NOMAN= true
|
||||
NOPIC= true
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "crtbrand.c"
|
||||
|
||||
typedef void (*fptr)(void);
|
||||
|
||||
|
@ -25,7 +25,14 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is not used any more. It will go away as soon as the gcc
|
||||
* linker specs have been updated accordingly.
|
||||
*/
|
||||
.section .init,"ax",@progbits
|
||||
.align 4
|
||||
.globl _init
|
||||
.type _init,@function
|
||||
_init:
|
||||
|
||||
.section .fini,"ax",@progbits
|
||||
.align 4
|
||||
.globl _fini
|
||||
.type _fini,@function
|
||||
_fini:
|
||||
|
@ -25,7 +25,8 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is not used any more. It will go away as soon as the gcc
|
||||
* linker specs have been updated accordingly.
|
||||
*/
|
||||
.section .init,"ax",@progbits
|
||||
ret
|
||||
|
||||
.section .fini,"ax",@progbits
|
||||
ret
|
||||
|
@ -82,21 +82,4 @@ _fini(void)
|
||||
(*p_do_dtors)();
|
||||
}
|
||||
|
||||
/*
|
||||
* Special ".note" entry specifying the ABI version. See
|
||||
* http://www.netbsd.org/Documentation/kernel/elf-notes.html
|
||||
* for more information.
|
||||
*/
|
||||
static const struct {
|
||||
int32_t namesz;
|
||||
int32_t descsz;
|
||||
int32_t type;
|
||||
char name[sizeof ABI_VENDOR];
|
||||
int32_t desc;
|
||||
} abitag __attribute__ ((section (ABI_SECTION))) = {
|
||||
sizeof ABI_VENDOR,
|
||||
sizeof(int32_t),
|
||||
ABI_NOTETYPE,
|
||||
ABI_VENDOR,
|
||||
__FreeBSD_version
|
||||
};
|
||||
#include "crtbegin.c"
|
||||
|
51
lib/csu/common/crtbrand.c
Normal file
51
lib/csu/common/crtbrand.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*-
|
||||
* Copyright 1996, 1997, 1998, 2000 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#define ABI_VENDOR "FreeBSD"
|
||||
#define ABI_SECTION ".note.ABI-tag"
|
||||
#define ABI_NOTETYPE 1
|
||||
|
||||
/*
|
||||
* Special ".note" entry specifying the ABI version. See
|
||||
* http://www.netbsd.org/Documentation/kernel/elf-notes.html
|
||||
* for more information.
|
||||
*/
|
||||
static const struct {
|
||||
int32_t namesz;
|
||||
int32_t descsz;
|
||||
int32_t type;
|
||||
char name[sizeof ABI_VENDOR];
|
||||
int32_t desc;
|
||||
} abitag __attribute__ ((section (ABI_SECTION))) = {
|
||||
sizeof ABI_VENDOR,
|
||||
sizeof(int32_t),
|
||||
ABI_NOTETYPE,
|
||||
ABI_VENDOR,
|
||||
__FreeBSD_version
|
||||
};
|
@ -2,11 +2,11 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
SRCS= crt1.c crtbegin.c crtend.c crti.S crtn.S
|
||||
SRCS= crt1.c crti.S crtn.S
|
||||
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
|
||||
OBJS+= gcrt1.o
|
||||
SOBJS= crtbegin.So crtend.So
|
||||
CFLAGS+= -elf -Wall -fkeep-inline-functions
|
||||
CFLAGS+= -elf -Wall -fkeep-inline-functions \
|
||||
-I${.CURDIR}/../common
|
||||
LDFLAGS+= -elf
|
||||
NOMAN= true
|
||||
NOPIC= true
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "crtbrand.c"
|
||||
|
||||
typedef void (*fptr)(void);
|
||||
|
||||
|
@ -25,7 +25,14 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is not used any more. It will go away as soon as the gcc
|
||||
* linker specs have been updated accordingly.
|
||||
*/
|
||||
.section .init,"ax",@progbits
|
||||
.align 4
|
||||
.globl _init
|
||||
.type _init,@function
|
||||
_init:
|
||||
|
||||
.section .fini,"ax",@progbits
|
||||
.align 4
|
||||
.globl _fini
|
||||
.type _fini,@function
|
||||
_fini:
|
||||
|
@ -25,7 +25,8 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is not used any more. It will go away as soon as the gcc
|
||||
* linker specs have been updated accordingly.
|
||||
*/
|
||||
.section .init,"ax",@progbits
|
||||
ret
|
||||
|
||||
.section .fini,"ax",@progbits
|
||||
ret
|
||||
|
@ -7,6 +7,7 @@ OBJS= crt1.o crtbegin.o crtend.o
|
||||
OBJS+= gcrt1.o
|
||||
SOBJS= crtbegin.So crtend.So
|
||||
CFLAGS+= -Wall -Wno-unused
|
||||
CFLAGS+= -I${.CURDIR}/../common
|
||||
NOMAN= true
|
||||
NOPIC= true
|
||||
NOPROFILE= true
|
||||
|
@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "crtbrand.c"
|
||||
|
||||
struct Struct_Obj_Entry;
|
||||
struct ps_strings;
|
||||
|
Loading…
Reference in New Issue
Block a user