fixed to generate only external commons. This cannot be done in common.c
because an external could later be declared static, and a static could later be declared external.
This commit is contained in:
parent
d6dfd5d1ad
commit
19dad4482b
|
@ -8,7 +8,10 @@ arith n;
|
||||||
extern int Label, label_waiting;
|
extern int Label, label_waiting;
|
||||||
register struct outname *nm = &symbol_table[Label];
|
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);
|
nm->on_type |= S_COM | (S_MIN+SEGBSS);
|
||||||
if (n > nm->on_valu) {
|
if (n > nm->on_valu) {
|
||||||
nm->on_valu = n;
|
nm->on_valu = n;
|
||||||
|
@ -17,6 +20,5 @@ arith n;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switchseg(SEGBSS);
|
switchseg(SEGBSS);
|
||||||
dump_label();
|
|
||||||
bss(n);
|
bss(n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
#include <out.h>
|
#include <out.h>
|
||||||
#include "mach.h"
|
#include "mach.h"
|
||||||
#include "data.h"
|
#include "back.h"
|
||||||
|
|
||||||
static reduce_name_table();
|
static reduce_name_table();
|
||||||
|
|
||||||
|
@ -125,9 +125,20 @@ reduce_name_table()
|
||||||
rp++;
|
rp++;
|
||||||
}
|
}
|
||||||
for (i = 0; i < nname; i++) {
|
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]) {
|
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];
|
nname -= diff_index[nname - 1];
|
||||||
|
|
|
@ -24,6 +24,15 @@ do_local_relocation()
|
||||||
register struct outname *np = &symbol_table[rp->or_nami];
|
register struct outname *np = &symbol_table[rp->or_nami];
|
||||||
int olddiff = diff;
|
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)) {
|
if ( np->on_valu != -1 && ! (np->on_type & S_COM)) {
|
||||||
register long oldval,newval;
|
register long oldval,newval;
|
||||||
register char *sect;
|
register char *sect;
|
||||||
|
|
Loading…
Reference in a new issue