Make it a tad bit easier to bootstrap an a.out system to ELF. Introduce

a BOOTSTRAP_ELF Makefile variable that, when set (e.g. in the environment),
builds a targeted-to-ELF toolchain without requiring OBJECT_FMT to be set
to "ELF" (which affects how e.g. libraries are built).

This basically means you don't need fake crtbegin.o and crtend.o files to
be present in /usr/lib while bootstrapping the toolchain.
This commit is contained in:
thorpej 1999-03-17 00:46:35 +00:00
parent 84c33581df
commit 6d2943920a
6 changed files with 39 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 1999/03/07 10:43:59 ragge Exp $
# $NetBSD: Makefile,v 1.9 1999/03/17 00:46:35 thorpej Exp $
LIB= bfd
@ -7,9 +7,13 @@ MKMAN= no
MKPROFILE= no
MKLINKLIB= no
# for MKPIC, BFD_SLIM, BFD_UNIFIED
# for MKPIC, BFD_SLIM, BFD_UNIFIED, OBJECT_FMT
.include <bsd.own.mk>
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
ELF_PLEASE=
.endif
# XXX BFD_UNIFIED should go away if benchmarking shows minor to no difference
.if ${MKPIC} == "no" || !defined(BFD_UNIFIED)
BFD_SLIM=
@ -89,9 +93,15 @@ SRCS+= cpu-arm.c aout-arm32.c armnetbsd.c arm-dis.c
.if (${MACHINE_ARCH} == "i386" || !defined(BFD_SLIM))
ARCHES+= i386
.if defined(ELF_PLEASE)
DEFAULT_VEC.i386= bfd_elf32_i386_vec
SELECT_VECS+= ${DEFAULT_VEC.i386} i386netbsd_vec i386bsd_vec \
i386freebsd_vec i386coff_vec
.else
DEFAULT_VEC.i386= i386netbsd_vec
SELECT_VECS+= ${DEFAULT_VEC.i386} bfd_elf32_i386_vec i386bsd_vec \
i386freebsd_vec i386coff_vec
.endif
SRCS+= cpu-i386.c i386bsd.c i386freebsd.c i386netbsd.c \
coff-i386.c elf32-i386.c i386-dis.c \
aout32.c cofflink.c elf32.c elf.c elflink.c dwarf2.c
@ -148,9 +158,15 @@ SRCS+= cpu-powerpc.c elf32-ppc.c ppc-dis.c ppc-opc.c \
.if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64" || \
!defined(BFD_SLIM))
ARCHES+= sparc
.if (${MACHINE_ARCH} == "sparc") && defined(ELF_PLEASE)
DEFAULT_VEC.sparc= bfd_elf32_sparc_vec
SELECT_VECS+= ${DEFAULT_VEC.sparc} ${DEFAULT_VEC.sparc64} \
sunos_big_vec sparcnetbsd_vec
.else
DEFAULT_VEC.sparc= sparcnetbsd_vec
SELECT_VECS+= ${DEFAULT_VEC.sparc} ${DEFAULT_VEC.sparc64} \
sunos_big_vec bfd_elf32_sparc_vec
.endif
SRCS+= cpu-sparc.c sparcnetbsd.c sunos.c elf32-sparc.c \
sparc-dis.c sparc-opc.c \
aout32.c elf32.c elf.c elflink.c dwarf2.c

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.18 1999/02/24 17:48:42 drochner Exp $
# $NetBSD: Makefile.inc,v 1.19 1999/03/17 00:46:35 thorpej Exp $
.if !defined(GCC_MAKEFILE_INC)
GCC_MAKEFILE_INC=1
@ -34,7 +34,7 @@ CPPFLAGS+= -I${.CURDIR}/../arch \
-I${DIST}/config \
-DIN_GCC -DNETBSD_NATIVE
.if (${OBJECT_FMT} == "ELF")
.if (${OBJECT_FMT} == "ELF" || defined(BOOTSTRAP_ELF))
CPPFLAGS+=-DDEFAULT_ELF
.endif

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.5 1999/02/04 23:25:08 tv Exp $
# $NetBSD: Makefile.inc,v 1.6 1999/03/17 00:46:35 thorpej Exp $
TARG_CPU_C= tc-i386.c
.if (${OBJECT_FMT} == "ELF")
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
OBJ_FORMAT_C= obj-elf.c
CPPFLAGS+=-DDEFAULT_ELF
.else

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.3 1999/02/04 23:25:08 tv Exp $
# $NetBSD: Makefile.inc,v 1.4 1999/03/17 00:46:35 thorpej Exp $
TARG_CPU_C= tc-sparc.c
.if (${OBJECT_FMT} == "ELF")
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
OBJ_FORMAT_C= obj-elf.c
CPPFLAGS+=-DDEFAULT_ELF
.else

