Source-Changes-HG archive

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

[src/netbsd-7]: src Pull up following revision(s) (requested by skrll in tick...



details:   https://anonhg.NetBSD.org/src/rev/448dd9af51fc
branches:  netbsd-7
changeset: 800209:448dd9af51fc
user:      snj <snj%NetBSD.org@localhost>
date:      Fri May 12 06:16:59 2017 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #1406):
        sys/arch/mips/include/ecoff_machdep.h: revision 1.23
        sys/sys/exec_ecoff.h: revision 1.21
        tools/Makefile.nbincludes: revision 1.5
        tools/mips-elf2ecoff/Makefile: revision 1.3
        tools/mips-elf2ecoff/machine/ecoff_machdep.h: revision 1.3
        tools/mips-elf2ecoff/sys/exec_elf.h: file removal
        tools/mips-elf2ecoff/sys/exec_ecoff.h: file removal
        usr.bin/elf2ecoff/elf2ecoff.c: revision 1.30-1.33
use the nbcompat copies for those files
--
ignore the abiflags section
--
Add exec_ecoff.h
--
provide ecoff 32 defines.
--
This only works with 32 bit Elf and COFF files, make it specific this way
and use sized types so that it works on 64 bit systems (so it can become
a tool).
--
Provided sized definitions for ecoff 32 bit headers.
--
refresh
--
fix printf format.
--
fix printf format

diffstat:

 sys/sys/exec_ecoff.h                         |   72 ++-
 tools/Makefile.nbincludes                    |    4 +-
 tools/mips-elf2ecoff/Makefile                |    3 +-
 tools/mips-elf2ecoff/machine/ecoff_machdep.h |   65 +-
 tools/mips-elf2ecoff/sys/exec_ecoff.h        |  120 ----
 tools/mips-elf2ecoff/sys/exec_elf.h          |  750 ---------------------------
 usr.bin/elf2ecoff/elf2ecoff.c                |  108 +-
 7 files changed, 183 insertions(+), 939 deletions(-)

diffs (truncated from 1365 to 300 lines):

diff -r 897374dc57b3 -r 448dd9af51fc sys/sys/exec_ecoff.h
--- a/sys/sys/exec_ecoff.h      Fri May 12 05:44:10 2017 +0000
+++ b/sys/sys/exec_ecoff.h      Fri May 12 06:16:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_ecoff.h,v 1.20 2009/12/10 14:13:54 matt Exp $     */
+/*     $NetBSD: exec_ecoff.h,v 1.20.38.1 2017/05/12 06:16:59 snj Exp $ */
 
 /*
  * Copyright (c) 1994 Adam Glass
@@ -35,6 +35,76 @@
 
 #include <machine/ecoff_machdep.h>
 
+#ifdef ECOFF32_PAD
+
+typedef uint32_t ecoff32_addr;
+typedef uint32_t ecoff32_off;
+typedef uint32_t ecoff32_ulong;
+typedef int32_t ecoff32_long;
+typedef uint32_t ecoff32_uint;
+typedef int32_t ecoff32_int;
+typedef uint16_t ecoff32_ushort;
+typedef int16_t ecoff32_short;
+typedef uint8_t ecoff32_ubyte;
+typedef int8_t ecoff32_byte;
+
+struct ecoff32_filehdr {
+       ecoff32_ushort  f_magic;        /* magic number */
+       ecoff32_ushort  f_nscns;        /* # of sections */
+       ecoff32_uint    f_timdat;       /* time and date stamp */
+       ecoff32_ulong   f_symptr;       /* file offset of symbol table */
+       ecoff32_uint    f_nsyms;        /* # of symbol table entries */
+       ecoff32_ushort  f_opthdr;       /* sizeof the optional header */
+       ecoff32_ushort  f_flags;        /* flags??? */
+};
+
+struct ecoff32_aouthdr {
+       ecoff32_ushort  magic;
+       ecoff32_ushort  vstamp;
+       ECOFF32_PAD
+       ecoff32_ulong   tsize;
+       ecoff32_ulong   dsize;
+       ecoff32_ulong   bsize;
+       ecoff32_ulong   entry;
+       ecoff32_ulong   text_start;
+       ecoff32_ulong   data_start;
+       ecoff32_ulong   bss_start;
+       ECOFF32_MACHDEP;
+};
+
+struct ecoff32_scnhdr {                        /* needed for size info */
+       char            s_name[8];      /* name */
+       ecoff32_ulong   s_paddr;        /* physical addr? for ROMing?*/
+       ecoff32_ulong   s_vaddr;        /* virtual addr? */
+       ecoff32_ulong   s_size;         /* size */
+       ecoff32_ulong   s_scnptr;       /* file offset of raw data */
+       ecoff32_ulong   s_relptr;       /* file offset of reloc data */
+       ecoff32_ulong   s_lnnoptr;      /* file offset of line data */
+       ecoff32_ushort  s_nreloc;       /* # of relocation entries */
+       ecoff32_ushort  s_nlnno;        /* # of line entries */
+       ecoff32_uint    s_flags;        /* flags */
+};
+
+struct ecoff32_exechdr {
+       struct ecoff32_filehdr f;
+       struct ecoff32_aouthdr a;
+};
+
+#define ECOFF32_HDR_SIZE (sizeof(struct ecoff32_exechdr))
+
+#define ECOFF32_TXTOFF(ep) \
+        ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
+        ECOFF_ROUND(ECOFF32_HDR_SIZE + (ep)->f.f_nscns * \
+                    sizeof(struct ecoff32_scnhdr), ECOFF32_SEGMENT_ALIGNMENT(ep)))
+
+#define ECOFF32_DATOFF(ep) \
+        (ECOFF_BLOCK_ALIGN((ep), ECOFF32_TXTOFF(ep) + (ep)->a.tsize))
+
+#define ECOFF32_SEGMENT_ALIGN(ep, value) \
+        (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
+         ECOFF32_SEGMENT_ALIGNMENT(ep))))
+#endif
+
 struct ecoff_filehdr {
        u_short f_magic;        /* magic number */
        u_short f_nscns;        /* # of sections */
diff -r 897374dc57b3 -r 448dd9af51fc tools/Makefile.nbincludes
--- a/tools/Makefile.nbincludes Fri May 12 05:44:10 2017 +0000
+++ b/tools/Makefile.nbincludes Fri May 12 06:16:59 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.nbincludes,v 1.3.10.1 2016/12/18 08:05:52 snj Exp $
+#      $NetBSD: Makefile.nbincludes,v 1.3.10.2 2017/05/12 06:16:59 snj Exp $
 
 # NOxxx definitions are copied from Makefile.host, and are
 # required before .include <bsd.own.mk>.   The include of bsd.own.mk
@@ -35,7 +35,7 @@
 _SYSINCS=      bootblock.h \
                disklabel.h disklabel_acorn.h disklabel_gpt.h disklabel_rdb.h \
                dkbad.h \
-               exec_elf.h
+               exec_elf.h exec_ecoff.h
 
 HOST_CPPFLAGS+=        -I${TOOLDIR}/include -I${TOOLDIR}/include/nbinclude
 
diff -r 897374dc57b3 -r 448dd9af51fc tools/mips-elf2ecoff/Makefile
--- a/tools/mips-elf2ecoff/Makefile     Fri May 12 05:44:10 2017 +0000
+++ b/tools/mips-elf2ecoff/Makefile     Fri May 12 06:16:59 2017 +0000
@@ -1,7 +1,8 @@
-#      $NetBSD: Makefile,v 1.2 2002/12/08 20:20:02 thorpej Exp $
+#      $NetBSD: Makefile,v 1.2.74.1 2017/05/12 06:16:59 snj Exp $
 
 HOSTPROGNAME=  ${_TOOL_PREFIX}mips-elf2ecoff
 HOST_SRCDIR=   usr.bin/elf2ecoff
 HOST_CPPFLAGS= -I${.CURDIR}
 
+.include "${.CURDIR}/../Makefile.nbincludes"
 .include "${.CURDIR}/../Makefile.host"
diff -r 897374dc57b3 -r 448dd9af51fc tools/mips-elf2ecoff/machine/ecoff_machdep.h
--- a/tools/mips-elf2ecoff/machine/ecoff_machdep.h      Fri May 12 05:44:10 2017 +0000
+++ b/tools/mips-elf2ecoff/machine/ecoff_machdep.h      Fri May 12 06:16:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ecoff_machdep.h,v 1.2 2002/03/23 17:13:45 bouyer Exp $ */
+/*     $NetBSD: ecoff_machdep.h,v 1.2.76.1 2017/05/12 06:16:59 snj Exp $       */
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -34,23 +34,25 @@
  * SUCH DAMAGE.
  */
 
-typedef u_int16_t      ECOFF_USHORT;
-typedef u_int32_t      ECOFF_UINT;
-typedef u_int32_t      ECOFF_ULONG;
-
 #define ECOFF_LDPGSZ 4096
 
 #define ECOFF_PAD
+#define ECOFF32_PAD
+
+#define ECOFF32_MACHDEP \
+        ecoff32_ulong gprmask; \
+        ecoff32_ulong cprmask[4]; \
+        ecoff32_ulong gp_value
 
 #define ECOFF_MACHDEP \
-        ECOFF_ULONG gprmask; \
-        ECOFF_ULONG cprmask[4]; \
-        ECOFF_ULONG gp_value
+        u_long gprmask; \
+        u_long cprmask[4]; \
+        u_long gp_value
 #ifdef _KERNEL
-#include <mips/cpu.h>          /* mips CPU architecture levels */
+#include <mips/locore.h>               /* mips CPU architecture levels */
 #define _MIPS3_OK() CPUISMIPS3
 #else
-#define _MIPS3_OK() 1
+#define _MIPS3_OK() /*CONSTCOND*/1
 #endif
 
 
@@ -71,15 +73,43 @@
 
 
 #define ECOFF_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
+#define ECOFF32_SEGMENT_ALIGNMENT(ep) ((ep)->a.vstamp < 23 ? 8 : 16)
 
 #ifdef _KERNEL
 struct proc;
 struct exec_package;
-void   cpu_exec_ecoff_setregs __P((
-    struct proc *, struct exec_package *, u_long));
+void   cpu_exec_ecoff_setregs(struct lwp *, struct exec_package *, vaddr_t);
 #endif /* _KERNEL */
 
 
+struct ecoff32_symhdr {
+       int16_t         magic;
+       int16_t         vstamp;
+       int32_t         ilineMax;
+       int32_t         cbLine;
+       int32_t         cbLineOffset;
+       int32_t         idnMax;
+       int32_t         cbDnOffset;
+       int32_t         ipdMax;
+       int32_t         cbPdOffset;
+       int32_t         isymMax;
+       int32_t         cbSymOffset;
+       int32_t         ioptMax;
+       int32_t         cbOptOffset;
+       int32_t         iauxMax;
+       int32_t         cbAuxOffset;
+       int32_t         issMax;
+       int32_t         cbSsOffset;
+       int32_t         issExtMax;
+       int32_t         cbSsExtOffset;
+       int32_t         ifdMax;
+       int32_t         cbFdOffset;
+       int32_t         crfd;
+       int32_t         cbRfdOffset;
+       int32_t         iextMax;
+       int32_t         cbExtOffset;
+};
+
 /*
  * ECOFF symbol definitions for 32-bit mips.
  * XXX 64-bit (mips3?) may be different.
@@ -126,3 +156,14 @@
        unsigned        :1;
        unsigned        es_symauxindex:20;
 };
+
+struct ecoff32_extsym {
+       uint16_t        es_flags;
+       uint16_t        es_ifd;
+       int32_t         es_strindex;
+       int32_t         es_value;
+       unsigned        es_type:6;
+       unsigned        es_class:5;
+       unsigned        :1;
+       unsigned        es_symauxindex:20;
+};
diff -r 897374dc57b3 -r 448dd9af51fc tools/mips-elf2ecoff/sys/exec_ecoff.h
--- a/tools/mips-elf2ecoff/sys/exec_ecoff.h     Fri May 12 05:44:10 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*     $NetBSD: exec_ecoff.h,v 1.1 2002/03/23 17:13:46 bouyer Exp $    */
-
-/*
- * Copyright (c) 1994 Adam Glass
- * 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 Adam Glass.
- * 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 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        _SYS_EXEC_ECOFF_H_
-#define        _SYS_EXEC_ECOFF_H_
-
-#include <machine/ecoff_machdep.h>
-
-struct ecoff_filehdr {
-       ECOFF_USHORT f_magic;   /* magic number */
-       ECOFF_USHORT f_nscns;   /* # of sections */
-       ECOFF_UINT   f_timdat;  /* time and date stamp */
-       ECOFF_ULONG  f_symptr;  /* file offset of symbol table */
-       ECOFF_UINT   f_nsyms;   /* # of symbol table entries */
-       ECOFF_USHORT f_opthdr;  /* sizeof the optional header */
-       ECOFF_USHORT f_flags;   /* flags??? */
-};
-
-struct ecoff_aouthdr {
-       ECOFF_USHORT magic;
-       ECOFF_USHORT vstamp;
-       ECOFF_PAD
-       ECOFF_ULONG  tsize;
-       ECOFF_ULONG  dsize;
-       ECOFF_ULONG  bsize;
-       ECOFF_ULONG  entry;
-       ECOFF_ULONG  text_start;
-       ECOFF_ULONG  data_start;
-       ECOFF_ULONG  bss_start;
-       ECOFF_MACHDEP;
-};
-
-struct ecoff_scnhdr {          /* needed for size info */
-       char    s_name[8];      /* name */
-       ECOFF_ULONG  s_paddr;   /* physical addr? for ROMing?*/
-       ECOFF_ULONG  s_vaddr;   /* virtual addr? */
-       ECOFF_ULONG  s_size;    /* size */
-       ECOFF_ULONG  s_scnptr;  /* file offset of raw data */
-       ECOFF_ULONG  s_relptr;  /* file offset of reloc data */
-       ECOFF_ULONG  s_lnnoptr; /* file offset of line data */
-       ECOFF_USHORT s_nreloc;  /* # of relocation entries */
-       ECOFF_USHORT s_nlnno;   /* # of line entries */
-       ECOFF_UINT   s_flags;   /* flags */
-};
-



Home | Main Index | Thread Index | Old Index