Module Name: src
Committed By: mrg
Date: Sun Dec 13 08:50:57 UTC 2009
Modified Files:
src/usr.bin/ldd: Makefile Makefile.inc ldd.c ldd.h
src/usr.bin/ldd/elf32: Makefile
src/usr.bin/ldd/elf64: Makefile
Added Files:
src/usr.bin/ldd/elf32_compat: Makefile
Log Message:
- 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.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/ldd/Makefile
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/ldd/Makefile.inc
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/ldd/ldd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/ldd/ldd.h
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/ldd/elf32/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/ldd/elf32_compat/Makefile
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/ldd/elf64/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ldd/Makefile
diff -u src/usr.bin/ldd/Makefile:1.13 src/usr.bin/ldd/Makefile:1.14
--- src/usr.bin/ldd/Makefile:1.13 Sat Aug 22 06:52:16 2009
+++ src/usr.bin/ldd/Makefile Sun Dec 13 08:50:56 2009
@@ -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
Index: src/usr.bin/ldd/Makefile.inc
diff -u src/usr.bin/ldd/Makefile.inc:1.2 src/usr.bin/ldd/Makefile.inc:1.3
--- src/usr.bin/ldd/Makefile.inc:1.2 Tue Apr 14 22:15:22 2009
+++ src/usr.bin/ldd/Makefile.inc Sun Dec 13 08:50:56 2009
@@ -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
Index: src/usr.bin/ldd/ldd.c
diff -u src/usr.bin/ldd/ldd.c:1.11 src/usr.bin/ldd/ldd.c:1.12
--- src/usr.bin/ldd/ldd.c:1.11 Tue Nov 17 18:44:33 2009
+++ src/usr.bin/ldd/ldd.c Sun Dec 13 08:50:56 2009
@@ -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);
Index: src/usr.bin/ldd/ldd.h
diff -u src/usr.bin/ldd/ldd.h:1.4 src/usr.bin/ldd/ldd.h:1.5
--- src/usr.bin/ldd/ldd.h:1.4 Mon Sep 7 04:49:03 2009
+++ src/usr.bin/ldd/ldd.h Sun Dec 13 08:50:56 2009
@@ -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
Index: src/usr.bin/ldd/elf32/Makefile
diff -u src/usr.bin/ldd/elf32/Makefile:1.6 src/usr.bin/ldd/elf32/Makefile:1.7
--- src/usr.bin/ldd/elf32/Makefile:1.6 Sat Feb 14 13:56:41 2009
+++ src/usr.bin/ldd/elf32/Makefile Sun Dec 13 08:50:56 2009
@@ -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"
Index: src/usr.bin/ldd/elf64/Makefile
diff -u src/usr.bin/ldd/elf64/Makefile:1.4 src/usr.bin/ldd/elf64/Makefile:1.5
--- src/usr.bin/ldd/elf64/Makefile:1.4 Sun Jan 11 05:01:34 2009
+++ src/usr.bin/ldd/elf64/Makefile Sun Dec 13 08:50:57 2009
@@ -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
Added files:
Index: src/usr.bin/ldd/elf32_compat/Makefile
diff -u /dev/null src/usr.bin/ldd/elf32_compat/Makefile:1.1
--- /dev/null Sun Dec 13 08:50:57 2009
+++ src/usr.bin/ldd/elf32_compat/Makefile Sun Dec 13 08:50:56 2009
@@ -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>