View File

@ -1,8 +1,12 @@
# $NetBSD: Makefile,v 1.29 1999/03/13 10:57:38 drochner Exp $
# $NetBSD: Makefile,v 1.30 1999/03/17 00:46:35 thorpej Exp $
# for OBJECT_FMT
.include <bsd.own.mk>
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
ELF_PLEASE=
.endif
PROG= gdb
MAN= gdb.1
SRCS= main.c ${COMMON_SRCS} annotate.c inflow.c gnu-regex.c
@ -14,7 +18,7 @@ CPPFLAGS+= -I. -I${.CURDIR} -I${DIST}/gdb/config -I${DIST}/gdb \
-I${BFDOBJ} -I${DIST}/bfd -I${DIST}/include \
-DHOST_NAME=\"${MACHINE_GNU_ARCH}--netbsd\" \
-DTARGET_NAME=\"${MACHINE_GNU_ARCH}--netbsd\"
.if (${OBJECT_FMT} == "ELF")
.if defined(ELF_PLEASE)
CPPFLAGS+= -DSVR4_SHARED_LIBS
.endif

View File

@ -1,14 +1,18 @@
# $NetBSD: Makefile,v 1.10 1999/03/05 07:25:00 mycroft Exp $
# $NetBSD: Makefile,v 1.11 1999/03/17 00:46:36 thorpej Exp $
# for OBJECT_FMT
.include <bsd.own.mk>
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
ELF_PLEASE=
.endif
.if (${MACHINE_ARCH} == "alpha") || \
(${MACHINE_ARCH} == "i386" && ${OBJECT_FMT} == "ELF") || \
(${MACHINE_ARCH} == "i386" && defined(ELF_PLEASE)) || \
(${MACHINE_ARCH} == "mipseb") || \
(${MACHINE_ARCH} == "mipsel") || \
(${MACHINE_ARCH} == "powerpc") || \
(${MACHINE_ARCH} == "sparc" && ${OBJECT_FMT} == "ELF") || \
(${MACHINE_ARCH} == "sparc" && defined(ELF_PLEASE)) || \
(${MACHINE_ARCH} == "sparc64")
PROG= ld
MAN= ld.1
@ -41,7 +45,7 @@ DEFAULT_EMUL.alpha= elf64alpha
##### i386 #####
EMULS.i386= i386nbsd elf_i386
.if ${OBJECT_FMT} == "ELF"
.if defined(ELF_PLEASE)
DEFAULT_EMUL.i386= elf_i386
.else
DEFAULT_EMUL.i386= i386nbsd
@ -61,7 +65,7 @@ DEFAULT_EMUL.powerpc= elf32ppc
##### sparc #####
EMULS.sparc= sparcnbsd elf32_sparc sun4
.if ${OBJECT_FMT} == "ELF"
.if defined(ELF_PLEASE)
DEFAULT_EMUL.sparc= elf32_sparc
.else
DEFAULT_EMUL.sparc= sparcnbsd