Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ldd - adjust the logic for compat ldd: add an elf32_...
details: https://anonhg.NetBSD.org/src/rev/7ebf09718fa1
branches: trunk
changeset: 749935:7ebf09718fa1
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Dec 13 08:50:56 2009 +0000
description:
- adjust the logic for compat ldd: add an elf32_compat module and arrange
for mips64 to build this with MLIBDIR set to o32
- make mips64 ldd call elf32_compat_ldd as well
- make mips64 elf64 set MLIBDIR to 64
- don't need ld.elf_so's Makefile.ld32 files anymore (they are going away
soon anyway)
tested on amd64 and sparc64, and an earlier version tested on mips64.
diffstat:
usr.bin/ldd/Makefile | 10 ++++++++--
usr.bin/ldd/Makefile.inc | 20 +++++++++++++++++++-
usr.bin/ldd/elf32/Makefile | 12 +++++-------
usr.bin/ldd/elf32_compat/Makefile | 24 ++++++++++++++++++++++++
usr.bin/ldd/elf64/Makefile | 9 +++++++--
usr.bin/ldd/ldd.c | 7 +++++--
usr.bin/ldd/ldd.h | 4 +++-
7 files changed, 71 insertions(+), 15 deletions(-)
diffs (187 lines):
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/Makefile
--- a/usr.bin/ldd/Makefile Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/Makefile Sun Dec 13 08:50:56 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2009/08/22 06:52:16 mrg Exp $
+# $NetBSD: Makefile,v 1.14 2009/12/13 08:50:56 mrg Exp $
WARNS?= 3 # XXX: -Wsign-compare issues ld.elf_so source
@@ -16,8 +16,14 @@
EXTRA_LIBS+= ${LIB_ELF32DIR}/libldd_elf32.a
.endif
+.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
+LIB_ELF32COMPATDIR!= cd ${.CURDIR}/elf32_compat && ${PRINTOBJDIR}
+EXTRA_LIBS+= ${LIB_ELF32COMPATDIR}/libldd_elf32_compat.a
+.endif
+
.if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "sparc64") || \
- (${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64")
+ (${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64") || \
+ (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
LIB_ELF64DIR!= cd ${.CURDIR}/elf64 && ${PRINTOBJDIR}
EXTRA_LIBS+= ${LIB_ELF64DIR}/libldd_elf64.a
CPPFLAGS.ldd.c= -DELFSIZE=64
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/Makefile.inc
--- a/usr.bin/ldd/Makefile.inc Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/Makefile.inc Sun Dec 13 08:50:56 2009 +0000
@@ -1,7 +1,25 @@
-# $NetBSD: Makefile.inc,v 1.2 2009/04/14 22:15:22 lukem Exp $
+# $NetBSD: Makefile.inc,v 1.3 2009/12/13 08:50:56 mrg Exp $
WARNS?= 3 # XXX: -Wsign-compare issues ld.elf_so source
+.if ${MACHINE_ARCH} == "sparc64"
+MLIBDIR= sparc
+.endif
+
+.if ${MACHINE_ARCH} == "x86_64"
+MLIBDIR= i386
+.endif
+
+.if ${MACHINE_ARCH} == "powerpc64"
+MLIBDIR= powerpc
+.endif
+
+# For now make "elf32" look for native (n32)
+.if (${MACHINE_ARCH} == "mips64eb") || (${MACHINE_ARCH} == "mips64el")
+MLIBDIR= 64
+COMPAT_MLIBDIR= o32
+.endif
+
.if exists(${.CURDIR}/../../Makefile.inc)
.include "${.CURDIR}/../../Makefile.inc"
.endif
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/elf32/Makefile
--- a/usr.bin/ldd/elf32/Makefile Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/elf32/Makefile Sun Dec 13 08:50:56 2009 +0000
@@ -1,6 +1,8 @@
-# $NetBSD: Makefile,v 1.6 2009/02/14 13:56:41 abs Exp $
+# $NetBSD: Makefile,v 1.7 2009/12/13 08:50:56 mrg Exp $
.include <bsd.own.mk>
+.include <bsd.init.mk>
+
CPPFLAGS+= -DELFSIZE=32
LIB= ldd_elf32
@@ -10,12 +12,8 @@
LIBISPRIVATE= yes
.PATH: ${.CURDIR}/..
-# XXX
-.include <bsd.own.mk>
-.if ${MACHINE_ARCH} == "sparc64"
-.include "${NETBSDSRCDIR}/libexec/ld.elf_so/arch/sparc/Makefile.ld32"
-.elif ${MACHINE_ARCH} == "x86_64"
-.include "${NETBSDSRCDIR}/libexec/ld.elf_so/arch/i386/Makefile.ld32"
+.ifdef MLIBDIR
+CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
.endif
.if ${MACHINE_ARCH} != "alpha"
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/elf32_compat/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/ldd/elf32_compat/Makefile Sun Dec 13 08:50:56 2009 +0000
@@ -0,0 +1,24 @@
+# $NetBSD: Makefile,v 1.1 2009/12/13 08:50:56 mrg Exp $
+
+.include <bsd.own.mk>
+.include <bsd.init.mk>
+
+CPPFLAGS+= -DELFSIZE=32 -DELF32_COMPAT
+LIB= ldd_elf32_compat
+
+# XXX Force one member
+SRCS= dummy.c
+
+LIBISPRIVATE= yes
+.PATH: ${.CURDIR}/..
+
+.ifdef COMPAT_MLIBDIR
+MLIBDIR= ${COMPAT_MLIBDIR}
+CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
+.endif
+
+.ifdef MLIBDIR
+.include "../Makefile.elf"
+.endif
+
+.include <bsd.lib.mk>
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/elf64/Makefile
--- a/usr.bin/ldd/elf64/Makefile Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/elf64/Makefile Sun Dec 13 08:50:56 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2009/01/11 05:01:34 christos Exp $
+# $NetBSD: Makefile,v 1.5 2009/12/13 08:50:57 mrg Exp $
.include <bsd.own.mk>
@@ -12,7 +12,8 @@
.PATH: ${.CURDIR}/..
.if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "sparc64") || \
- (${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64")
+ (${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64") || \
+ (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
# XXX we need to make sure that we don't accidentally get the elf32
# XXX versions of these.
@@ -35,6 +36,10 @@
CPPFLAGS+= -D${_d}=_elf64_${_d}
.endfor
+.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
+CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
+.endif
+
.include "../Makefile.elf"
.endif
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/ldd.c
--- a/usr.bin/ldd/ldd.c Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/ldd.c Sun Dec 13 08:50:56 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.c,v 1.11 2009/11/17 18:44:33 skrll Exp $ */
+/* $NetBSD: ldd.c,v 1.12 2009/12/13 08:50:56 mrg Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ldd.c,v 1.11 2009/11/17 18:44:33 skrll Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.12 2009/12/13 08:50:56 mrg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -160,6 +160,9 @@
/* Alpha never had 32 bit support. */
#if defined(_LP64) && !defined(__alpha__)
&& elf32_ldd(fd, *argv, fmt1, fmt2) == -1
+#ifdef __mips__
+ && elf32_ldd_compat(fd, *argv, fmt1, fmt2) == -1
+#endif
#endif
)
warnx("%s", error_message);
diff -r 40db6d5b9fbe -r 7ebf09718fa1 usr.bin/ldd/ldd.h
--- a/usr.bin/ldd/ldd.h Sun Dec 13 08:37:40 2009 +0000
+++ b/usr.bin/ldd/ldd.h Sun Dec 13 08:50:56 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.h,v 1.4 2009/09/07 04:49:03 dholland Exp $ */
+/* $NetBSD: ldd.h,v 1.5 2009/12/13 08:50:56 mrg Exp $ */
/*
* Copyright (c) 2008 Matthew R. Green
@@ -33,6 +33,8 @@
#ifdef _LP64
int elf64_ldd(int, char *, const char *, const char *);
#define elf_ldd elf64_ldd
+#elif defined(ELF32_COMPAT)
+#define elf_ldd elf32_compat_ldd
#else
#define elf_ldd elf32_ldd
#endif
Home |
Main Index |
Thread Index |
Old Index