Ignore:
Timestamp:
May 26, 2003, 4:43:12 PM (22 years ago)
Author:
zap
Message:

See ChangeLog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxexp/emxexp.c

    • Property cvs2svn:cvs-rev changed from 1.6 to 1.7
    r235 r236  
    2727#include <errno.h>
    2828#include <ar.h>
     29#include <sys/omflib.h>
     30#include <a_out.h>
    2931#include "defs.h"
    30 #include <sys/omflib.h>
    3132#include "demangle.h"
    32 
    33 #define VERSION "0.9d"
    34 #include "../../../../include/innotekversion.h"
    3533
    3634struct bss_list
     
    7573{
    7674  void *p;
    77 
     75 
    7876  p = malloc (n);
    7977  if (p == NULL)
     
    9088{
    9189  void *p;
    92 
     90 
    9391  p = realloc (ptr, n);
    9492  if (p == NULL)
     
    102100static void usage (void)
    103101{
    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"
    105103         "Usage: emxexp [-n] [-u] [-o[<ordinal>] <input_file>...\n\n"
    106104         "Options:\n"
     
    170168{
    171169  byte *inp_buf;
    172   const struct a_out_header *a_out_h;
     170  const struct exec *a_out_h;
    173171  const byte *sym;
    174172  const struct nlist *sym_ptr;
     
    183181  size = fread (inp_buf, 1, size, inp_file);
    184182
    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)
    187185    error ("Malformed input file `%s'", inp_fname);
    188   sym = (inp_buf + sizeof (struct a_out_header) + a_out_h->text_size
    189          + 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)
    191189    return;
    192   str_ptr = sym + a_out_h->sym_size;
     190  str_ptr = sym + a_out_h->a_syms;
    193191  if (str_ptr + 4 - inp_buf > size)
    194192    error ("Malformed input file `%s'", inp_fname);
    195193  str_size = *(long *)str_ptr;
    196194  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);
    198196  if (str_ptr + str_size - inp_buf > size)
    199197    error ("Malformed input file `%s'", inp_fname);
    200198
    201199  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) ||
    204202        (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)))
    207205      {
    208         name = str_ptr + sym_ptr[i].string;
     206        name = str_ptr + sym_ptr[i].n_un.n_strx;
    209207        export (name);
    210208      }
    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)
    215213      {
    216         name = str_ptr + sym_ptr[i].string;
     214        name = str_ptr + sym_ptr[i].n_un.n_strx;
    217215        export_bss (name);
    218216      }
Note: See TracChangeset for help on using the changeset viewer.