Changeset 1207


Ignore:
Timestamp:
Feb 9, 2004, 1:10:15 AM (22 years ago)
Author:
bird
Message:

#883: Fixed crash due to fixup to weak symbol.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r1206 r1207  
    20262026          if (!s || !s->defined)
    20272027            enter_global_ref (p, p->n_un.n_strx + entry->strings, entry);
     2028          else if (s) /* hack! */
     2029              p->n_un.n_name = (char*)s;
     2030#ifdef DEBUG
     2031          else fprintf(stderr, "dbg-warning: %s - sym %d: '%s' no such symbol...\n",
     2032                       entry->filename,
     2033                       p - entry->symbols,
     2034                       p->n_un.n_strx + entry->strings);
     2035#endif
    20282036        }
    20292037      else if (p->n_type & N_EXT)
     
    20362044        }
    20372045      else debugger_sym_count++;
     2046#ifdef DEBUG_BIRD
     2047      fprintf(stderr, "dbg: %s sym #%3d: un=%08lx typ=%02x\n",
     2048              entry->filename,
     2049              p - entry->symbols,
     2050              p->n_un.n_strx,
     2051              p->n_type);
     2052#endif
    20382053    }
    20392054
     
    21542169    text_start = nlist_p->n_value;
    21552170
     2171#ifdef DEBUG_BIRD
     2172  sp->trace = 1;
     2173#endif
    21562174  if (sp->trace)
    21572175    {
     
    22282246        }
    22292247
    2230       fprintf (stderr, "symbol %s %s in ", sp->name, reftype);
     2248
     2249      fprintf (stderr, "symbol in ");
    22312250      print_file_name (entry, stderr);
    2232       fprintf (stderr, "\n");
     2251      fprintf (stderr, ": %3d %s %s\n",
     2252               nlist_p - entry->symbols, sp->name, reftype);
    22332253    }
    22342254}
     
    40754095void perform_relocation ( char *data, int pc_relocation, int data_size,
    40764096    struct relocation_info *reloc_info, int reloc_size, struct file_entry *entry);
     4097#ifdef DEBUG_BIRD
     4098void dbg_dump_rel(struct file_entry *entry, struct relocation_info * rel,
     4099                  size_t reloc_size, const char *desc);
     4100#endif
    40774101
    40784102/* Relocate the text segment of each input file
     
    41374161      entry->datarel = reloc;
    41384162    }
     4163#ifdef DEBUG_BIRD
     4164  dbg_dump_rel(entry, entry->textrel, entry->text_reloc_size, "text");
     4165  dbg_dump_rel(entry, entry->datarel, entry->data_reloc_size, "data");
     4166#endif
    41394167}
    41404168
     
    41914219  mywrite (bytes, 1, entry->text_size, outdesc);
    41924220}
     4221
     4222#ifdef DEBUG_BIRD
     4223void dbg_dump_rel(struct file_entry *entry, struct relocation_info * rel,
     4224                  size_t reloc_size, const char *desc)
     4225{
     4226  struct relocation_info   *relend = (struct relocation_info *)((char*)rel + reloc_size);
     4227  int                       i;
     4228
     4229  fprintf(stderr,
     4230          "dbg: %s relocations %s:\n"
     4231          "dbg: rel - Address  len sym#   attrs\n",
     4232          desc, entry->filename);
     4233  i = 0;
     4234  while (rel < relend)
     4235    {
     4236      fprintf(stderr, "dbg: %3d - %08x 2^%d %06x %s%s",
     4237              i,
     4238              rel->r_address,
     4239              rel->r_length,
     4240              rel->r_symbolnum,
     4241              rel->r_extern ? "Extrn " : "      ",
     4242              rel->r_pcrel  ? "PCRel " : "      "
     4243              );
     4244      if (rel->r_extern)
     4245        { /* find the symbol. */
     4246          struct nlist *s = &entry->symbols[rel->r_symbolnum];
     4247          fprintf(stderr, " s.val:%08lx s.typ:%02x s.des:%04x s.oth:%02x",
     4248                  s->n_value,
     4249                  (unsigned)s->n_type,
     4250                  s->n_desc,
     4251                  (unsigned)s->n_other);
     4252          if (s->n_un.n_strx < 0x20000)
     4253            fprintf(stderr, " !!bad symbol ptr %p", s->n_un.n_name);
     4254          else
     4255            {
     4256              struct glosym *sym = (struct glosym *)s->n_un.n_name;
     4257              fprintf(stderr, " %s", sym->name);
     4258            }
     4259        }
     4260      fprintf(stderr, "\n");
     4261      /* next */
     4262      i++;
     4263      rel++;
     4264    }
     4265}
     4266#endif
    41934267
    41944268
Note: See TracChangeset for help on using the changeset viewer.