Changeset 62


Ignore:
Timestamp:
Apr 29, 2003, 7:13:20 PM (22 years ago)
Author:
bird
Message:
  • Added the `-w' flag to allow exporting weak symbols.
  • Won't barf anymore on empty (but legal) a.out files.
File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r61 r62  
    4242static int noname_flag = FALSE;
    4343static int bss_flag = FALSE;
     44static int weak_flag = FALSE;
    4445
    4546static FILE *out_file;
     
    106107         "  -o          Output ordinal numbers, starting at 1\n"
    107108         "  -o<ordinal> Output ordinal numbers, starting at <ordinal>\n"
    108          "  -u          Also export uninitialized variables\n",
     109         "  -u          Also export uninitialized variables\n"
     110         "  -w          Allow export of weak symbols\n",
    109111         stderr);
    110112  exit (1);
     
    185187  sym = (inp_buf + sizeof (struct a_out_header) + a_out_h->text_size
    186188         + a_out_h->data_size + a_out_h->trsize + a_out_h->drsize);
     189  if (!a_out_h->sym_size)
     190    return;
    187191  str_ptr = sym + a_out_h->sym_size;
    188192  if (str_ptr + 4 - inp_buf > size)
     
    195199
    196200  for (i = 0; i < sym_count; ++i)
    197     if (sym_ptr[i].type == (N_TEXT|N_EXT) || sym_ptr[i].type == (N_DATA|N_EXT))
     201    if (sym_ptr[i].type == (N_TEXT|N_EXT) ||
     202        sym_ptr[i].type == (N_DATA|N_EXT) ||
     203        (weak_flag &&
     204         (sym_ptr[i].type == N_WEAKT ||
     205          sym_ptr[i].type == N_WEAKD)))
    198206      {
    199207        name = str_ptr + sym_ptr[i].string;
     
    202210        export (name);
    203211      }
    204     else if (sym_ptr[i].type == N_EXT && sym_ptr[i].value != 0)
     212    else if ((sym_ptr[i].type == N_EXT ||
     213              (weak_flag && sym_ptr[i].type == N_WEAKB)) &&
     214             sym_ptr[i].value != 0)
    205215      {
    206216        name = str_ptr + sym_ptr[i].string;
     
    577587  _wildcard (&argc, &argv);
    578588  opterr = 0;
    579   optswchar = "-";
     589//optswchar = "-";
    580590  optind = 0;
    581   while ((c = getopt (argc, argv, "no::u")) != EOF)
     591  while ((c = getopt (argc, argv, "no::uw")) != EOF)
    582592    {
    583593      switch (c)
     
    601611          bss_flag = TRUE;
    602612          break;
     613        case 'w':
     614          weak_flag = TRUE;
     615          break;
    603616        default:
    604617          error ("Invalid option");
Note: See TracChangeset for help on using the changeset viewer.