Deleted Added
sdiff udiff text old ( 31442 ) new ( 35575 )
full compact
1/*
2 * Copyright (C) 1996-1997 John D. Polstra. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 * $Id: sods.c,v 1.5 1997/09/02 21:54:39 jdp Exp $
26 */
27
28#include <assert.h>
29#include <ctype.h>
30#include <fcntl.h>
31#include <stdarg.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36
37#include <sys/types.h>
38#include <sys/mman.h>
39#include <sys/stat.h>
40
41#include <a.out.h>
42#include <link.h>
43#include <stab.h>
44
45#define PAGE_SIZE 4096 /* i386 specific */
46
47#ifndef N_SETA
48#define N_SETA 0x14 /* Absolute set element symbol */
49#endif /* This is input to LD, in a .o file. */

--- 118 unchanged lines hidden (view full) ---

168 close(fd);
169 return;
170 }
171
172 close(fd);
173
174 file_base = (const char *) objbase; /* Makes address arithmetic easier */
175
176 ex = (const struct exec *) file_base;
177
178 printf("%s: a_midmag = 0x%lx\n", fname, ex->a_midmag);
179 printf(" magic = 0x%lx = 0%lo, netmagic = 0x%lx = 0%lo\n",
180 N_GETMAGIC(*ex), N_GETMAGIC(*ex),
181 N_GETMAGIC_NET(*ex), N_GETMAGIC_NET(*ex));
182
183 if (N_BADMAG(*ex)) {

--- 22 unchanged lines hidden (view full) ---

206 assert(sym_count * sizeof sym_base[0] == ex->a_syms);
207
208 if (sym_count != 0) {
209 sym_used = (unsigned char *) calloc(sym_count, sizeof(unsigned char));
210 assert(sym_used != NULL);
211 }
212
213 printf(" Entry = 0x%lx\n", ex->a_entry);
214 printf(" Text offset = %x, address = %x\n", N_TXTOFF(*ex),
215 N_TXTADDR(*ex));
216 printf(" Data offset = %lx, address = %lx\n", N_DATOFF(*ex),
217 N_DATADDR(*ex));
218
219 /*
220 * In an executable program file, everything is relocated relative to
221 * the assumed run-time load address, i.e., N_TXTADDR(*ex), i.e., 0x1000.
222 *

--- 324 unchanged lines hidden ---