changes to hide names and some fixes

This commit is contained in:
ceriel 1989-01-17 10:27:55 +00:00
parent b800af87af
commit 9c5f0e8159
6 changed files with 37 additions and 24 deletions

View file

@ -10,7 +10,7 @@ IDIRS=-I.\
-I$(EMHOME)/modules/h -I$(EMHOME)/modules/h
all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\ all : data.o con2.o con4.o relocation.o end_back.o gen1.o gen2.o\
gen4.o init_back.o mysprint.o output.o reloc1.o reloc2.o reloc4.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\ 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\ text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.o\
common.o common.o
@ -51,9 +51,6 @@ init_back.o : data.h back.h ../mach.h $(SOURCE)/init_back.c
end_back.o : data.h back.h ../mach.h ../end_back.c end_back.o : data.h back.h ../mach.h ../end_back.c
$(CC) $(CFLAGS) -c $(IDIRS) -I.. ../end_back.c $(CC) $(CFLAGS) -c $(IDIRS) -I.. ../end_back.c
mysprint.o : data.h back.h data.h $(SOURCE)/mysprint.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/mysprint.c
output.o : data.h back.h ../mach.h ../output.c output.o : data.h back.h ../mach.h ../output.c
$(CC) $(CFLAGS) -c $(IDIRS) -I.. ../output.c $(CC) $(CFLAGS) -c $(IDIRS) -I.. ../output.c

View file

@ -1,8 +1,8 @@
#include <system.h> #include <system.h>
extern File *out_file; extern File *_out_file;
close_back() close_back()
{ {
sys_close( out_file); sys_close( _out_file);
} }

View file

@ -1,6 +1,6 @@
#include <system.h> #include <system.h>
File *out_file; File *_out_file;
open_back( filename) open_back( filename)
char *filename; char *filename;
@ -8,6 +8,6 @@ char *filename;
if ( filename == (char *) '\0') if ( filename == (char *) '\0')
return( 0); return( 0);
else else
return( sys_open( filename, OP_WRITE, &out_file)); return( sys_open( filename, OP_WRITE, &_out_file));
} }

View file

@ -1,22 +1,35 @@
#include <out.h> #include <out.h>
#include "mach.h" #include "mach.h"
#include "data.h"
#include "back.h" #include "back.h"
#include "header.h" #include "header.h"
static do_algn(); static finish_tables();
end_back() end_back()
{ {
do_algn(); finish_tables();
do_local_relocation(); do_local_relocation();
output(); output_back();
} }
static static
do_algn() finish_tables()
{ {
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);
}
}
while ( ( text - text_area) % EM_WSIZE != 0 ) while ( ( text - text_area) % EM_WSIZE != 0 )
text1( '\0'); text1( '\0');
while ( ( data - data_area) % EM_WSIZE != 0 ) while ( ( data - data_area) % EM_WSIZE != 0 )

View file

@ -11,24 +11,27 @@
Read above comment ... Read above comment ...
#endif #endif
extern File *out_file; extern File *_out_file;
#include <a.out.h> #include <a.out.h>
#include <alloc.h> #include <alloc.h>
static struct exec u_header; static struct exec u_header;
long ntext, ndata, nrelo, nchar; static long ntext, ndata, nrelo, nchar;
long base_address[SEGBSS+1]; long _base_address[SEGBSS+1];
static int trsize=0, drsize=0; static int trsize=0, drsize=0;
static struct relocation_info *u_reloc; static struct relocation_info *u_reloc;
static reduce_name_table(); static reduce_name_table();
static putbuf(), put_stringtablesize();
static init_unixheader();
static convert_reloc(), convert_name()
output() output_back()
{ {
register int i; register int i;
register struct nlist *u_name; register struct nlist *u_name;
@ -250,7 +253,7 @@ register struct nlist *u_name;
u_name->n_value = a_name->on_valu; u_name->n_value = a_name->on_valu;
else if ( a_name->on_valu != -1) else if ( a_name->on_valu != -1)
u_name->n_value = a_name->on_valu + u_name->n_value = a_name->on_valu +
base_address[( a_name->on_type & S_TYP) - S_MIN]; _base_address[( a_name->on_type & S_TYP) - S_MIN];
else else
u_name->n_value = 0; u_name->n_value = 0;
} }
@ -266,5 +269,5 @@ putbuf(buf,n)
char *buf; char *buf;
long n; long n;
{ {
sys_write( out_file, buf, n); sys_write( _out_file, buf, n);
} }

View file

@ -5,7 +5,7 @@
/* Written to run on SUN, and generate code for SUN */ /* Written to run on SUN, and generate code for SUN */
extern long base_address[]; extern long _base_address[];
do_local_relocation() do_local_relocation()
{ {
@ -13,9 +13,9 @@ do_local_relocation()
/* print( "n relocation records %d\n", relo - reloc_info); */ /* print( "n relocation records %d\n", relo - reloc_info); */
base_address[SEGTXT] = 0; _base_address[SEGTXT] = 0;
base_address[SEGCON] = text - text_area; _base_address[SEGCON] = text - text_area;
base_address[SEGBSS] = base_address[SEGCON] + data - data_area; _base_address[SEGBSS] = _base_address[SEGCON] + data - data_area;
for ( rp = reloc_info; rp < relo; rp++) { for ( rp = reloc_info; rp < relo; rp++) {
register struct outname *np = &symbol_table[rp->or_nami]; register struct outname *np = &symbol_table[rp->or_nami];
@ -38,7 +38,7 @@ do_local_relocation()
if ( rp->or_type & RELO4) if ( rp->or_type & RELO4)
*((long *)(sect+rp->or_addr)) += *((long *)(sect+rp->or_addr)) +=
np->on_valu + np->on_valu +
base_address[(np->on_type&S_TYP)-S_MIN]; _base_address[(np->on_type&S_TYP)-S_MIN];
else else
fprint( STDERR, fprint( STDERR,
"do_relo() : bad relocation size\n"); "do_relo() : bad relocation size\n");