Module Name:    src
Committed By:   snj
Date:           Fri May 12 06:17:00 UTC 2017

Modified Files:
        src/sys/sys [netbsd-7]: exec_ecoff.h
        src/tools [netbsd-7]: Makefile.nbincludes
        src/tools/mips-elf2ecoff [netbsd-7]: Makefile
        src/tools/mips-elf2ecoff/machine [netbsd-7]: ecoff_machdep.h
        src/usr.bin/elf2ecoff [netbsd-7]: elf2ecoff.c
Removed Files:
        src/tools/mips-elf2ecoff/sys [netbsd-7]: exec_ecoff.h exec_elf.h

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.38.1 src/sys/sys/exec_ecoff.h
cvs rdiff -u -r1.3.10.1 -r1.3.10.2 src/tools/Makefile.nbincludes
cvs rdiff -u -r1.2 -r1.2.74.1 src/tools/mips-elf2ecoff/Makefile
cvs rdiff -u -r1.2 -r1.2.76.1 \
    src/tools/mips-elf2ecoff/machine/ecoff_machdep.h
cvs rdiff -u -r1.1 -r0 src/tools/mips-elf2ecoff/sys/exec_ecoff.h
cvs rdiff -u -r1.5 -r0 src/tools/mips-elf2ecoff/sys/exec_elf.h
cvs rdiff -u -r1.29 -r1.29.4.1 src/usr.bin/elf2ecoff/elf2ecoff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/exec_ecoff.h
diff -u src/sys/sys/exec_ecoff.h:1.20 src/sys/sys/exec_ecoff.h:1.20.38.1
--- src/sys/sys/exec_ecoff.h:1.20	Thu Dec 10 14:13:54 2009
+++ src/sys/sys/exec_ecoff.h	Fri May 12 06:16:59 2017
@@ -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 */

Index: src/tools/Makefile.nbincludes
diff -u src/tools/Makefile.nbincludes:1.3.10.1 src/tools/Makefile.nbincludes:1.3.10.2
--- src/tools/Makefile.nbincludes:1.3.10.1	Sun Dec 18 08:05:52 2016
+++ src/tools/Makefile.nbincludes	Fri May 12 06:16:59 2017
@@ -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 @@ _INCS=		disktab.h
 _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
 

Index: src/tools/mips-elf2ecoff/Makefile
diff -u src/tools/mips-elf2ecoff/Makefile:1.2 src/tools/mips-elf2ecoff/Makefile:1.2.74.1
--- src/tools/mips-elf2ecoff/Makefile:1.2	Sun Dec  8 20:20:02 2002
+++ src/tools/mips-elf2ecoff/Makefile	Fri May 12 06:16:59 2017
@@ -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"

Index: src/tools/mips-elf2ecoff/machine/ecoff_machdep.h
diff -u src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.2 src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.2.76.1
--- src/tools/mips-elf2ecoff/machine/ecoff_machdep.h:1.2	Sat Mar 23 17:13:45 2002
+++ src/tools/mips-elf2ecoff/machine/ecoff_machdep.h	Fri May 12 06:16:59 2017
@@ -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 @@ typedef u_int32_t	ECOFF_ULONG;
 
 
 #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 @@ struct ecoff_extsym {
 	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;
+};

