Source-Changes-HG archive

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

[src/trunk]: src/tools Add an arm-specific elf2aout tool since objdump does n...



details:   https://anonhg.NetBSD.org/src/rev/fc925d202df0
branches:  trunk
changeset: 447109:fc925d202df0
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 31 13:35:15 2018 +0000

description:
Add an arm-specific elf2aout tool since objdump does not support a.out anymore

diffstat:

 tools/Makefile                            |    6 +-
 tools/arm-elf2aout/Makefile               |   17 +
 tools/arm-elf2aout/a.out.h                |   68 ++
 tools/arm-elf2aout/machine/aout_machdep.h |   59 ++
 tools/arm-elf2aout/nlist.h                |   96 +++
 tools/arm-elf2aout/sys/aout_mids.h        |   68 ++
 tools/arm-elf2aout/sys/exec_aout.h        |  182 +++++++
 tools/arm-elf2aout/sys/exec_elf.h         |  750 ++++++++++++++++++++++++++++++
 8 files changed, 1245 insertions(+), 1 deletions(-)

diffs (truncated from 1288 to 300 lines):

diff -r 2e78cf5753e3 -r fc925d202df0 tools/Makefile
--- a/tools/Makefile    Mon Dec 31 13:32:05 2018 +0000
+++ b/tools/Makefile    Mon Dec 31 13:35:15 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.196 2018/09/25 05:42:08 joerg Exp $
+#      $NetBSD: Makefile,v 1.197 2018/12/31 13:35:15 christos Exp $
 
 .include <bsd.own.mk>
 .include <bsd.endian.mk>
@@ -173,6 +173,10 @@
 SUBDIR+=       powerpc-mkbootimage
 .endif
 
+.if ${MACHINE_ARCH} == "arm"
+SUBDIR+=       arm-elf2aout
+.endif
+
 .if ${MACHINE_ARCH} == "m68k"
 SUBDIR+=       m68k-elf2aout
 .endif
