ack/util/ceg/ce_back/obj_back/end_back.c

56 lines
1.1 KiB
C
Raw Normal View History

1987-11-20 10:41:03 +00:00
#include <out.h>
#include "mach.h"
#include "back.h"
#include "header.h"
1988-11-18 17:52:39 +00:00
static
1987-11-25 13:54:01 +00:00
finish_tables()
/* Prepare tables for do_local_relocation() and output().
*/
1987-11-20 10:41:03 +00:00
{
1988-12-06 13:22:34 +00:00
register struct outname *np = symbol_table;
register int i = nname;
for (; i; i--, np++) {
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);
}
}
1987-11-20 10:41:03 +00:00
while ( ( text - text_area) % EM_WSIZE != 0 )
text1( '\0');
while ( ( data - data_area) % EM_WSIZE != 0 )
con1( '\0');
1987-11-25 13:54:01 +00:00
define_segments();
1987-11-20 10:41:03 +00:00
}
static char *seg_name[] = {
".text",
".rom",
".con",
".bss"
};
1988-11-18 17:52:39 +00:00
static
1987-11-20 10:41:03 +00:00
define_segments()
{
int i, s;
for ( s = SEGTXT; s <= SEGBSS; s++) {
i = find_sym( seg_name[s], SYMBOL_DEFINITION);
symbol_table[i].on_type = ( S_MIN + s) | S_SCT;
}
}
1988-11-18 17:52:39 +00:00
end_back()
{
finish_tables();
do_local_relocation();
}