fixed to generate only external commons. This cannot be done in common.c
authorceriel <none@none>
Thu, 10 Nov 1988 13:16:22 +0000 (13:16 +0000)
committerceriel <none@none>
Thu, 10 Nov 1988 13:16:22 +0000 (13:16 +0000)
because an external could later be declared static, and a static could later
be declared external.

util/ceg/ce_back/obj_back/common.c
util/ceg/ce_back/obj_back/output.c
util/ceg/ce_back/obj_back/relocation.c

index c6579f8..d990f85 100644 (file)
@@ -8,7 +8,10 @@ arith n;
        extern int Label, label_waiting;
        register struct outname *nm = &symbol_table[Label];
 
-       if (label_waiting && (nm->on_type & S_EXT)) {
+       if (label_waiting) {
+               /*      If possible, generate a common. Local commons must
+                       be delt with later.
+               */
                nm->on_type |= S_COM | (S_MIN+SEGBSS);
                if (n > nm->on_valu) {
                        nm->on_valu = n;
@@ -17,6 +20,5 @@ arith n;
                return;
        }
        switchseg(SEGBSS);
-       dump_label();
        bss(n);
 }
index c95b4a8..16d0ca6 100644 (file)
@@ -2,7 +2,7 @@
 #include <alloc.h>
 #include <out.h>
 #include "mach.h"
-#include "data.h"
+#include "back.h"
 
 static reduce_name_table();
 
@@ -125,9 +125,20 @@ reduce_name_table()
                rp++;
        }
        for (i = 0; i < nname; i++) {
-               symbol_table[i].on_type &= ~S_NEEDED;
+               register struct outname *np = &symbol_table[i];
+
+               np->on_type &= ~S_NEEDED;
+               if ((np->on_type & S_COM) && ! (np->on_type & S_EXT)) {
+                       long sz = np->on_valu;
+
+                       switchseg(SEGBSS);
+                       align_word();
+                       np->on_type &= (~S_COM);
+                       np->on_valu = cur_value();
+                       bss(sz);
+               }
                if (diff_index[i] && diff_index[i] == diff_index[i-1]) {
-                       symbol_table[i - diff_index[i]] = symbol_table[i];
+                       symbol_table[i - diff_index[i]] = *np;
                }
        }
        nname -= diff_index[nname - 1];
index 6aa198e..d9ec080 100644 (file)
@@ -24,6 +24,15 @@ do_local_relocation()
                register struct outname *np = &symbol_table[rp->or_nami];
                int olddiff = diff;
                
+               if ((np->on_type & S_COM) && ! (np->on_type & S_EXT)) {
+                       long sz = np->on_valu;
+
+                       switchseg(SEGBSS);
+                       align_word();
+                       np->on_type &= (~S_COM);
+                       np->on_valu = cur_value();
+                       bss(sz);
+               }
                if ( np->on_valu  != -1 && ! (np->on_type & S_COM)) {
                        register long oldval,newval;
                        register char *sect;