Added dbsym and updated output.c
authorceriel <none@none>
Wed, 13 Nov 1991 16:54:59 +0000 (16:54 +0000)
committerceriel <none@none>
Wed, 13 Nov 1991 16:54:59 +0000 (16:54 +0000)
mach/sun3/ce/Make.back
mach/sun3/ce/output.c

index eced994..9327475 100644 (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\
       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\
-      common.o
+      common.o dbsym.o
 
 data.o : data.h back.h header.h $(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
        $(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/memory.c
 
index 92231ab..8f89e2c 100644 (file)
@@ -103,8 +103,8 @@ reduce_name_table()
         * After that, the string table is reduced.
         */
 
-#define S_NEEDED       0x8000
-#define removable(nm)  (!(nm->on_type & S_NEEDED) && *(nm->on_foff+string_area) == GENLAB)
+#define S_NEEDED       S_MOD
+#define removable(nm)  (!(nm->on_type & (S_NEEDED|S_STB)) && *(nm->on_foff+string_area) == GENLAB)
 
        register int *diff_index =
                (int *) Malloc((unsigned)(nname + 1) * sizeof(int));
@@ -131,20 +131,35 @@ reduce_name_table()
                }
                else {
                        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;
        for (i = nrelo; i > 0; i--, rp++) {
                if (rp->r_extern) {
+                       symbol_table[rp->r_symbolnum].on_type &= ~S_NEEDED;
                        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));
 
        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);   */
 
        u_name->n_str = a_name->on_foff + 4;
-       if ((a_name->on_type & S_TYP) == S_UND ||
-           (a_name->on_type & S_EXT)) u_name->n_type = N_EXT;
+       if (a_name->on_type & S_STB) u_name->n_type = a_name->on_type >> 8;
        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))) {
                switch((a_name->on_type & S_TYP) - S_MIN) {
                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_desc = 0;
+       u_name->n_desc = a_name->on_desc;
        if (a_name->on_type & S_COM) 
                u_name->n_value = a_name->on_valu;
        else if ( a_name->on_valu != -1)