Mon Dec 14 00:43:06 2009 UTC ()
Merge from matt-nb5-mips64


(matt)
diff -r1.10 -r1.11 src/usr.bin/elf2ecoff/Makefile
diff -r1.23 -r1.24 src/usr.bin/elf2ecoff/elf2ecoff.c

cvs diff -r1.10 -r1.11 src/usr.bin/elf2ecoff/Makefile (expand / switch to unified diff)

--- src/usr.bin/elf2ecoff/Makefile 2003/05/18 07:57:34 1.10
+++ src/usr.bin/elf2ecoff/Makefile 2009/12/14 00:43:05 1.11
@@ -1,15 +1,18 @@ @@ -1,15 +1,18 @@
1# $NetBSD: Makefile,v 1.10 2003/05/18 07:57:34 lukem Exp $ 1# $NetBSD: Makefile,v 1.11 2009/12/14 00:43:05 matt Exp $
2# from: @(#)Makefile 5.4 (Berkeley) 5/11/90 2# from: @(#)Makefile 5.4 (Berkeley) 5/11/90
3 3
4.include <bsd.own.mk> 4.include <bsd.own.mk>
5 5
 6ABI64:= ${CPUFLAGS:M-mabi=64:M-mabi=o64}
6# Build ELF to {ecoff, aout} tools on mips, for old bootblocks/PROMs. 7# Build ELF to {ecoff, aout} tools on mips, for old bootblocks/PROMs.
7.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb") 8.if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
 9 ((${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \
 10 !defined(HOSTPROG) && empty(ABI64)))
8 11
9PROG= elf2ecoff 12PROG= elf2ecoff
10 13
11.endif 14.endif
12 15
13MAN= elf2ecoff.1 16MAN= elf2ecoff.1
14 17
15.include <bsd.prog.mk> 18.include <bsd.prog.mk>

cvs diff -r1.23 -r1.24 src/usr.bin/elf2ecoff/elf2ecoff.c (expand / switch to unified diff)

--- src/usr.bin/elf2ecoff/elf2ecoff.c 2009/04/23 14:49:32 1.23
+++ src/usr.bin/elf2ecoff/elf2ecoff.c 2009/12/14 00:43:05 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: elf2ecoff.c,v 1.23 2009/04/23 14:49:32 tsutsui Exp $ */ 1/* $NetBSD: elf2ecoff.c,v 1.24 2009/12/14 00:43:05 matt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Jonathan Stone 4 * Copyright (c) 1997 Jonathan Stone
5 * All rights reserved. 5 * All rights reserved.
6 * Copyright (c) 1995 6 * Copyright (c) 1995
7 * Ted Lemon (hereinafter referred to as the author) 7 * Ted Lemon (hereinafter referred to as the author)
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -390,36 +390,36 @@ usage: @@ -390,36 +390,36 @@ usage:
390 390
391 /* Make the output file... */ 391 /* Make the output file... */
392 if ((outfile = open(argv[2], O_WRONLY | O_CREAT, 0777)) < 0) { 392 if ((outfile = open(argv[2], O_WRONLY | O_CREAT, 0777)) < 0) {
393 fprintf(stderr, "Unable to create %s: %s\n", argv[2], strerror(errno)); 393 fprintf(stderr, "Unable to create %s: %s\n", argv[2], strerror(errno));
394 exit(1); 394 exit(1);
395 } 395 }
396 /* Truncate file... */ 396 /* Truncate file... */
397 if (ftruncate(outfile, 0)) { 397 if (ftruncate(outfile, 0)) {
398 warn("ftruncate %s", argv[2]); 398 warn("ftruncate %s", argv[2]);
399 } 399 }
400 /* Write the headers... */ 400 /* Write the headers... */
401 safewrite(outfile, &ep.f, sizeof(ep.f), "ep.f: write: %s\n"); 401 safewrite(outfile, &ep.f, sizeof(ep.f), "ep.f: write: %s\n");
402 if (debug) 402 if (debug)
403 fprintf(stderr, "wrote %d byte file header.\n", sizeof(ep.f)); 403 fprintf(stderr, "wrote %zu byte file header.\n", sizeof(ep.f));
404 404
405 safewrite(outfile, &ep.a, sizeof(ep.a), "ep.a: write: %s\n"); 405 safewrite(outfile, &ep.a, sizeof(ep.a), "ep.a: write: %s\n");
406 if (debug) 406 if (debug)
407 fprintf(stderr, "wrote %d byte a.out header.\n", sizeof(ep.a)); 407 fprintf(stderr, "wrote %zu byte a.out header.\n", sizeof(ep.a));
408 408
409 safewrite(outfile, &esecs, sizeof(esecs[0]) * nsecs, 409 safewrite(outfile, &esecs, sizeof(esecs[0]) * nsecs,
410 "esecs: write: %s\n"); 410 "esecs: write: %s\n");
411 if (debug) 411 if (debug)
412 fprintf(stderr, "wrote %d bytes of section headers.\n", 412 fprintf(stderr, "wrote %zu bytes of section headers.\n",
413 sizeof(esecs[0]) * nsecs); 413 sizeof(esecs[0]) * nsecs);
414 414
415 415
416 pad = ((sizeof ep.f + sizeof ep.a + sizeof esecs) & 15); 416 pad = ((sizeof ep.f + sizeof ep.a + sizeof esecs) & 15);
417 if (pad) { 417 if (pad) {
418 pad = 16 - pad; 418 pad = 16 - pad;
419 pad16(outfile, pad, "ipad: write: %s\n"); 419 pad16(outfile, pad, "ipad: write: %s\n");
420 if (debug) 420 if (debug)
421 fprintf(stderr, "wrote %d byte pad.\n", pad); 421 fprintf(stderr, "wrote %d byte pad.\n", pad);
422 } 422 }
423 /* Copy the loadable sections. Zero-fill any gaps less than 64k; 423 /* Copy the loadable sections. Zero-fill any gaps less than 64k;
424 * complain about any zero-filling, and die if we're asked to 424 * complain about any zero-filling, and die if we're asked to
425 * zero-fill more than 64k. */ 425 * zero-fill more than 64k. */
@@ -651,27 +651,27 @@ write_ecoff_symhdr(out, ep, symhdrp, nes @@ -651,27 +651,27 @@ write_ecoff_symhdr(out, ep, symhdrp, nes
651 nesyms, (u_long) ep->f.f_symptr); 651 nesyms, (u_long) ep->f.f_symptr);
652 652
653 ep->f.f_nsyms = sizeof(struct ecoff_symhdr); 653 ep->f.f_nsyms = sizeof(struct ecoff_symhdr);
654 654
655 memset(symhdrp, 0, sizeof(*symhdrp)); 655 memset(symhdrp, 0, sizeof(*symhdrp));
656 symhdrp->esymMax = nesyms; 656 symhdrp->esymMax = nesyms;
657 symhdrp->magic = 0x7009;/* XXX */ 657 symhdrp->magic = 0x7009;/* XXX */
658 symhdrp->cbExtOffset = extsymoff; 658 symhdrp->cbExtOffset = extsymoff;
659 symhdrp->cbSsExtOffset = extstroff; 659 symhdrp->cbSsExtOffset = extstroff;
660 660
661 symhdrp->issExtMax = strsize; 661 symhdrp->issExtMax = strsize;
662 if (debug) 662 if (debug)
663 fprintf(stderr, 663 fprintf(stderr,
664 "ECOFF symhdr: symhdr %x, strsize %lx, symsize %lx\n", 664 "ECOFF symhdr: symhdr %zx, strsize %lx, symsize %lx\n",
665 sizeof(*symhdrp), strsize, 665 sizeof(*symhdrp), strsize,
666 (nesyms * sizeof(struct ecoff_extsym))); 666 (nesyms * sizeof(struct ecoff_extsym)));
667 667
668 if (needswap) { 668 if (needswap) {
669 bswap32_region(&symhdrp->ilineMax, 669 bswap32_region(&symhdrp->ilineMax,
670 sizeof(*symhdrp) - sizeof(symhdrp->magic) - 670 sizeof(*symhdrp) - sizeof(symhdrp->magic) -
671 sizeof(symhdrp->ilineMax)); 671 sizeof(symhdrp->ilineMax));
672 symhdrp->magic = bswap16(symhdrp->magic); 672 symhdrp->magic = bswap16(symhdrp->magic);
673 symhdrp->ilineMax = bswap16(symhdrp->ilineMax); 673 symhdrp->ilineMax = bswap16(symhdrp->ilineMax);
674 } 674 }
675  675
676 safewrite(out, symhdrp, sizeof(*symhdrp), 676 safewrite(out, symhdrp, sizeof(*symhdrp),
677 "writing symbol header: %s\n"); 677 "writing symbol header: %s\n");