Use OBJECT_FMTS from <bsd.own.mk> to determine elf32/elf64 needs

This commit is contained in:
matt 2014-03-02 03:55:19 +00:00
parent aebfe59c86
commit b1f346caa8
4 changed files with 14 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1 2011/04/15 08:47:02 plunky Exp $
# $NetBSD: Makefile,v 1.2 2014/03/02 03:55:19 matt Exp $
.include <bsd.own.mk> # for MKDYNAMICROOT definition
@ -8,9 +8,11 @@ MAN= ldd.1
.PATH: ${.CURDIR}/..
.if (${MACHINE_ARCH} != "alpha")
.if ${OBJECT_FMTS:Melf32} != ""
LIB_ELF32DIR!= cd ${.CURDIR}/../elf32 && ${PRINTOBJDIR}
EXTRA_LIBS+= ${LIB_ELF32DIR}/libldd_elf32.a
.else
CPPFLAGS.ldd.c+= -DELF64_ONLY
.endif
.if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
@ -18,14 +20,12 @@ 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} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
.if ${OBJECT_FMTS:Melf64} != ""
LIB_ELF64DIR!= cd ${.CURDIR}/../elf64 && ${PRINTOBJDIR}
EXTRA_LIBS+= ${LIB_ELF64DIR}/libldd_elf64.a
CPPFLAGS.ldd.c= -DELFSIZE=64
CPPFLAGS.ldd.c+= -DELFSIZE=64
.else
CPPFLAGS.ldd.c= -DELFSIZE=32
CPPFLAGS.ldd.c+= -DELFSIZE=32
.endif
LDADD+= ${EXTRA_LIBS}

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 2011/03/09 23:10:08 joerg Exp $
# $NetBSD: Makefile,v 1.9 2014/03/02 03:55:19 matt Exp $
.include <bsd.own.mk>
.include <bsd.init.mk>
@ -24,7 +24,7 @@ LIBISPRIVATE= yes
CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
.endif
.if ${MACHINE_ARCH} != "alpha"
.if ${OBJECT_FMTS:Melf32} != ""
.include "../Makefile.elf"
.endif

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2011/03/09 23:10:08 joerg Exp $
# $NetBSD: Makefile,v 1.7 2014/03/02 03:55:19 matt Exp $
.include <bsd.own.mk>
@ -11,9 +11,7 @@ SRCS= dummy.c
LIBISPRIVATE= yes
.PATH: ${.CURDIR}/..
.if (${MACHINE_ARCH} == "alpha") || (${MACHINE_ARCH} == "sparc64") || \
(${MACHINE_ARCH} == "x86_64") || (${MACHINE_ARCH} == "powerpc64") || \
(${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb")
.if ${OBJECT_FMTS:Melf64} != ""
# XXX we need to make sure that we don't accidentally get the elf32
# XXX versions of these.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ldd.c,v 1.21 2013/03/20 15:18:42 macallan Exp $ */
/* $NetBSD: ldd.c,v 1.22 2014/03/02 03:55:19 matt 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.21 2013/03/20 15:18:42 macallan Exp $");
__RCSID("$NetBSD: ldd.c,v 1.22 2014/03/02 03:55:19 matt Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -165,7 +165,7 @@ main(int argc, char **argv)
}
if (elf_ldd(fd, *argv, fmt1, fmt2) == -1
/* Alpha never had 32 bit support. */
#if (defined(_LP64) && !defined(__alpha__)) || defined(MIPS_N32)
#if (defined(_LP64) && !defined(ELF64_ONLY)) || defined(MIPS_N32)
&& elf32_ldd(fd, *argv, fmt1, fmt2) == -1
#if defined(__mips__) && 0 /* XXX this is still hosed for some reason */
&& elf32_ldd_compat(fd, *argv, fmt1, fmt2) == -1