Added dbsym and updated output.c

This commit is contained in:
ceriel 1991-11-13 16:54:59 +00:00
parent de620e1fd5
commit ac51febc8b
2 changed files with 33 additions and 10 deletions

View file

@ -14,11 +14,14 @@ all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\
gen4.o init_back.o output.o reloc1.o reloc2.o reloc4.o\ gen4.o init_back.o output.o reloc1.o reloc2.o reloc4.o\
rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o text2.o\ rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o text2.o\
text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o\ text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o\
common.o common.o dbsym.o
data.o : data.h back.h header.h $(SOURCE)/data.c data.o : data.h back.h header.h $(SOURCE)/data.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/data.c $(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/data.c
dbsym.o : data.h back.h header.h $(SOURCE)/dbsym.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/dbsym.c
memory.o :data.h back.h header.h $(SOURCE)/memory.c memory.o :data.h back.h header.h $(SOURCE)/memory.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/memory.c $(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/memory.c

View file

@ -103,8 +103,8 @@ reduce_name_table()
* After that, the string table is reduced. * After that, the string table is reduced.
*/ */
#define S_NEEDED 0x8000 #define S_NEEDED S_MOD
#define removable(nm) (!(nm->on_type & S_NEEDED) && *(nm->on_foff+string_area) == GENLAB) #define removable(nm) (!(nm->on_type & (S_NEEDED|S_STB)) && *(nm->on_foff+string_area) == GENLAB)
register int *diff_index = register int *diff_index =
(int *) Malloc((unsigned)(nname + 1) * sizeof(int)); (int *) Malloc((unsigned)(nname + 1) * sizeof(int));
@ -131,20 +131,35 @@ reduce_name_table()
} }
else { else {
diff_index[i] = old_diff_index; diff_index[i] = old_diff_index;
if (old_diff_index) {
symbol_table[i - old_diff_index] = *np;
}
} }
if ((np->on_type & S_TYP) == S_CRS) {
struct outname *n = &symbol_table[(int) np->on_valu];
if (! (n->on_type & S_COM)) {
np->on_type &= ~S_TYP;
np->on_type |= (n->on_type & S_TYP);
np->on_valu = n->on_valu;
}
}
} }
nname -= diff_index[nname - 1];
rp = u_reloc; rp = u_reloc;
for (i = nrelo; i > 0; i--, rp++) { for (i = nrelo; i > 0; i--, rp++) {
if (rp->r_extern) { if (rp->r_extern) {
symbol_table[rp->r_symbolnum].on_type &= ~S_NEEDED;
rp->r_symbolnum -= diff_index[rp->r_symbolnum]; rp->r_symbolnum -= diff_index[rp->r_symbolnum];
} }
} }
for (i = 0, np = symbol_table; i < nname; i++, np++) {
if ((np->on_type & S_TYP) == S_CRS) {
np->on_valu -= diff_index[(int) np->on_valu];
}
if (diff_index[i] && diff_index[i] == diff_index[i-1]) {
symbol_table[i - diff_index[i]] = *np;
}
}
nname -= diff_index[nname - 1];
free((char *)(diff_index-1)); free((char *)(diff_index-1));
new_str = q = Malloc((unsigned)(string - string_area)); new_str = q = Malloc((unsigned)(string - string_area));
@ -229,9 +244,12 @@ register struct nlist *u_name;
/* print( "naam is %s\n", a_name->on_foff + string_area); */ /* print( "naam is %s\n", a_name->on_foff + string_area); */
u_name->n_str = a_name->on_foff + 4; u_name->n_str = a_name->on_foff + 4;
if ((a_name->on_type & S_TYP) == S_UND || if (a_name->on_type & S_STB) u_name->n_type = a_name->on_type >> 8;
(a_name->on_type & S_EXT)) u_name->n_type = N_EXT;
else u_name->n_type = 0; else u_name->n_type = 0;
if ((a_name->on_type & S_TYP) == S_CRS) {
a_name->on_valu = 0;
a_name->on_type = S_COM;
}
if (a_name->on_valu != -1 && (! (a_name->on_type & S_COM))) { if (a_name->on_valu != -1 && (! (a_name->on_type & S_COM))) {
switch((a_name->on_type & S_TYP) - S_MIN) { switch((a_name->on_type & S_TYP) - S_MIN) {
case SEGTXT: case SEGTXT:
@ -251,8 +269,10 @@ register struct nlist *u_name;
*/ */
} }
} }
if ((a_name->on_type & S_TYP) == S_UND ||
(a_name->on_type & S_EXT)) u_name->n_type |= N_EXT;
u_name->n_other = '\0'; u_name->n_other = '\0';
u_name->n_desc = 0; u_name->n_desc = a_name->on_desc;
if (a_name->on_type & S_COM) if (a_name->on_type & S_COM)
u_name->n_value = a_name->on_valu; u_name->n_value = a_name->on_valu;
else if ( a_name->on_valu != -1) else if ( a_name->on_valu != -1)