diff -r 2e78cf5753e3 -r fc925d202df0 tools/arm-elf2aout/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/arm-elf2aout/Makefile       Mon Dec 31 13:35:15 2018 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.1 2018/12/31 13:35:16 christos Exp $
+
+.include <bsd.hostinit.mk>
+
+HOSTPROGNAME=  ${_TOOL_PREFIX}arm-elf2aout
+HOST_SRCDIR=   usr.bin/elf2aout
+HOST_CPPFLAGS= -I${.CURDIR}
+
+.include <bsd.endian.mk>
+
+.if   ${TARGET_ENDIANNESS} == "1234"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=LITTLE_ENDIAN
+.elif ${TARGET_ENDIANNESS} == "4321"
+CPPFLAGS+= -DTARGET_BYTE_ORDER=BIG_ENDIAN
+.endif
+
+.include "${.CURDIR}/../Makefile.host"
diff -r 2e78cf5753e3 -r fc925d202df0 tools/arm-elf2aout/a.out.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/arm-elf2aout/a.out.h        Mon Dec 31 13:35:15 2018 +0000
@@ -0,0 +1,68 @@
+/*     $NetBSD: a.out.h,v 1.1 2018/12/31 13:35:16 christos Exp $       */
+
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
+ */
+
+/*-
+ * Copyright (c) 1993 Theo de Raadt.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef        _AOUT_H_
+#define        _AOUT_H_
+
+#include <sys/exec_aout.h>
+
+#define        _AOUT_INCLUDE_
+#include <nlist.h>
+
+#endif /* !_AOUT_H_ */
diff -r 2e78cf5753e3 -r fc925d202df0 tools/arm-elf2aout/machine/aout_machdep.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/arm-elf2aout/machine/aout_machdep.h Mon Dec 31 13:35:15 2018 +0000
@@ -0,0 +1,59 @@
+/*     $NetBSD: aout_machdep.h,v 1.1 2018/12/31 13:35:16 christos Exp $        */
+
+/*
+ * Copyright (c) 1994-1996 Mark Brinicombe.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by Mark Brinicombe
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARM_AOUT_MACHDEP_H_
+#define _ARM_AOUT_MACHDEP_H_
+
+#define        AOUT_LDPGSZ     4096
+
+/* Relocation format. */
+
+struct relocation_info_arm6 {
+       int r_address;          /* offset in text or data segment */
+       unsigned r_symbolnum:24;/* ordinal number of add symbol */
+       unsigned r_pcrel:1;     /* 1 if value should be pc-relative */
+       unsigned r_length:2;    /* 0=byte, 1=word, 2=long, 3=24bits shifted by 2 */
+       unsigned r_extern:1;    /* 1 if need to add symbol to value */
+       unsigned r_neg:1;       /* 1 if addend is negative */
+       unsigned r_baserel:1;   /* 1 if linkage table relative */
+       unsigned r_jmptable:1;  /* 1 if relocation to jump table */
+       unsigned r_relative:1;  /* 1 if load address relative */
+};
+
+#define relocation_info relocation_info_arm6
+
+/* No special executable format */
+#define        cpu_exec_aout_makecmds(a, b)    ENOEXEC
+
+#endif /* _ARM_AOUT_MACHDEP_H_ */
diff -r 2e78cf5753e3 -r fc925d202df0 tools/arm-elf2aout/nlist.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/arm-elf2aout/nlist.h        Mon Dec 31 13:35:15 2018 +0000
@@ -0,0 +1,96 @@
+/*     $NetBSD: nlist.h,v 1.1 2018/12/31 13:35:16 christos Exp $       */
+
+/*-
+ * Copyright (c) 1991, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)nlist.h     8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _NLIST_H_
+#define        _NLIST_H_
+
+#include <sys/cdefs.h>
+
+/*
+ * Symbol table entry format.  The #ifdef's are so that programs including
+ * nlist.h can initialize nlist structures statically.
+ */
+struct nlist {
+#ifdef _AOUT_INCLUDE_
+       union {
+#if 0
+               __aconst char *n_name;  /* symbol name (in memory) */
+#endif
+               int32_t n_strx;         /* file string table offset (on disk) */
+       } n_un;
+# define N_NAME(nlp)   ((nlp)->n_un.n_name)
+#else
+       const char *n_name;             /* symbol name (in memory) */
+# define N_NAME(nlp)   ((nlp)->n_name)
+#endif
+
+#define        N_UNDF  0x00            /* undefined */
+#define        N_ABS   0x02            /* absolute address */
+#define        N_TEXT  0x04            /* text segment */
+#define        N_DATA  0x06            /* data segment */
+#define        N_BSS   0x08            /* bss segment */
+#define        N_INDR  0x0a            /* alias definition */
+#define        N_SIZE  0x0c            /* pseudo type, defines a symbol's size */
+#define        N_COMM  0x12            /* common reference */
+#define N_SETA 0x14            /* absolute set element symbol */
+#define N_SETT 0x16            /* text set element symbol */
+#define N_SETD 0x18            /* data set element symbol */
+#define N_SETB 0x1a            /* bss set element symbol */
+#define N_SETV 0x1c            /* set vector symbol */
+#define        N_FN    0x1e            /* file name (N_EXT on) */
+#define        N_WARN  0x1e            /* warning message (N_EXT off) */
+
+#define        N_EXT   0x01            /* external (global) bit, OR'ed in */
+#define        N_TYPE  0x1e            /* mask for all the type bits */
+       unsigned char n_type;   /* type defines */
+
+       char n_other;           /* spare */
+#define        n_hash  n_desc          /* used internally by ld(1); XXX */
+       int16_t n_desc;         /* used by stab entries */
+       uint32_t n_value;       /* address/value of the symbol */
+};
+
+#define        N_FORMAT        "%08x"  /* namelist value format; XXX */
+#define        N_STAB          0x0e0   /* mask for debugger symbols -- stab(5) */
+
+__BEGIN_DECLS
+int nlist(const char *, struct nlist *);
+int __fdnlist(int, struct nlist *);            /* XXX for libkvm */
+__END_DECLS
+
+#endif /* !_NLIST_H_ */
diff -r 2e78cf5753e3 -r fc925d202df0 tools/arm-elf2aout/sys/aout_mids.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/arm-elf2aout/sys/aout_mids.h        Mon Dec 31 13:35:15 2018 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: aout_mids.h,v 1.1 2018/12/31 13:35:16 christos Exp $ */
+
+/*
+ * Copyright (c) 2009, The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT



Home | Main Index | Thread Index | Old Index