CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Fri Apr 29 06:59:29 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Comment that (buffer + 14) stands for reltab in bbstart.s. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.29 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28 Mon Apr 25 15:48:57 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Fri Apr 29 06:59:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.28 2022/04/25 15:48:57 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.29 2022/04/29 06:59:29 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -288,7 +288,7 @@ main(int argc, char *argv[]) case RELVER_RELATIVE_BYTES_FORWARD: rpo = buffer + tsz + dsz; delta = +1; - *(uint16_t *)(buffer + 14) = htobe16(tsz + dsz); + *(uint16_t *)(buffer + 14) /* reltab */ = htobe16(tsz + dsz); break; }
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Fri Apr 29 06:59:29 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Comment that (buffer + 14) stands for reltab in bbstart.s. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 15:48:57 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: One more style. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27 Mon Apr 25 14:46:38 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 15:48:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.27 2022/04/25 14:46:38 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.28 2022/04/25 15:48:57 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -431,9 +431,9 @@ main(int argc, char *argv[]) *rpo = 0; rpo += delta; *rpo = 0; rpo += delta; - printf("using %td bytes, %td bytes remaining.\n", delta > 0 ? - rpo-buffer-tsz-dsz : buffer+bbsize-rpo, delta > 0 ? - buffer + bbsize - rpo : rpo - buffer - tsz - dsz); + printf("using %td bytes, %td bytes remaining.\n", + delta > 0 ? rpo - buffer - tsz - dsz : buffer + bbsize - rpo, + delta > 0 ? buffer + bbsize - rpo : rpo - buffer - tsz - dsz); /* * RELOCs must fit into the bss area. */
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 15:48:57 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: One more style. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
On 2022/04/25 23:03, Rin Okuyama wrote: Module Name:src Committed By: rin Date: Mon Apr 25 14:03:15 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c Log Message: Use htobe{16,32}(9) instead of be{16,32}toh(9) where appropriate. No binary changes both for little and big endian machines. Oops, "be{16,32}toh(3) instead of htobe{16,32}(3)", apparently... Thanks, rin
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:46:38 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: static-ify function bodies of usage() and eval(). No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26 Mon Apr 25 14:39:30 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 14:46:38 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.26 2022/04/25 14:39:30 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.27 2022/04/25 14:46:38 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -466,7 +466,7 @@ main(int argc, char *argv[]) exit(0); } -void +static void usage(void) { fprintf(stderr, "Usage: %s [-F] bootprog bootprog.bin\n", @@ -475,7 +475,7 @@ usage(void) /* NOTREACHED */ } -int +static int eval(Elf32_Sym *s, uint32_t *o) { int value;
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:46:38 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: static-ify function bodies of usage() and eval(). No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:45:26 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c Log Message: One more style... No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.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/arch/amiga/stand/bootblock/elf2bb/chksum.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.8 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.9 --- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.8 Mon Apr 25 14:39:30 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c Mon Apr 25 14:45:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chksum.c,v 1.8 2022/04/25 14:39:30 rin Exp $ */ +/* $NetBSD: chksum.c,v 1.9 2022/04/25 14:45:26 rin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ main(int argc, char *argb[]) { uint32_t cks, cks1; bbsize = atol(argb[1]); - bbsize *= (512 / sizeof (uint32_t)); + bbsize *= (512 / sizeof(uint32_t)); if (4 * bbsize != read(0, myblock, sizeof(uint32_t) * bbsize)) { fprintf(stderr, "short read\n");
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:45:26 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c Log Message: One more style... No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:39:30 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c Log Message: Wrap looong lines, and misc style/cosmetic fixes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/chksum.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.7 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.8 --- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.7 Mon Apr 25 14:03:15 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c Mon Apr 25 14:39:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chksum.c,v 1.7 2022/04/25 14:03:15 rin Exp $ */ +/* $NetBSD: chksum.c,v 1.8 2022/04/25 14:39:30 rin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -65,17 +65,17 @@ main(int argc, char *argb[]) { int bbsize; uint32_t cks, cks1; - bbsize=atol(argb[1]); + bbsize = atol(argb[1]); bbsize *= (512 / sizeof (uint32_t)); - if (4*bbsize != read(0, myblock, sizeof(uint32_t)*bbsize)) { + if (4 * bbsize != read(0, myblock, sizeof(uint32_t) * bbsize)) { fprintf(stderr, "short read\n"); exit(1); } fprintf(stderr, "Cksum field = 0x%x, ", myblock[1]); cks = chksum(myblock, bbsize); fprintf(stderr, "cksum = 0x%x\n", cks); - myblock[1] += 0x - cks; + myblock[1] += 0x - cks; fprintf(stderr, "New cksum field = 0x%x, ", myblock[1]); cks1 = chksum(myblock, bbsize); fprintf(stderr, "cksum = 0x%x\n", cks1); Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25 Mon Apr 25 14:36:47 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 14:39:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.25 2022/04/25 14:36:47 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.26 2022/04/25 14:39:30 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ char *progname; int bbsize = BBSIZE; uint8_t *buffer; uint32_t *relbuf; - /* can't have more relocs than that*/ + /* can't have more relocs than that */ static int intcmp(const void *i, const void *j) @@ -85,7 +85,7 @@ intcmp(const void *i, const void *j) r = (*(uint32_t *)i) < (*(uint32_t *)j); - return 2*r-1; + return 2 * r - 1; } int @@ -146,7 +146,8 @@ main(int argc, char *argv[]) eh = (Elf32_Ehdr *)image; /* XXX endianness */ - dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum), be32toh(eh->e_shoff))); + dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum), + be32toh(eh->e_shoff))); if (be16toh(eh->e_type) != ET_REL) errx(1, "%s isn't a relocatable file, type=%d", argv[0], be16toh(eh->e_type)); @@ -157,22 +158,27 @@ main(int argc, char *argv[]) /* Calculate sizes from section headers. */ tsz = dsz = bsz = trsz = 0; sh = (Elf32_Shdr *)(image + be32toh(eh->e_shoff)); - shstrtab = (char *)(image + be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset)); - symtab = NULL; /*XXX*/ - strtab = NULL; /*XXX*/ - dprintf(("name type flagsaddr offset size align\n")); + shstrtab = (char *)(image + + be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset)); + symtab = NULL; /* XXX */ + strtab = NULL; /* XXX */ + dprintf(("name type flags" + "addr offset size align\n")); for (i = 0; i < be16toh(eh->e_shnum); ++i) { uint32_t sh_size; - dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i, + dprintf(("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i, be32toh(sh[i].sh_name), shstrtab + be32toh(sh[i].sh_name), - be32toh(sh[i].sh_type), - be32toh(sh[i].sh_flags), be32toh(sh[i].sh_addr), - be32toh(sh[i].sh_offset), be32toh(sh[i].sh_size), - be32toh(sh[i].sh_addralign))); - sh_size = (be32toh(sh[i].sh_size) + be32toh(sh[i].sh_addralign) - 1) & - - be32toh(sh[i].sh_addralign); - /* If section allocates memory, add to text, data, or bss size. */ + be32toh(sh[i].sh_type), be32toh(sh[i].sh_flags), + be32toh(sh[i].sh_addr), be32toh(sh[i].sh_offset), + be32toh(sh[i].sh_size), be32toh(sh[i].sh_addralign))); + sh_size = (be32toh(sh[i].sh_size) + + be32toh(sh[i].sh_addralign) - 1) & + (- be32toh(sh[i].sh_addralign)); + /* + * If section allocates memory, add to text, data, + * or bss size. + */ if (be32toh(sh[i].sh_flags) & SHF_ALLOC) { if (be32toh(sh[i].sh_type) == SHT_PROGBITS) { if (be32toh(sh[i].sh_flags) & SHF_WRITE) @@ -188,8 +194,10 @@ main(int argc, char
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:39:30 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c Log Message: Wrap looong lines, and misc style/cosmetic fixes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:36:47 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Do not cast return value from malloc(3). No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.24 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.24 Mon Apr 25 14:10:15 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 14:36:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.24 2022/04/25 14:10:15 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.25 2022/04/25 14:36:47 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -243,7 +243,7 @@ retry: memset(buffer, 0, bbsize); /* Allocate and load loadable sections */ - sect_offset = (uint32_t *)malloc(be16toh(eh->e_shnum) * sizeof(uint32_t)); + sect_offset = malloc(be16toh(eh->e_shnum) * sizeof(uint32_t)); for (i = 0, l = 0; i < be16toh(eh->e_shnum); ++i) { if (be32toh(sh[i].sh_flags) & SHF_ALLOC) { dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n",
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:36:47 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Do not cast return value from malloc(3). No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:10:15 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: - static-ify usage(), intcmp(), and eval() - remove prototype declaration for main() NFCI; no binary changes observed for amd64 with -O0. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.23 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.24 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.23 Mon Apr 25 14:03:15 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 14:10:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.23 2022/04/25 14:03:15 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.24 2022/04/25 14:10:15 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -59,9 +59,9 @@ #include "elf2bb.h" #include "chksum.h" -void usage(void); -int intcmp(const void *, const void *); -int main(int argc, char *argv[]); +static void usage(void); +static int intcmp(const void *, const void *); +static int eval(Elf32_Sym *, uint32_t *); #ifdef DEBUG #define dprintf(x) if (debug) printf x @@ -78,7 +78,7 @@ uint8_t *buffer; uint32_t *relbuf; /* can't have more relocs than that*/ -int +static int intcmp(const void *i, const void *j) { int r; @@ -98,7 +98,6 @@ main(int argc, char *argv[]) char *shstrtab; Elf32_Sym *symtab; char *strtab; - int eval(Elf32_Sym *, uint32_t *); uint32_t *lptr; int i, l, delta; uint8_t *rpo;
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:10:15 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: - static-ify usage(), intcmp(), and eval() - remove prototype declaration for main() NFCI; no binary changes observed for amd64 with -O0. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:03:15 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c Log Message: Use htobe{16,32}(9) instead of be{16,32}toh(9) where appropriate. No binary changes both for little and big endian machines. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/chksum.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.7 --- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6 Mon Apr 25 13:43:50 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c Mon Apr 25 14:03:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chksum.c,v 1.6 2022/04/25 13:43:50 rin Exp $ */ +/* $NetBSD: chksum.c,v 1.7 2022/04/25 14:03:15 rin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ chksum(uint32_t *block, int size) for (i=0; ie_shnum), htobe32(eh->e_shoff))); - if (htobe16(eh->e_type) != ET_REL) + dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum), be32toh(eh->e_shoff))); + if (be16toh(eh->e_type) != ET_REL) errx(1, "%s isn't a relocatable file, type=%d", - argv[0], htobe16(eh->e_type)); - if (htobe16(eh->e_machine) != EM_68K) + argv[0], be16toh(eh->e_type)); + if (be16toh(eh->e_machine) != EM_68K) errx(1, "%s isn't M68K, machine=%d", argv[0], - htobe16(eh->e_machine)); + be16toh(eh->e_machine)); /* Calculate sizes from section headers. */ tsz = dsz = bsz = trsz = 0; - sh = (Elf32_Shdr *)(image + htobe32(eh->e_shoff)); - shstrtab = (char *)(image + htobe32(sh[htobe16(eh->e_shstrndx)].sh_offset)); + sh = (Elf32_Shdr *)(image + be32toh(eh->e_shoff)); + shstrtab = (char *)(image + be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset)); symtab = NULL; /*XXX*/ strtab = NULL; /*XXX*/ dprintf(("name type flagsaddr offset size align\n")); - for (i = 0; i < htobe16(eh->e_shnum); ++i) { + for (i = 0; i < be16toh(eh->e_shnum); ++i) { uint32_t sh_size; dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i, - htobe32(sh[i].sh_name), shstrtab + htobe32(sh[i].sh_name), - htobe32(sh[i].sh_type), - htobe32(sh[i].sh_flags), htobe32(sh[i].sh_addr), - htobe32(sh[i].sh_offset), htobe32(sh[i].sh_size), - htobe32(sh[i].sh_addralign))); - sh_size = (htobe32(sh[i].sh_size) + htobe32(sh[i].sh_addralign) - 1) & - -htobe32(sh[i].sh_addralign); + be32toh(sh[i].sh_name), shstrtab + be32toh(sh[i].sh_name), + be32toh(sh[i].sh_type), + be32toh(sh[i].sh_flags), be32toh(sh[i].sh_addr), + be32toh(sh[i].sh_offset), be32toh(sh[i].sh_size), + be32toh(sh[i].sh_addralign))); + sh_size = (be32toh(sh[i].sh_size) + be32toh(sh[i].sh_addralign) - 1) & + - be32toh(sh[i].sh_addralign); /* If section allocates memory, add to text, data, or bss size. */ - if (htobe32(sh[i].sh_flags) & SHF_ALLOC) { - if (htobe32(sh[i].sh_type) == SHT_PROGBITS) { -if (htobe32(sh[i].sh_flags) & SHF_WRITE) + if (be32toh(sh[i].sh_flags) & SHF_ALLOC) { + if (be32toh(sh[i].sh_type) == SHT_PROGBITS) { +if (be32toh(sh[i].sh_flags) & SHF_WRITE) dsz += sh_size; else tsz += sh_size; } else bsz += sh_size; /* If it's relocations, add to relocation count */ - } else if (htobe32(sh[i].sh_type) == SHT_RELA) { - trsz += htobe32(sh[i].sh_size); + } else if (be32toh(sh[i].sh_type) == SHT_RELA) { + trsz += be32toh(sh[i].sh_size); } /* Check for SHT_REL? */ /* Get symbol table location. */ - else if (htobe32(sh[i].sh_type) == SHT_SYMTAB) { - symtab = (Elf32_Sym *)(image + htobe32(sh[i].sh_offset)); - } else if (strcmp(".strtab", shstrtab + htobe32(sh[i].sh_name)) == 0) { - strtab = image + htobe32(sh[i].sh_offset); + else if (be32toh(sh[i].sh_type) == SHT_SYMTAB) { + symtab = (Elf32_Sym *)(image + be32toh(sh[i].sh_offset)); + } else if (strcmp(".strtab", shstrtab + be32toh(sh[i].sh_name)) == 0) { + strtab = image + be32toh(sh[i].sh_offset); } } dprintf(("tsz = 0x%x, dsz = 0x%x, bsz = 0x%x, total 0x%x\n", @@ -244,18 +244,18 @@ retry: memset(buffer, 0, bbsize); /* Allocate and load loadable sections */ - sect_offset = (uint32_t *)malloc(htobe16(eh->e_shnum) * sizeof(uint32_t)); - for (i = 0, l = 0; i < htobe16(eh->e_shnum); ++i) { - if (htobe32(sh[i].sh_flags) & SHF_ALLOC) { + sect_offset = (uint32_t *)malloc(be16toh(eh->e_shnum) * sizeof(uint32_t)); + for (i = 0, l = 0; i < be16toh(eh->e_shnum); ++i) { + if (be32toh(sh[i].sh_flags) & SHF_ALLOC) { dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n", - l, htobe32(sh[i].sh_size),
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 14:03:15 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c Log Message: Use htobe{16,32}(9) instead of be{16,32}toh(9) where appropriate. No binary changes both for little and big endian machines. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 13:43:50 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c chksum.h elf2bb.c Log Message: u_intN_t --> uintN_t No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/chksum.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6 --- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.5 Sat Mar 14 15:36:01 2009 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c Mon Apr 25 13:43:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chksum.c,v 1.5 2009/03/14 15:36:01 dsl Exp $ */ +/* $NetBSD: chksum.c,v 1.6 2022/04/25 13:43:50 rin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -39,10 +39,10 @@ #include "chksum.h" -u_int32_t -chksum(u_int32_t *block, int size) +uint32_t +chksum(uint32_t *block, int size) { - u_int32_t sum, lastsum; + uint32_t sum, lastsum; int i; sum = 0; @@ -58,17 +58,17 @@ chksum(u_int32_t *block, int size) } #ifdef TESTSUM -u_int32_t myblock[8192]; +uint32_t myblock[8192]; int main(int argc, char *argb[]) { int bbsize; - u_int32_t cks, cks1; + uint32_t cks, cks1; bbsize=atol(argb[1]); - bbsize *= (512 / sizeof (u_int32_t)); + bbsize *= (512 / sizeof (uint32_t)); - if (4*bbsize != read(0, myblock, sizeof(u_int32_t)*bbsize)) { + if (4*bbsize != read(0, myblock, sizeof(uint32_t)*bbsize)) { fprintf(stderr, "short read\n"); exit(1); } Index: src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.3 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.4 --- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.3 Mon Apr 28 20:23:13 2008 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h Mon Apr 25 13:43:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: chksum.h,v 1.3 2008/04/28 20:23:13 martin Exp $ */ +/* $NetBSD: chksum.h,v 1.4 2022/04/25 13:43:50 rin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,5 +31,5 @@ #define CHKSUMOFFS 1 -u_int32_t chksum(u_int32_t *, int); +uint32_t chksum(uint32_t *, int); Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.22 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21 Fri Feb 18 06:42:59 2022 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Mon Apr 25 13:43:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.21 2022/02/18 06:42:59 mlelstv Exp $ */ +/* $NetBSD: elf2bb.c,v 1.22 2022/04/25 13:43:50 rin Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -74,8 +74,8 @@ int debug; char *progname; int bbsize = BBSIZE; -u_int8_t *buffer; -u_int32_t *relbuf; +uint8_t *buffer; +uint32_t *relbuf; /* can't have more relocs than that*/ int @@ -83,7 +83,7 @@ intcmp(const void *i, const void *j) { int r; - r = (*(u_int32_t *)i) < (*(u_int32_t *)j); + r = (*(uint32_t *)i) < (*(uint32_t *)j); return 2*r-1; } @@ -98,16 +98,16 @@ main(int argc, char *argv[]) char *shstrtab; Elf32_Sym *symtab; char *strtab; - int eval(Elf32_Sym *, u_int32_t *); - u_int32_t *lptr; + int eval(Elf32_Sym *, uint32_t *); + uint32_t *lptr; int i, l, delta; - u_int8_t *rpo; - u_int32_t oldaddr, addrdiff; - u_int32_t tsz, dsz, bsz, trsz, relver; - u_int32_t pcrelsz, r32sz; + uint8_t *rpo; + uint32_t oldaddr, addrdiff; + uint32_t tsz, dsz, bsz, trsz, relver; + uint32_t pcrelsz, r32sz; int sumsize = 16; int c; - u_int32_t *sect_offset; + uint32_t *sect_offset; int undefsyms; uint32_t tmp32; uint16_t tmp16; @@ -163,7 +163,7 @@ main(int argc, char *argv[]) strtab = NULL; /*XXX*/ dprintf(("name type flagsaddr offset size align\n")); for (i = 0; i < htobe16(eh->e_shnum); ++i) { - u_int32_t sh_size; + uint32_t sh_size; dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i, htobe32(sh[i].sh_name), shstrtab + htobe32(sh[i].sh_name), @@ -244,7 +244,7 @@ retry: memset(buffer, 0, bbsize); /* Allocate and load loadable sections */ - sect_offset = (u_int32_t *)malloc(htobe16(eh->e_shnum) * sizeof(u_int32_t)); + sect_offset = (uint32_t *)malloc(htobe16(eh->e_shnum) * sizeof(uint32_t)); for (i = 0, l = 0; i < htobe16(eh->e_shnum); ++i) { if (htobe32(sh[i].sh_flags) & SHF_ALLOC) { dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n", @@ -264,7 +264,7 @@ retry: * relocator version. For now, check that the relocator at * the image
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: rin Date: Mon Apr 25 13:43:50 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c chksum.h elf2bb.c Log Message: u_intN_t --> uintN_t No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: mlelstv Date: Fri Feb 18 06:43:00 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Don't crash when reporting an undefined symbol. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.20 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.20 Tue May 18 20:34:20 2021 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Fri Feb 18 06:42:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.20 2021/05/18 20:34:20 dholland Exp $ */ +/* $NetBSD: elf2bb.c,v 1.21 2022/02/18 06:42:59 mlelstv Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -325,7 +325,7 @@ retry: s = [ELF32_R_SYM(htobe32(ra->r_info))]; if (s->st_shndx == ELF_SYM_UNDEFINED) { fprintf(stderr, "Undefined symbol: %s\n", -strtab + s->st_name); +strtab + htobe32(s->st_name)); ++undefsyms; } value = htobe32(ra->r_addend) + eval(s, sect_offset);
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: mlelstv Date: Fri Feb 18 06:43:00 UTC 2022 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Don't crash when reporting an undefined symbol. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.