Index: src/usr.bin/elf2ecoff/elf2ecoff.c
diff -u src/usr.bin/elf2ecoff/elf2ecoff.c:1.29 src/usr.bin/elf2ecoff/elf2ecoff.c:1.29.4.1
--- src/usr.bin/elf2ecoff/elf2ecoff.c:1.29	Sun Nov 10 17:14:25 2013
+++ src/usr.bin/elf2ecoff/elf2ecoff.c	Fri May 12 06:17:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2ecoff.c,v 1.29 2013/11/10 17:14:25 christos Exp $	*/
+/*	$NetBSD: elf2ecoff.c,v 1.29.4.1 2017/05/12 06:17:00 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -56,8 +56,8 @@
 #define	ISLAST(p)	(p->n_un.n_name == 0 || p->n_un.n_name[0] == 0)
 
 struct sect {
-	unsigned long vaddr;
-	unsigned long len;
+	uint32_t vaddr;
+	uint32_t len;
 };
 
 struct elf_syms {
@@ -83,12 +83,12 @@ static void    safewrite(int, const void
 static void    copy(int, int, off_t, off_t);
 static void    combine(struct sect *, struct sect *, int);
 static void    translate_syms(struct elf_syms *, struct ecoff_syms *);
-static void    elf_symbol_table_to_ecoff(int, int, struct ecoff_exechdr *,
+static void    elf_symbol_table_to_ecoff(int, int, struct ecoff32_exechdr *,
     off_t, off_t, off_t, off_t);
-static int     make_ecoff_section_hdrs(struct ecoff_exechdr *,
-    struct ecoff_scnhdr *);
-static void    write_ecoff_symhdr(int, struct ecoff_exechdr *,
-    struct ecoff_symhdr *, long, long, long, long);
+static int     make_ecoff_section_hdrs(struct ecoff32_exechdr *,
+    struct ecoff32_scnhdr *);
+static void    write_ecoff_symhdr(int, struct ecoff32_exechdr *,
+    struct ecoff32_symhdr *, int32_t, int32_t, int32_t, int32_t);
 static void    pad16(int, int, const char *);
 static void    bswap32_region(int32_t* , int);
 static void    elf_read_syms(struct elf_syms *, int, off_t, off_t, off_t,
@@ -107,12 +107,12 @@ main(int argc, char **argv)
 	int     pad;
 	struct sect text, data, bss;	/* a.out-compatible sections */
 
-	struct ecoff_exechdr ep;
-	struct ecoff_scnhdr esecs[6];
-	struct ecoff_symhdr symhdr;
+	struct ecoff32_exechdr ep;
+	struct ecoff32_scnhdr esecs[6];
+	struct ecoff32_symhdr symhdr;
 
 	int     infile, outfile;
-	unsigned long cur_vma = ULONG_MAX;
+	uint32_t cur_vma = UINT32_MAX;
 	int     nsecs = 0;
 	int	mipsel;
 
