Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libelf/dist ELF_ARCH, ELF_TARG_DATA, and ELF_TA...



details:   https://anonhg.NetBSD.org/src/rev/7d59f32eb39c
branches:  trunk
changeset: 750162:7d59f32eb39c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Dec 19 07:52:59 2009 +0000

description:
ELF_ARCH, ELF_TARG_DATA, and ELF_TARG_CLASS are macros defined in a FreeBSD
header file.  For NetBSD, map to equivalent defines.

diffstat:

 external/bsd/libelf/dist/libelf.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 5544b69d89f4 -r 7d59f32eb39c external/bsd/libelf/dist/libelf.c
--- a/external/bsd/libelf/dist/libelf.c Sat Dec 19 07:47:22 2009 +0000
+++ b/external/bsd/libelf/dist/libelf.c Sat Dec 19 07:52:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libelf.c,v 1.2 2009/12/19 07:37:34 thorpej Exp $       */
+/*     $NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("$FreeBSD: src/lib/libelf/libelf.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $"); */
-__RCSID("$NetBSD: libelf.c,v 1.2 2009/12/19 07:37:34 thorpej Exp $");
+__RCSID("$NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $");
 
 #include <sys/param.h>
 
@@ -41,6 +41,18 @@
 
 #include "_libelf.h"
 
+#if defined(__NetBSD__)
+# if ARCH_ELFSIZE == 64
+#  define ELF_ARCH             ELF64_MACHDEP_ID
+#  define ELF_TARG_DATA                ELF64_MACHDEP_ENDIANNESS
+#  define ELF_TARG_CLASS       ELFCLASS64
+# else
+#  define ELF_ARCH             ELF32_MACHDEP_ID
+#  define ELF_TARG_DATA                ELF32_MACHDEP_ENDIANNESS
+#  define ELF_TARG_CLASS       ELFCLASS32
+# endif /* ARCH_ELFSIZE */
+#endif /* __NetBSD__ */
+
 struct _libelf_globals _libelf = {
        .libelf_arch            = ELF_ARCH,
        .libelf_byteorder       = ELF_TARG_DATA,



Home | Main Index | Thread Index | Old Index