if LD32DIR is defined:

- look in src/compat/lib/libc for libc_pic.
- define RTLD_ARCH_SUBDIR to "i386" or "sparc" for amd64 and sparc64
  builds, respectively
if RTLD_ARCH_SUBDIR is defined, add this path before
RTLD_DEFAULT_LIBRARY_PATH in the default search path.
This commit is contained in:
mrg 2008-10-26 07:11:54 +00:00
parent e365204b08
commit 8679e33545
4 changed files with 27 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.86 2008/10/16 14:36:20 christos Exp $
# $NetBSD: Makefile,v 1.87 2008/10/26 07:11:54 mrg Exp $
# We are not building this with PIE
PIE_CFLAGS=
@ -6,7 +6,12 @@ PIE_LDFLAGS=
.include <bsd.init.mk> # for OBJECT_FMT definition
.include <bsd.shlib.mk> # for SHLINKINSTALLDIR definition
.if defined(LDELFSO_MACHINE_CPU) && !empty(LDELFSO_MACHINE_CPU) && \
exists(${.CURDIR}/arch/${LDELFSO_MACHINE_CPU})
ARCHSUBDIR= ${LDELFSO_MACHINE_CPU}
.else
ARCHSUBDIR= ${MACHINE_CPU}
.endif
M= ${.CURDIR}/arch/${ARCHSUBDIR}
.if ((${MACHINE_ARCH} == "alpha") || \
@ -23,7 +28,7 @@ M= ${.CURDIR}/arch/${ARCHSUBDIR}
(${MACHINE_ARCH} == "vax")) && \
${OBJECT_FMT} == "ELF" && ${MKPIC} != "no"
PROG= ld.elf_so
PROG?= ld.elf_so
LDFLAGS+= -shared -symbolic -nostartfiles
LDFLAGS+= -Wl,-static
@ -34,7 +39,12 @@ LDFLAGS+= -Wl,-static
.include "$M/Makefile.inc"
.endif
# Support src/compat/libexec/ld.elf_so.
.if defined(LD32DIR)
CLIBOBJ!= cd ${NETBSDSRCDIR}/compat/lib/libc && ${PRINTOBJDIR}
.else
CLIBOBJ!= cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR}
.endif
SRCS+= rtld.c reloc.c symbol.c xmalloc.c xprintf.c debug.c \
map_object.c load.c search.c headers.c paths.c expand.c

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.10 2005/06/04 16:17:17 lukem Exp $
# $NetBSD: Makefile.inc,v 1.11 2008/10/26 07:11:54 mrg Exp $
SRCS+= rtld_start.S mdreloc.c
@ -6,5 +6,8 @@ SRCS+= rtld_start.S mdreloc.c
CPPFLAGS+= -fpic
CPPFLAGS+= -DELFSIZE=32
.if defined(LD32DIR)
CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"i386\"
.endif
LDFLAGS+= -Wl,-e,.rtld_start

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.10 2005/06/04 16:17:17 lukem Exp $
# $NetBSD: Makefile.inc,v 1.11 2008/10/26 07:11:54 mrg Exp $
SRCS+= rtld_start.S mdreloc.c
@ -6,5 +6,8 @@ SRCS+= rtld_start.S mdreloc.c
CPPFLAGS+= -fpic
CPPFLAGS+= -DELFSIZE=32
.if defined(LD32DIR)
CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"sparc\"
.endif
LDFLAGS+= -Wl,-e,_rtld_start

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtld.c,v 1.122 2008/10/04 09:37:12 skrll Exp $ */
/* $NetBSD: rtld.c,v 1.123 2008/10/26 07:11:54 mrg Exp $ */
/*
* Copyright 1996 John D. Polstra.
@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: rtld.c,v 1.122 2008/10/04 09:37:12 skrll Exp $");
__RCSID("$NetBSD: rtld.c,v 1.123 2008/10/26 07:11:54 mrg Exp $");
#endif /* not lint */
#include <err.h>
@ -256,6 +256,11 @@ _rtld_init(caddr_t mapbase, caddr_t relocbase, const char *execname)
_rtld_add_paths(execname, &_rtld_default_paths,
RTLD_DEFAULT_LIBRARY_PATH);
#ifdef RTLD_ARCH_SUBDIR
_rtld_add_paths(execname, &_rtld_default_paths,
RTLD_DEFAULT_LIBRARY_PATH "/" RTLD_ARCH_SUBDIR);
#endif
/*
* Set up the _rtld_objlist pointer, so that rtld symbols can be found.
*/