MKDYNAMICROOT for a.out

This commit is contained in:
itohy 2002-11-12 14:33:48 +00:00
parent 5b3e8cb3f2
commit cbb1f0fb0f
7 changed files with 61 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.188 2002/09/21 08:19:28 lukem Exp $
# $NetBSD: Makefile,v 1.189 2002/11/12 14:33:48 itohy Exp $
# This is the top-level makefile for building NetBSD. For an outline of
# how to build a snapshot or release, as well as other release engineering
@ -51,7 +51,7 @@
# do-lib-libc: builds and installs prerequisites from lib/libc.
# do-lib: builds and installs prerequisites from lib.
# do-gnu-lib: builds and installs prerequisites from gnu/lib.
# do-ld.elf_so: builds and installs prerequisites from libexec/ld.elf_so
# do-ld.so: builds and installs prerequisites from libexec/ld.*_so.
# do-build: builds and installs the entire system.
.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
@ -140,7 +140,7 @@ BUILDTARGETS+= do-distrib-dirs
.if !defined(NOINCLUDES)
BUILDTARGETS+= includes
.endif
BUILDTARGETS+= do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so do-build
BUILDTARGETS+= do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.so do-build
# Enforce proper ordering of some rules.
@ -208,9 +208,14 @@ do-${dir:S/\//-/}:
.endfor
.endfor
do-ld.elf_so:
do-ld.so:
.for targ in dependall install
.if (${OBJECT_FMT} == "a.out")
(cd ${.CURDIR}/libexec/ld.aout_so && ${MAKE} ${targ})
.endif
.if (${OBJECT_FMT} == "ELF")
(cd ${.CURDIR}/libexec/ld.elf_so && ${MAKE} ${targ})
.endif
.endfor
do-build:

View File

@ -1,10 +1,17 @@
# $NetBSD: Makefile.inc,v 1.5 2001/06/07 15:22:49 mrg Exp $
# $NetBSD: Makefile.inc,v 1.6 2002/11/12 14:33:49 itohy Exp $
# from: @(#)Makefile 5.5 (Berkeley) 5/21/91
CPPFLAGS+= -DLIBC_SCCS -I${.CURDIR}/../common_aout
OBJS+= crt0.o gcrt0.o scrt0.o
SRCS= crt0.c
.include <bsd.own.mk>
.include <bsd.shlib.mk>
.if ${SHLINKINSTALLDIR} != "/usr/libexec"
OBJS+= lcrt0.o
.endif
realall: ${OBJS}
crt0.o: ${SRCS}
@ -25,6 +32,13 @@ scrt0.o: ${SRCS}
@${LD} -x -r -o ${.TARGET} ${.TARGET}.o
@rm -f ${.TARGET}.o
# same as crt0.o modulo the dynamic linker is in /libexec
lcrt0.o: ${SRCS}
@echo "${COMPILE.c} -DCRT0 -DDYNAMIC -DLDSO=\"${SHLINKINSTALLDIR}/ld.so\" ${.CURDIR}/${SRCS} -o ${.TARGET}"
@${COMPILE.c} -DCRT0 -DDYNAMIC -DLDSO=\"${SHLINKINSTALLDIR}/ld.so\" ${.CURDIR}/${SRCS} -o ${.TARGET}.o
@${LD} -x -r -o ${.TARGET} ${.TARGET}.o
@rm -f ${.TARGET}.o
.if make(depend)
CPPFLAGS+= -DDYNAMIC
.endif
@ -38,4 +52,7 @@ afterdepend: .depend
FILES=${OBJS}
FILESDIR=${LIBDIR}
FILESDIR_lcrt0.o:=${SHLIBINSTALLDIR}
FILESNAME_lcrt0.o:=crt0.o
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.c,v 1.17 2000/02/09 22:41:54 kristerw Exp $ */
/* $NetBSD: common.c,v 1.18 2002/11/12 14:33:49 itohy Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -138,7 +138,11 @@ __load_rtld(dp)
entry = (rtld_entry_fn)(crt.crt_ba + sizeof hdr);
if ((*entry)(CRT_VERSION_BSD_4, &crt) == -1) {
/* Feeble attempt to deal with out-dated ld.so */
# define str "crt0: update /usr/libexec/ld.so\n"
#ifdef __STDC__
# define str "crt0: update " LDSO "\n"
#else
# define str "crt0: update ld.so\n"
#endif
(void)write(2, str, sizeof(str)-1);
# undef str
if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.h,v 1.12 2002/11/12 14:26:10 itohy Exp $ */
/* $NetBSD: common.h,v 1.13 2002/11/12 14:33:49 itohy Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -71,8 +71,10 @@ static int _strncmp __P((char *, char *, int));
#define LDSO "/usr/lib/ld.so"
#endif
#ifdef __NetBSD__
#ifndef LDSO
#define LDSO "/usr/libexec/ld.so"
#endif
#endif
/*
* We need these system calls, but can't use library stubs

View File

@ -1,9 +1,12 @@
# $NetBSD: Makefile,v 1.39 2002/08/19 13:54:36 lukem Exp $
# $NetBSD: Makefile,v 1.40 2002/11/12 14:33:49 itohy Exp $
.include <bsd.own.mk>
.include <bsd.own.mk> # for OBJECT_FMT definition
.include <bsd.shlib.mk> # for SHLINKINSTALLDIR definition
.if (${OBJECT_FMT} == "a.out")
PROG= ld.so
SRCS= mdprologue.S rtld.c malloc.c shlib.c md.c vfprintf.c
BINDIR= ${SHLINKINSTALLDIR}
CLIB= ${NETBSDSRCDIR}/lib/libc
CLIBOBJ!=cd ${CLIB} && ${PRINTOBJDIR}
PICFLAG=-fpic -fno-function-cse
@ -12,6 +15,9 @@ CPPFLAGS+=$(PICFLAG) -DRTLD -DLIBC_SCCS \
.if defined(DEBUG)
CPPFLAGS+=-DDEBUG
.endif
.if ${SHLIBINSTALLDIR} != ${LIBDIR}
CPPFLAGS+=-DSTANDARD_SEARCH_DIRS=\"${SHLIBINSTALLDIR}\",\"${LIBDIR}\"
.endif
ASFLAGS+=-k
LDFLAGS+=-Bshareable -Bsymbolic -assert nosymbolic -L${CLIBOBJ}
.if defined(DESTDIR)
@ -27,6 +33,11 @@ $(PROG):
.S.o:
${CPP} ${.IMPSRC} | ${AS} ${ASFLAGS} -o ${.TARGET} -
.if ${SHLINKINSTALLDIR} != "/usr/libexec"
SYMLINKS+= ${SHLINKINSTALLDIR}/${PROG} /usr/libexec/${PROG}
.endif
.elif (${OBJECT_FMT} == "ELF" && \
(${MACHINE_ARCH} == "arm" || \
${MACHINE_ARCH} == "i386" || \

View File

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.20 2002/08/19 10:16:54 lukem Exp $
# $NetBSD: Makefile,v 1.21 2002/11/12 14:33:49 itohy Exp $
.include <bsd.own.mk> # For OBJECT_FMT
.include <bsd.shlib.mk>
.if (${OBJECT_FMT} == "a.out" || \
(${OBJECT_FMT} == "ELF" && \
@ -16,6 +17,10 @@ SRCS= ldconfig.c shlib.c
CPPFLAGS += -I${NETBSDSRCDIR}/libexec/ld.aout_so
.PATH: ${NETBSDSRCDIR}/libexec/ld.aout_so
.if ${SHLIBINSTALLDIR} != ${LIBDIR}
CPPFLAGS+=-DSTANDARD_SEARCH_DIRS=\"${SHLIBINSTALLDIR}\",\"${LIBDIR}\"
.endif
.endif
MAN= ldconfig.8

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.prog.mk,v 1.160 2002/10/22 18:48:29 perry Exp $
# $NetBSD: bsd.prog.mk,v 1.161 2002/11/12 14:33:49 itohy Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.include <bsd.init.mk>
@ -105,8 +105,13 @@ LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
_PROGLDOPTS=
.if ${SHLINKDIR} != "/usr/libexec" # XXX: change or remove if ld.so moves
.if ${OBJECT_FMT} == "ELF"
_PROGLDOPTS+= -Wl,-dynamic-linker=${_SHLINKER}
.endif
.if ${OBJECT_FMT} == "a.out"
LIBCRT0= ${DESTDIR}/lib/crt0.o
.endif
.endif
.if ${SHLIBDIR} != ${LIBDIR}
_PROGLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
-Wl,-rpath,${SHLIBDIR}:/usr/lib \