Module Name: src
Committed By: tsutsui
Date: Thu Jul 30 15:16:38 UTC 2009
Modified Files:
src/usr.sbin/mdsetimage: exec_aout.c exec_coff.c exec_ecoff.c
exec_elf32.c mdsetimage.c
Log Message:
WARNS'fy sources which are left for reference.
src/usr.sbin/mdsetimage has been superseded by src/gnu/usr.sbin/mdsetimage
for toolchain to handle cross build binaries, but these old sources for
local executable binaries still can be used for tools to patch binaries,
like binpatch utility in sys/arch/amiga/stand and sys/arch/atari/stand.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/mdsetimage/exec_aout.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/mdsetimage/exec_coff.c \
src/usr.sbin/mdsetimage/exec_ecoff.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/mdsetimage/exec_elf32.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/mdsetimage/mdsetimage.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/mdsetimage/exec_aout.c
diff -u src/usr.sbin/mdsetimage/exec_aout.c:1.6 src/usr.sbin/mdsetimage/exec_aout.c:1.7
--- src/usr.sbin/mdsetimage/exec_aout.c:1.6 Mon Oct 1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_aout.c Thu Jul 30 15:16:37 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_aout.c,v 1.7 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec_aout.c,v 1.6 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_aout.c,v 1.7 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -53,14 +53,14 @@
const char *mappedfile;
size_t mappedsize;
{
- struct exec *execp;
+ const struct exec *execp;
int rv;
rv = 0;
if (check(0, sizeof *execp))
BAD;
- execp = (struct exec *)&mappedfile[0];
+ execp = (const struct exec *)&mappedfile[0];
if (N_BADMAG(*execp))
BAD;
@@ -75,11 +75,11 @@
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
- struct exec *execp;
+ const struct exec *execp;
int rv;
rv = 0;
- execp = (struct exec *)&mappedfile[0];
+ execp = (const struct exec *)&mappedfile[0];
if (N_TXTADDR(*execp) + (execp->a_entry & (N_PAGSIZ(*execp)-1)) !=
execp->a_entry)
Index: src/usr.sbin/mdsetimage/exec_coff.c
diff -u src/usr.sbin/mdsetimage/exec_coff.c:1.5 src/usr.sbin/mdsetimage/exec_coff.c:1.6
--- src/usr.sbin/mdsetimage/exec_coff.c:1.5 Mon Oct 1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_coff.c Thu Jul 30 15:16:37 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_coff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec_coff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_coff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -53,14 +53,14 @@
const char *mappedfile;
size_t mappedsize;
{
- struct coff_exechdr *exechdrp;
+ const struct coff_exechdr *exechdrp;
int rv;
rv = 0;
if (check(0, sizeof *exechdrp))
BAD;
- exechdrp = (struct coff_exechdr *)&mappedfile[0];
+ exechdrp = (const struct coff_exechdr *)&mappedfile[0];
if (COFF_BADMAG(&(exechdrp->f)))
BAD;
@@ -75,11 +75,11 @@
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
- struct coff_exechdr *exechdrp;
+ const struct coff_exechdr *exechdrp;
int rv;
rv = 0;
- exechdrp = (struct coff_exechdr *)&mappedfile[0];
+ exechdrp = (const struct coff_exechdr *)&mappedfile[0];
#define COFF_TXTOFF_XXX(fp, ap) \
(COFF_ROUND(COFF_HDR_SIZE + (fp)->f_nscns * \
@@ -89,12 +89,12 @@
#define COFF_DATOFF_XXX(fp, ap) \
(COFF_TXTOFF_XXX(fp, ap) + (ap)->a_tsize)
- if (exechdrp->a.a_tstart <= vmaddr &&
- vmaddr < (exechdrp->a.a_tstart + exechdrp->a.a_tsize))
+ if ((u_long)exechdrp->a.a_tstart <= vmaddr &&
+ vmaddr < (u_long)(exechdrp->a.a_tstart + exechdrp->a.a_tsize))
*fileoffp = vmaddr - exechdrp->a.a_tstart +
COFF_TXTOFF(&exechdrp->f, &(exechdrp->a));
- else if (exechdrp->a.a_dstart <= vmaddr &&
- vmaddr < (exechdrp->a.a_dstart + exechdrp->a.a_dsize))
+ else if ((u_long)exechdrp->a.a_dstart <= vmaddr &&
+ vmaddr < (u_long)(exechdrp->a.a_dstart + exechdrp->a.a_dsize))
*fileoffp = vmaddr - exechdrp->a.a_dstart +
COFF_DATOFF_XXX(&exechdrp->f, &(exechdrp->a));
else
Index: src/usr.sbin/mdsetimage/exec_ecoff.c
diff -u src/usr.sbin/mdsetimage/exec_ecoff.c:1.5 src/usr.sbin/mdsetimage/exec_ecoff.c:1.6
--- src/usr.sbin/mdsetimage/exec_ecoff.c:1.5 Mon Oct 1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_ecoff.c Thu Jul 30 15:16:37 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_ecoff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_ecoff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec_ecoff.c,v 1.5 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_ecoff.c,v 1.6 2009/07/30 15:16:37 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -50,14 +50,14 @@
const char *mappedfile;
size_t mappedsize;
{
- struct ecoff_exechdr *exechdrp;
+ const struct ecoff_exechdr *exechdrp;
int rv;
rv = 0;
if (check(0, sizeof *exechdrp))
BAD;
- exechdrp = (struct ecoff_exechdr *)&mappedfile[0];
+ exechdrp = (const struct ecoff_exechdr *)&mappedfile[0];
if (ECOFF_BADMAG(exechdrp))
BAD;
@@ -72,11 +72,11 @@
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
- struct ecoff_exechdr *exechdrp;
+ const struct ecoff_exechdr *exechdrp;
int rv;
rv = 0;
- exechdrp = (struct ecoff_exechdr *)&mappedfile[0];
+ exechdrp = (const struct ecoff_exechdr *)&mappedfile[0];
if (exechdrp->a.text_start <= vmaddr &&
vmaddr < (exechdrp->a.text_start + exechdrp->a.tsize))
Index: src/usr.sbin/mdsetimage/exec_elf32.c
diff -u src/usr.sbin/mdsetimage/exec_elf32.c:1.9 src/usr.sbin/mdsetimage/exec_elf32.c:1.10
--- src/usr.sbin/mdsetimage/exec_elf32.c:1.9 Mon Oct 1 23:32:34 2001
+++ src/usr.sbin/mdsetimage/exec_elf32.c Thu Jul 30 15:16:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_elf32.c,v 1.9 2001/10/01 23:32:34 cgd Exp $ */
+/* $NetBSD: exec_elf32.c,v 1.10 2009/07/30 15:16:38 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec_elf32.c,v 1.9 2001/10/01 23:32:34 cgd Exp $");
+__RCSID("$NetBSD: exec_elf32.c,v 1.10 2009/07/30 15:16:38 tsutsui Exp $");
#endif /* not lint */
#ifndef ELFSIZE
@@ -58,14 +58,14 @@
const char *mappedfile;
size_t mappedsize;
{
- Elf_Ehdr *ehdrp;
+ const Elf_Ehdr *ehdrp;
int rv;
rv = 0;
if (check(0, sizeof *ehdrp))
BAD;
- ehdrp = (Elf_Ehdr *)&mappedfile[0];
+ ehdrp = (const Elf_Ehdr *)&mappedfile[0];
if (memcmp(ehdrp->e_ident, ELFMAG, SELFMAG) != 0 ||
ehdrp->e_ident[EI_CLASS] != ELFCLASS)
@@ -88,8 +88,8 @@
size_t mappedsize, *fileoffp;
u_long vmaddr;
{
- Elf_Ehdr *ehdrp;
- Elf_Shdr *shdrp;
+ const Elf_Ehdr *ehdrp;
+ const Elf_Shdr *shdrp;
Elf_Off shdr_off;
Elf_Word shdr_size;
#if (ELFSIZE == 32)
@@ -101,15 +101,15 @@
rv = 0;
- ehdrp = (Elf_Ehdr *)&mappedfile[0];
+ ehdrp = (const Elf_Ehdr *)&mappedfile[0];
nshdr = ehdrp->e_shnum;
shdr_off = ehdrp->e_shoff;
shdr_size = ehdrp->e_shentsize * nshdr;
- if (check(shdr_off, shdr_size) ||
+ if (check(0, shdr_size + shdr_off) ||
(sizeof *shdrp != ehdrp->e_shentsize))
BAD;
- shdrp = (Elf_Shdr *)&mappedfile[shdr_off];
+ shdrp = (const Elf_Shdr *)&mappedfile[shdr_off];
for (i = 0; i < nshdr; i++) {
if (shdrp[i].sh_addr <= vmaddr &&
Index: src/usr.sbin/mdsetimage/mdsetimage.c
diff -u src/usr.sbin/mdsetimage/mdsetimage.c:1.18 src/usr.sbin/mdsetimage/mdsetimage.c:1.19
--- src/usr.sbin/mdsetimage/mdsetimage.c:1.18 Mon Jul 21 13:36:59 2008
+++ src/usr.sbin/mdsetimage/mdsetimage.c Thu Jul 30 15:16:38 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: mdsetimage.c,v 1.18 2008/07/21 13:36:59 lukem Exp $ */
+/* $NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@@ -36,7 +36,7 @@
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: mdsetimage.c,v 1.18 2008/07/21 13:36:59 lukem Exp $");
+__RCSID("$NetBSD: mdsetimage.c,v 1.19 2009/07/30 15:16:38 tsutsui Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -60,10 +60,10 @@
static struct nlist md_root_nlist[] = {
#define X_MD_ROOT_IMAGE 0
- { "_md_root_image" },
+ { "_md_root_image", 0, 0, 0, 0 },
#define X_MD_ROOT_SIZE 1
- { "_md_root_size" },
- { NULL }
+ { "_md_root_size", 0, 0, 0, 0 },
+ { NULL, 0, 0, 0, 0 }
};
int verbose;
@@ -245,7 +245,7 @@
fprintf(stderr, "%s is at offset %#lx in %s\n",
nl[X_MD_ROOT_SIZE].n_name,
(unsigned long)rootsizeoff, fname);
- *rootsizep = *(u_int32_t *)&mappedfile[rootsizeoff];
+ *rootsizep = *(const u_int32_t *)&mappedfile[rootsizeoff];
if (verbose)
fprintf(stderr, "%s has value %#x\n",
nl[X_MD_ROOT_SIZE].n_name, *rootsizep);