Changeset 236 for trunk/src/emx/src/emxexp/emxexp.c
- Timestamp:
- May 26, 2003, 4:43:12 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/src/emx/src/emxexp/emxexp.c (modified) (6 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxexp/emxexp.c
-
Property cvs2svn:cvs-rev
changed from
1.6to1.7
r235 r236 27 27 #include <errno.h> 28 28 #include <ar.h> 29 #include <sys/omflib.h> 30 #include <a_out.h> 29 31 #include "defs.h" 30 #include <sys/omflib.h>31 32 #include "demangle.h" 32 33 #define VERSION "0.9d"34 #include "../../../../include/innotekversion.h"35 33 36 34 struct bss_list … … 75 73 { 76 74 void *p; 77 75 78 76 p = malloc (n); 79 77 if (p == NULL) … … 90 88 { 91 89 void *p; 92 90 93 91 p = realloc (ptr, n); 94 92 if (p == NULL) … … 102 100 static void usage (void) 103 101 { 104 fputs ("emxexp " VERSION INNOTEK_VERSION" -- Copyright (c) 1993-1995 by Eberhard Mattes\n\n"102 fputs ("emxexp " VERSION " -- Copyright (c) 1993-1995 by Eberhard Mattes\n\n" 105 103 "Usage: emxexp [-n] [-u] [-o[<ordinal>] <input_file>...\n\n" 106 104 "Options:\n" … … 170 168 { 171 169 byte *inp_buf; 172 const struct a_out_header*a_out_h;170 const struct exec *a_out_h; 173 171 const byte *sym; 174 172 const struct nlist *sym_ptr; … … 183 181 size = fread (inp_buf, 1, size, inp_file); 184 182 185 a_out_h = (struct a_out_header*)inp_buf;186 if (size < sizeof (struct a_out_header) || a_out_h->magic != 0407)183 a_out_h = (struct exec *)inp_buf; 184 if (size < sizeof (struct exec) || N_MAGIC (*a_out_h) != OMAGIC) 187 185 error ("Malformed input file `%s'", inp_fname); 188 sym = (inp_buf + sizeof (struct a_out_header) + a_out_h->text_size189 + a_out_h-> data_size + a_out_h->trsize + a_out_h->drsize);190 if (!a_out_h-> sym_size)186 sym = (inp_buf + sizeof (struct exec) + a_out_h->a_text 187 + a_out_h->a_data + a_out_h->a_trsize + a_out_h->a_drsize); 188 if (!a_out_h->a_syms) 191 189 return; 192 str_ptr = sym + a_out_h-> sym_size;190 str_ptr = sym + a_out_h->a_syms; 193 191 if (str_ptr + 4 - inp_buf > size) 194 192 error ("Malformed input file `%s'", inp_fname); 195 193 str_size = *(long *)str_ptr; 196 194 sym_ptr = (const struct nlist *)sym; 197 sym_count = a_out_h-> sym_size/ sizeof (struct nlist);195 sym_count = a_out_h->a_syms / sizeof (struct nlist); 198 196 if (str_ptr + str_size - inp_buf > size) 199 197 error ("Malformed input file `%s'", inp_fname); 200 198 201 199 for (i = 0; i < sym_count; ++i) 202 if (sym_ptr[i]. type == (N_TEXT|N_EXT) ||203 sym_ptr[i]. type == (N_DATA|N_EXT) ||200 if (sym_ptr[i].n_type == (N_TEXT|N_EXT) || 201 sym_ptr[i].n_type == (N_DATA|N_EXT) || 204 202 (weak_flag && 205 (sym_ptr[i]. type == N_WEAKT ||206 sym_ptr[i]. type == N_WEAKD)))203 (sym_ptr[i].n_type == N_WEAKT || 204 sym_ptr[i].n_type == N_WEAKD))) 207 205 { 208 name = str_ptr + sym_ptr[i]. string;206 name = str_ptr + sym_ptr[i].n_un.n_strx; 209 207 export (name); 210 208 } 211 else if ((sym_ptr[i]. type == N_EXT ||212 sym_ptr[i]. type == (N_BSS|N_EXT) ||213 (weak_flag && sym_ptr[i]. type == N_WEAKB)) &&214 sym_ptr[i]. value != 0)209 else if ((sym_ptr[i].n_type == N_EXT || 210 sym_ptr[i].n_type == (N_BSS|N_EXT) || 211 (weak_flag && sym_ptr[i].n_type == N_WEAKB)) && 212 sym_ptr[i].n_value != 0) 215 213 { 216 name = str_ptr + sym_ptr[i]. string;214 name = str_ptr + sym_ptr[i].n_un.n_strx; 217 215 export_bss (name); 218 216 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
