diff --git a/util/ceg/ce_back/obj_back/common.c b/util/ceg/ce_back/obj_back/common.c index c6579f859..d990f85da 100644 --- a/util/ceg/ce_back/obj_back/common.c +++ b/util/ceg/ce_back/obj_back/common.c @@ -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); } diff --git a/util/ceg/ce_back/obj_back/output.c b/util/ceg/ce_back/obj_back/output.c index c95b4a84b..16d0ca6a8 100644 --- a/util/ceg/ce_back/obj_back/output.c +++ b/util/ceg/ce_back/obj_back/output.c @@ -2,7 +2,7 @@ #include #include #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]; diff --git a/util/ceg/ce_back/obj_back/relocation.c b/util/ceg/ce_back/obj_back/relocation.c index 6aa198eb3..d9ec080ba 100644 --- a/util/ceg/ce_back/obj_back/relocation.c +++ b/util/ceg/ce_back/obj_back/relocation.c @@ -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;