Module Name: src
Committed By: mrg
Date: Wed Dec 23 03:14:47 UTC 2009
Modified Files:
src/usr.bin/ldd [matt-nb5-mips64]: Makefile Makefile.inc ldd.c ldd.h
src/usr.bin/ldd/elf64 [matt-nb5-mips64]: Makefile
Added Files:
src/usr.bin/ldd/elf32_compat [matt-nb5-mips64]: Makefile
Log Message:
pull across from -current:
> 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.
> Log Message:
> make this actually build on mips64.
To generate a diff of this commit:
cvs rdiff -u -r1.7.52.1.4.2 -r1.7.52.1.4.3 src/usr.bin/ldd/Makefile
cvs rdiff -u -r1.1 -r1.1.58.1 src/usr.bin/ldd/Makefile.inc
cvs rdiff -u -r1.2.12.2 -r1.2.12.2.4.1 src/usr.bin/ldd/ldd.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.3.4.1 src/usr.bin/ldd/ldd.h
cvs rdiff -u -r0 -r1.1.2.2 src/usr.bin/ldd/elf32_compat/Makefile
cvs rdiff -u -r1.4.2.2.4.2 -r1.4.2.2.4.3 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.7.52.1.4.2 src/usr.bin/ldd/Makefile:1.7.52.1.4.3
--- src/usr.bin/ldd/Makefile:1.7.52.1.4.2 Sat Sep 5 18:53:57 2009
+++ src/usr.bin/ldd/Makefile Wed Dec 23 03:14:47 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7.52.1.4.2 2009/09/05 18:53:57 matt Exp $
+# $NetBSD: Makefile,v 1.7.52.1.4.3 2009/12/23 03:14:47 mrg Exp $
.include <bsd.own.mk> # for MKDYNAMICROOT definition
@@ -6,7 +6,8 @@
SRCS= ldd.c
MAN= ldd.1
-SUBDIR= aout elf32 elf64
+SUBDIR= aout elf32 elf64 elf32_compat
+
LIB_AOUTDIR!= cd ${.CURDIR}/aout && ${PRINTOBJDIR}
EXTRA_LIBS+= ${LIB_AOUTDIR}/libldd_aout.a
@@ -15,13 +16,14 @@
EXTRA_LIBS+= ${LIB_ELF32DIR}/libldd_elf32.a
.endif
-.if (${MACHINE_ARCH} == "mips64eb") || (${MACHINE_ARCH} == "mips64el")
-ABI64:= ${CPUFLAGS:M-mabi=64:M-mabi=o64}
+.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:Mmips64*} != "") && !empty(ABI64))
+ (${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.1 src/usr.bin/ldd/Makefile.inc:1.1.58.1
--- src/usr.bin/ldd/Makefile.inc:1.1 Tue Dec 15 22:07:11 1998
+++ src/usr.bin/ldd/Makefile.inc Wed Dec 23 03:14:47 2009
@@ -1,4 +1,23 @@
-# $NetBSD: Makefile.inc,v 1.1 1998/12/15 22:07:11 pk Exp $
+# $NetBSD: Makefile.inc,v 1.1.58.1 2009/12/23 03:14:47 mrg Exp $
+
+.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
+CPPFLAGS+= -DLDD_ELF64
+.endif
.if exists(${.CURDIR}/../../Makefile.inc)
.include "${.CURDIR}/../../Makefile.inc"
Index: src/usr.bin/ldd/ldd.c
diff -u src/usr.bin/ldd/ldd.c:1.2.12.2 src/usr.bin/ldd/ldd.c:1.2.12.2.4.1
--- src/usr.bin/ldd/ldd.c:1.2.12.2 Wed Feb 25 03:09:31 2009
+++ src/usr.bin/ldd/ldd.c Wed Dec 23 03:14:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.c,v 1.2.12.2 2009/02/25 03:09:31 snj Exp $ */
+/* $NetBSD: ldd.c,v 1.2.12.2.4.1 2009/12/23 03:14:47 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.2.12.2 2009/02/25 03:09:31 snj Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.2.12.2.4.1 2009/12/23 03:14:47 mrg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -156,6 +156,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
aout_ldd(fd, *argv, fmt1, fmt2) == -1)
warnx("%s", error_message);
Index: src/usr.bin/ldd/ldd.h
diff -u src/usr.bin/ldd/ldd.h:1.1.2.3 src/usr.bin/ldd/ldd.h:1.1.2.3.4.1
--- src/usr.bin/ldd/ldd.h:1.1.2.3 Wed Feb 25 03:09:31 2009
+++ src/usr.bin/ldd/ldd.h Wed Dec 23 03:14:47 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.h,v 1.1.2.3 2009/02/25 03:09:31 snj Exp $ */
+/* $NetBSD: ldd.h,v 1.1.2.3.4.1 2009/12/23 03:14:47 mrg Exp $ */
/*
* Copyright (c) 2008 Matthew R. Green
@@ -32,8 +32,14 @@
int elf32_ldd(int, char *, char *, char *);
#ifdef _LP64
+#define LDD_ELF64
+#endif
+
+#ifdef LDD_ELF64
int elf64_ldd(int, char *, char *, 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/elf64/Makefile
diff -u src/usr.bin/ldd/elf64/Makefile:1.4.2.2.4.2 src/usr.bin/ldd/elf64/Makefile:1.4.2.2.4.3
--- src/usr.bin/ldd/elf64/Makefile:1.4.2.2.4.2 Sat Sep 5 18:53:58 2009
+++ src/usr.bin/ldd/elf64/Makefile Wed Dec 23 03:14:47 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4.2.2.4.2 2009/09/05 18:53:58 matt Exp $
+# $NetBSD: Makefile,v 1.4.2.2.4.3 2009/12/23 03:14:47 mrg Exp $
CPPFLAGS+= -DELFSIZE=64
LIB= ldd_elf64
@@ -15,7 +15,7 @@
.if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "sparc64") || \
(${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64") || \
- (${MACHINE_ARCH:Mmips64*} != "" && !empty(ABI64))
+ (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
# XXX we need to make sure that we don't accidentally get the elf32
# XXX versions of these.
@@ -38,6 +38,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.2.2
--- /dev/null Wed Dec 23 03:14:47 2009
+++ src/usr.bin/ldd/elf32_compat/Makefile Wed Dec 23 03:14:47 2009
@@ -0,0 +1,24 @@
+# $NetBSD: Makefile,v 1.1.2.2 2009/12/23 03:14:47 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>