From b800af87af7378d589098c4e775ea10e6efd936d Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 17 Jan 1989 09:48:32 +0000 Subject: [PATCH] changes to hide names and some fixes --- mach/sun3/ce/Make.back | 5 +---- mach/sun3/ce/do_close.c | 4 ++-- mach/sun3/ce/do_open.c | 4 ++-- mach/sun3/ce/end_back.c | 23 ++++++++++++++++++----- mach/sun3/ce/mach.c | 2 +- mach/sun3/ce/output.c | 37 ++++++++++++++++--------------------- mach/sun3/ce/relocation.c | 20 +++++--------------- 7 files changed, 45 insertions(+), 50 deletions(-) diff --git a/mach/sun3/ce/Make.back b/mach/sun3/ce/Make.back index fa9136473..69aa043e3 100644 --- a/mach/sun3/ce/Make.back +++ b/mach/sun3/ce/Make.back @@ -10,7 +10,7 @@ IDIRS=-I.\ -I$(EMHOME)/modules/h 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\ text4.o do_open.o do_close.o memory.o label.o misc.o extnd.o symtable.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 $(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 $(CC) $(CFLAGS) -c $(IDIRS) -I.. ../output.c diff --git a/mach/sun3/ce/do_close.c b/mach/sun3/ce/do_close.c index a9f3721de..88d819cd3 100644 --- a/mach/sun3/ce/do_close.c +++ b/mach/sun3/ce/do_close.c @@ -1,8 +1,8 @@ #include -extern File *out_file; +extern File *_out_file; close_back() { - sys_close( out_file); + sys_close( _out_file); } diff --git a/mach/sun3/ce/do_open.c b/mach/sun3/ce/do_open.c index 337fc6253..7ddd63d87 100644 --- a/mach/sun3/ce/do_open.c +++ b/mach/sun3/ce/do_open.c @@ -1,6 +1,6 @@ #include -File *out_file; +File *_out_file; open_back( filename) char *filename; @@ -8,6 +8,6 @@ char *filename; if ( filename == (char *) '\0') return( 0); else - return( sys_open( filename, OP_WRITE, &out_file)); + return( sys_open( filename, OP_WRITE, &_out_file)); } diff --git a/mach/sun3/ce/end_back.c b/mach/sun3/ce/end_back.c index f776e41ad..152ca5074 100644 --- a/mach/sun3/ce/end_back.c +++ b/mach/sun3/ce/end_back.c @@ -1,22 +1,35 @@ #include #include "mach.h" -#include "data.h" #include "back.h" #include "header.h" -static do_algn(); +static finish_tables(); end_back() { - do_algn(); + finish_tables(); do_local_relocation(); - output(); + output_back(); } 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 ) text1( '\0'); while ( ( data - data_area) % EM_WSIZE != 0 ) diff --git a/mach/sun3/ce/mach.c b/mach/sun3/ce/mach.c index 43cd2a8f1..302307127 100644 --- a/mach/sun3/ce/mach.c +++ b/mach/sun3/ce/mach.c @@ -40,7 +40,7 @@ static int been_here; gen4((FOUR_BYTES) 0); if ( !been_here++) { - fputs("Warning : dummy float-constant(s)\n", stderr); + fprint(STDERR, "Warning : dummy float-constant(s)\n"); } #else #define IEEEFLOAT diff --git a/mach/sun3/ce/output.c b/mach/sun3/ce/output.c index 0d110fd68..003e3a9d7 100644 --- a/mach/sun3/ce/output.c +++ b/mach/sun3/ce/output.c @@ -3,7 +3,6 @@ #include #include "mach.h" #include "back.h" -#include "data.h" /* Unportable code. Written for SUN, meant to be run on a SUN. */ @@ -11,24 +10,25 @@ Read above comment ... #endif -extern File *out_file; +extern File *_out_file; #include #include -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]; -int trsize=0, drsize=0; +static int trsize=0, drsize=0; -struct relocation_info *u_reloc; +static struct relocation_info *u_reloc; -static reduce_name_table(); +static reduce_name_table(), putbuf(), put_stringtablesize(); +static convert_name(), convert_reloc(), init_unixheader(); -output() +output_back() { register int i; register struct nlist *u_name; @@ -126,15 +126,6 @@ reduce_name_table() for (i = 0; i < nname; i++, np++) { int old_diff_index = diff_index[i-1]; - 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 (removable(np)) { diff_index[i] = old_diff_index + 1; } @@ -168,6 +159,7 @@ reduce_name_table() string = q; } +static init_unixheader() { ntext = text - text_area; @@ -190,6 +182,7 @@ init_unixheader() */ } +static convert_reloc( a_relo, u_relo) register struct outrelo *a_relo; register struct relocation_info *u_relo; @@ -245,6 +238,7 @@ int length; #define n_str n_un.n_strx +static convert_name( a_name, u_name) register struct outname *a_name; register struct nlist *u_name; @@ -278,21 +272,22 @@ register struct nlist *u_name; u_name->n_value = a_name->on_valu; else if ( a_name->on_valu != -1) 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 u_name->n_value = 0; } +static put_stringtablesize( n) long n; { putbuf( (char *)&n, 4L); } - +static putbuf(buf,n) char *buf; long n; { - sys_write( out_file, buf, n); + sys_write( _out_file, buf, n); } diff --git a/mach/sun3/ce/relocation.c b/mach/sun3/ce/relocation.c index 8b06b27f6..742c2f549 100644 --- a/mach/sun3/ce/relocation.c +++ b/mach/sun3/ce/relocation.c @@ -1,11 +1,10 @@ #include #include -#include "data.h" #include "back.h" /* Written to run on SUN, and generate code for SUN */ -extern long base_address[]; +extern long _base_address[]; do_local_relocation() { @@ -13,21 +12,12 @@ do_local_relocation() /* print( "n relocation records %d\n", relo - reloc_info); */ - base_address[SEGTXT] = 0; - base_address[SEGCON] = text - text_area; - base_address[SEGBSS] = base_address[SEGCON] + data - data_area; + _base_address[SEGTXT] = 0; + _base_address[SEGCON] = text - text_area; + _base_address[SEGBSS] = _base_address[SEGCON] + data - data_area; for ( rp = reloc_info; rp < relo; rp++) { register struct outname *np = &symbol_table[rp->or_nami]; - 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 char *sect; @@ -47,7 +37,7 @@ do_local_relocation() if ( rp->or_type & RELO4) *((long *)(sect+rp->or_addr)) += np->on_valu + - base_address[(np->on_type&S_TYP)-S_MIN]; + _base_address[(np->on_type&S_TYP)-S_MIN]; else fprint( STDERR, "do_relo() : bad relocation size\n"); -- 2.34.1