@@ -217,23 +217,25 @@ usage:
 	    (int (*) (const void *, const void *)) phcmp);
 
 	for (i = 0; i < ex.e_phnum; i++) {
-		/* Section types we can ignore... */
-		if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE ||
-		    ph[i].p_type == PT_PHDR ||
-		    ph[i].p_type == PT_MIPS_REGINFO) {
-
+		switch (ph[i].p_type) {
+		case PT_NOTE:
+		case PT_NULL:
+		case PT_PHDR:
+		case PT_MIPS_ABIFLAGS:
+		case PT_MIPS_REGINFO:
+			/* Section types we can ignore... */
 			if (debug) {
-				fprintf(stderr, "  skipping PH %zu type %d "
-				    "flags 0x%x\n",
+				fprintf(stderr, "  skipping PH %zu type %#x "
+				    "flags %#x\n",
 				    i, ph[i].p_type, ph[i].p_flags);
 			}
 			continue;
-		}
-		/* Section types we can't handle... */
-		else
+		default:
+			/* Section types we can't handle... */
 			if (ph[i].p_type != PT_LOAD)
-				errx(1, "Program header %zu type %d can't be "
+				errx(1, "Program header %zu type %#x can't be "
 				    "converted", i, ph[i].p_type);
+		}
 		/* Writable (data) segment? */
 		if (ph[i].p_flags & PF_W) {
 			struct sect ndata, nbss;
@@ -245,8 +247,8 @@ usage:
 
 			if (debug) {
 				fprintf(stderr, "  combinining PH %zu type %d "
-				    "flags 0x%x with data, ndata = %ld, "
-				    "nbss =%ld\n", i, ph[i].p_type,
+				    "flags %#x with data, ndata = %d, "
+				    "nbss =%d\n", i, ph[i].p_type,
 				    ph[i].p_flags, ndata.len, nbss.len);
 			}
 			combine(&data, &ndata, 0);
@@ -258,7 +260,7 @@ usage:
 			ntxt.len = ph[i].p_filesz;
 			if (debug) {
 				fprintf(stderr, "  combinining PH %zu type %d "
-				    "flags 0x%x with text, len = %ld\n",
+				    "flags %#x with text, len = %d\n",
 				    i, ph[i].p_type, ph[i].p_flags, ntxt.len);
 			}
 			combine(&text, &ntxt, 0);
@@ -310,7 +312,7 @@ usage:
 	ep.f.f_nscns = 6;
 	ep.f.f_timdat = 0;	/* bogus */
 	ep.f.f_symptr = 0;
-	ep.f.f_nsyms = sizeof(struct ecoff_symhdr);
+	ep.f.f_nsyms = sizeof(struct ecoff32_symhdr);
 	ep.f.f_opthdr = sizeof ep.a;
 	ep.f.f_flags = 0x100f;	/* Stripped, not sharable. */
 
@@ -393,13 +395,13 @@ usage:
 		 * that the section can be loaded before copying. */
 		if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) {
 			if (cur_vma != ph[i].p_vaddr) {
-				unsigned long gap = ph[i].p_vaddr - cur_vma;
+				uint32_t gap = ph[i].p_vaddr - cur_vma;
 				char    obuf[1024];
 				if (gap > 65536)
-					errx(1, "Intersegment gap (%ld bytes) "
+					errx(1, "Intersegment gap (%d bytes) "
 					    "too large", gap);
 				if (debug)
-					fprintf(stderr, "Warning: %ld byte "
+					fprintf(stderr, "Warning: %d byte "
 					    "intersegment gap.\n", gap);
 				memset(obuf, 0, sizeof obuf);
 				while (gap) {
@@ -421,8 +423,8 @@ usage:
 
 
 	if (debug)
-		fprintf(stderr, "writing syms at offset 0x%lx\n",
-		    (u_long) ep.f.f_symptr + sizeof(symhdr));
+		fprintf(stderr, "writing syms at offset %#x\n",
+		    (uint32_t)(ep.f.f_symptr + sizeof(symhdr)));
 
 	/* Copy and translate the symbol table... */
 	elf_symbol_table_to_ecoff(outfile, infile, &ep,
@@ -510,7 +512,7 @@ saveRead(int file, off_t offset, off_t l
 	if ((off = lseek(file, offset, SEEK_SET)) < 0)
 		err(1, "%s: fseek", name);
 	if ((tmp = malloc(len)) == NULL)
-		err(1, "%s: Can't allocate %ld bytes", name, (long) len);
+		err(1, "%s: Can't allocate %jd bytes", name, (intmax_t)len);
 	count = read(file, tmp, len);
 	if (count != len)
 		err(1, "%s: short read", name);
@@ -533,7 +535,7 @@ safewrite(int outfile, const void *buf, 
  * for text, data, and bss.
  */
 static int
-make_ecoff_section_hdrs(struct ecoff_exechdr *ep, struct ecoff_scnhdr *esecs)
+make_ecoff_section_hdrs(struct ecoff32_exechdr *ep, struct ecoff32_scnhdr *esecs)
 {
 
 	ep->f.f_nscns = 6;	/* XXX */
@@ -549,11 +551,11 @@ make_ecoff_section_hdrs(struct ecoff_exe
 	esecs[1].s_size = ep->a.dsize;
 	esecs[2].s_size = ep->a.bsize;
 
-	esecs[0].s_scnptr = ECOFF_TXTOFF(ep);
-	esecs[1].s_scnptr = ECOFF_DATOFF(ep);
+	esecs[0].s_scnptr = ECOFF32_TXTOFF(ep);
+	esecs[1].s_scnptr = ECOFF32_DATOFF(ep);
 #if 0
 	esecs[2].s_scnptr = esecs[1].s_scnptr +
-	    ECOFF_ROUND(esecs[1].s_size, ECOFF_SEGMENT_ALIGNMENT(ep));
+	    ECOFF_ROUND(esecs[1].s_size, ECOFF32_SEGMENT_ALIGNMENT(ep));
 #endif
 
 	esecs[0].s_relptr = esecs[1].s_relptr = esecs[2].s_relptr = 0;
@@ -581,17 +583,17 @@ make_ecoff_section_hdrs(struct ecoff_exe
  * Mark all symbols as EXTERN (for now).
  */
 static void
-write_ecoff_symhdr(int out, struct ecoff_exechdr *ep,
-    struct ecoff_symhdr *symhdrp, long nesyms,
-    long extsymoff, long extstroff, long strsize)
+write_ecoff_symhdr(int out, struct ecoff32_exechdr *ep,
+    struct ecoff32_symhdr *symhdrp, int32_t nesyms,
+    int32_t extsymoff, int32_t extstroff, int32_t strsize)
 {
 
 	if (debug)
 		fprintf(stderr,
-		    "writing symhdr for %ld entries at offset 0x%lx\n",
-		    nesyms, (u_long) ep->f.f_symptr);
+		    "writing symhdr for %d entries at offset %#x\n",
+		    nesyms, ep->f.f_symptr);
 
-	ep->f.f_nsyms = sizeof(struct ecoff_symhdr);
+	ep->f.f_nsyms = sizeof(struct ecoff32_symhdr);
 
 	memset(symhdrp, 0, sizeof(*symhdrp));
 	symhdrp->esymMax = nesyms;
@@ -602,9 +604,9 @@ write_ecoff_symhdr(int out, struct ecoff
 	symhdrp->issExtMax = strsize;
 	if (debug)
 		fprintf(stderr,
-		    "ECOFF symhdr: symhdr %zx, strsize %lx, symsize %lx\n",
+		    "ECOFF symhdr: symhdr %zx, strsize %x, symsize %zx\n",
 		    sizeof(*symhdrp), strsize,
-		    (nesyms * sizeof(struct ecoff_extsym)));
+		    (nesyms * sizeof(struct ecoff32_extsym)));
 
 	if (needswap) {
 		bswap32_region(&symhdrp->ilineMax,
@@ -623,7 +625,7 @@ static void
 elf_read_syms(struct elf_syms *elfsymsp, int in, off_t symoff, off_t symsize,
     off_t stroff, off_t strsize)
 {
-	register int nsyms;
+	int nsyms;
 	int i;
 	nsyms = symsize / sizeof(Elf32_Sym);
 
@@ -650,16 +652,16 @@ elf_read_syms(struct elf_syms *elfsymsp,
 
 
 static void
-elf_symbol_table_to_ecoff(int out, int in, struct ecoff_exechdr *ep,
+elf_symbol_table_to_ecoff(int out, int in, struct ecoff32_exechdr *ep,
     off_t symoff, off_t symsize, off_t stroff, off_t strsize)
 {
 
 	struct elf_syms elfsymtab;
 	struct ecoff_syms ecoffsymtab;
-	register u_long ecoff_symhdr_off, symtaboff, stringtaboff;
-	register u_long nextoff, symtabsize, ecoff_strsize;
+	uint32_t ecoff_symhdr_off, symtaboff, stringtaboff;
+	uint32_t nextoff, symtabsize, ecoff_strsize;
 	int     nsyms, i;
-	struct ecoff_symhdr symhdr;
+	struct ecoff32_symhdr symhdr;
 	int     padding;
 
 	/* Read in the ELF symbols. */
@@ -675,13 +677,13 @@ elf_symbol_table_to_ecoff(int out, int i
 	nextoff = ecoff_symhdr_off + sizeof(struct ecoff_symhdr);
 	stringtaboff = nextoff;
 	ecoff_strsize = ECOFF_ROUND(ecoffsymtab.stringsize,
-	    (ECOFF_SEGMENT_ALIGNMENT(ep)));
+	    (ECOFF32_SEGMENT_ALIGNMENT(ep)));
 
 
 	nextoff = stringtaboff + ecoff_strsize;
 	symtaboff = nextoff;
 	symtabsize = nsyms * sizeof(struct ecoff_extsym);
-	symtabsize = ECOFF_ROUND(symtabsize, ECOFF_SEGMENT_ALIGNMENT(ep));
+	symtabsize = ECOFF_ROUND(symtabsize, ECOFF32_SEGMENT_ALIGNMENT(ep));
 
 	/* Write out the symbol header ... */
 	write_ecoff_symhdr(out, ep, &symhdr, nsyms, symtaboff,

Reply via email to