From 0936b9aeab611665645a4e6bafaded7ca76dd189 Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Tue, 3 Sep 1996 22:06:58 +0200 Subject: Import Dev86-0.0.7.tar.gz --- ld/Makefile | 2 + ld/a_out.h | 1 - ld/align.h | 14 ++++++- ld/config.h | 4 +- ld/io.c | 51 +++++-------------------- ld/ld.c | 18 +-------- ld/obj.h | 4 +- ld/readobj.c | 22 ++++------- ld/syshead.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ld/table.c | 9 +---- ld/type.h | 20 +++++----- ld/writebin.c | 118 ++++++++++++++++++++++---------------------------------- 12 files changed, 214 insertions(+), 170 deletions(-) delete mode 120000 ld/a_out.h create mode 100644 ld/syshead.h (limited to 'ld') diff --git a/ld/Makefile b/ld/Makefile index d93579a..784763a 100644 --- a/ld/Makefile +++ b/ld/Makefile @@ -1,6 +1,8 @@ ifneq ($(TOPDIR),) include $(TOPDIR)/Make.defs + +# CFLAGS=$(CCFLAGS) -DBSD_A_OUT else CC=bcc LDFLAGS=-s diff --git a/ld/a_out.h b/ld/a_out.h deleted file mode 120000 index 9238685..0000000 --- a/ld/a_out.h +++ /dev/null @@ -1 +0,0 @@ -a.out.h \ No newline at end of file diff --git a/ld/align.h b/ld/align.h index ba33fb8..02bbe43 100644 --- a/ld/align.h +++ b/ld/align.h @@ -5,6 +5,16 @@ #ifndef S_ALIGNMENT # define align(x) #else -# define align(x) ((x) = ((int) (x) + (S_ALIGNMENT-1)) & ~(S_ALIGNMENT-1)) - /* assumes sizeof(int) == sizeof(char *) */ +# define align(x) ((x)=(void*) \ + ((char *)(x) + ((S_ALIGNMENT-(int)(x)) & (S_ALIGNMENT-1)))) #endif + + + + + + +/* * assumes sizeof(int) == sizeof(char *) * +# define align(x) ((x) = (void *)(((int) (x) + (S_ALIGNMENT-1)) & ~(S_ALIGNMENT-1))) +*/ + diff --git a/ld/config.h b/ld/config.h index 201c153..1629ba3 100644 --- a/ld/config.h +++ b/ld/config.h @@ -17,10 +17,12 @@ #undef HOST_8BIT /* enable some 8-bit optimizations */ -/* #define S_ALIGNMENT 4 */ /* source memory alignment, power of 2 */ +#ifndef __BCC__ +#define S_ALIGNMENT 4 /* source memory alignment, power of 2 */ /* don't use for 8 bit processors */ /* don't use even for 80386 - overhead for */ /* alignment cancels improved access */ +#endif /* these must be defined to suit the source libraries */ diff --git a/ld/io.c b/ld/io.c index c1829c8..fa4862a 100644 --- a/ld/io.c +++ b/ld/io.c @@ -2,41 +2,11 @@ /* Copyright (C) 1994 Bruce Evans */ +#include "syshead.h" #include "const.h" -#include "obj.h" /* needed for LONG_OFFSETS and offset_t */ +#include "obj.h" /* needed for LONG_OFFSETS and bin_off_t */ #include "type.h" #include "globvar.h" -#include - -#ifdef STDC_HEADERS_MISSING -void exit P((int status)); -void *malloc P((unsigned size)); -#else -#include -#endif - -#ifdef POSIX_HEADERS_MISSING -#define SEEK_SET 0 -#define STDOUT_FILENO 0 -#include -#include -#define mode_t unsigned short -#define off_t long -int chmod P((const char *path, int mode)); -int close P((int fd)); -int creat P((const char *path, int mode)); -int fstat P((int fd, struct stat *statbuf)); -off_t lseek P((int fd, off_t offset, int whence)); -int open P((const char *path, int oflag, ...)); -int read P((int fd, void *buf, unsigned nbytes)); -mode_t umask P((int oldmask)); -int write P((int fd, const void *buf, unsigned nbytes)); -#else -#include -#include -#include -#include -#endif #define DRELBUFSIZE 3072 #define ERR (-1) @@ -44,9 +14,6 @@ int write P((int fd, const void *buf, unsigned nbytes)); #define INBUFSIZE 1024 #define OUTBUFSIZE 2048 #define TRELBUFSIZE 1024 -#ifndef O_BINARY -#define O_BINARY 0 -#endif #ifdef BSD_A_OUT PRIVATE char *drelbuf; /* extra output buffer for data relocations */ @@ -81,7 +48,7 @@ FORWARD void flushout P((void)); #ifdef BSD_A_OUT FORWARD void flushtrel P((void)); #endif -FORWARD void outhexdigs P((offset_t num)); +FORWARD void outhexdigs P((bin_off_t num)); FORWARD void outputerror P((char *message)); FORWARD void put04x P((unsigned num)); FORWARD void putstrn P((char *message)); @@ -228,7 +195,7 @@ char *filename; } PRIVATE void outhexdigs(num) -register offset_t num; +register bin_off_t num; { if (num >= 0x10) { @@ -250,7 +217,7 @@ register unsigned num; #ifdef LONG_OFFSETS PUBLIC void put08lx(num) -register offset_t num; +register bin_off_t num; { put04x(num / 0x10000); put04x(num % 0x10000); @@ -259,7 +226,7 @@ register offset_t num; #else /* not LONG_OFFSETS */ PUBLIC void put08x(num) -register offset_t num; +register bin_off_t num; { putstr("0000"); put04x(num); @@ -562,12 +529,12 @@ char *name; PUBLIC void size_error(seg, count, size) int seg; -offset_t count; -offset_t size; +bin_off_t count; +bin_off_t size; { refer(); putstr("seg "); - outhexdigs((offset_t) seg); + outhexdigs((bin_off_t) seg); putstr(" has wrong size "); outhexdigs(count); putstr(", supposed to be "); diff --git a/ld/ld.c b/ld/ld.c index a333f04..214538e 100644 --- a/ld/ld.c +++ b/ld/ld.c @@ -2,28 +2,12 @@ /* Copyright (C) 1994 Bruce Evans */ +#include "syshead.h" #include "const.h" #include "byteord.h" #include "type.h" #include "globvar.h" -#ifdef STDC_HEADERS_MISSING -extern int errno; -char *strcat P((char *dest, const char *src)); -unsigned long strtoul P((const char *s, char **endptr, int base)); -#else -#include -#include -#include -#endif - -#ifdef POSIX_HEADERS_MISSING -#define R_OK 0 -int access P((const char *path, int amode)); -#else -#include -#endif - #define MAX_LIBS (NR_STDLIBS + 5) #ifdef MC6809 #define NR_STDLIBS 1 diff --git a/ld/obj.h b/ld/obj.h index e0a52dc..7159a5d 100644 --- a/ld/obj.h +++ b/ld/obj.h @@ -31,9 +31,9 @@ #endif #ifdef MC6809 /* temp don't support alignment at all */ -# define roundup( num, boundary, type ) (num) +# define ld_roundup( num, boundary, type ) (num) #else -# define roundup( num, boundary, type ) \ +# define ld_roundup( num, boundary, type ) \ (((num) + ((boundary) - 1)) & (type) ~((boundary) - 1)) #endif diff --git a/ld/readobj.c b/ld/readobj.c index bb6a6b5..eb5e0e3 100644 --- a/ld/readobj.c +++ b/ld/readobj.c @@ -2,6 +2,7 @@ /* Copyright (C) 1994 Bruce Evans */ +#include "syshead.h" #include "ar.h" /* maybe local copy of for cross-link */ #include "const.h" #include "byteord.h" @@ -9,15 +10,6 @@ #include "type.h" #include "globvar.h" -#ifdef STDC_HEADERS_MISSING -int strncmp P((const char *s1, const char *s2, unsigned n)); -char *strncpy P((char *dest, const char *src, unsigned n)); -unsigned long strtoul P((const char *s, char **endptr, int base)); -#else -#include -#include -#endif - /* Linking takes 2 passes. The 1st pass reads through all files specified in the command line, and all libraries. All public symbols are extracted @@ -42,7 +34,7 @@ FORWARD long readarheader P((char **parchentry)); FORWARD unsigned readfileheader P((void)); FORWARD void readmodule P((char *filename, char *archentry)); FORWARD void reedmodheader P((void)); -FORWARD bool_pt redsym P((struct symstruct *symptr, offset_t value)); +FORWARD bool_pt redsym P((struct symstruct *symptr, bin_off_t value)); FORWARD unsigned checksum P((char *string, unsigned length)); FORWARD unsigned segbits P((unsigned seg, char *sizedesc)); @@ -93,7 +85,7 @@ bool_pt trace; readmodule(stralloc(filename), archentry); modlast->textoffset += filepos; } - seekin(filepos += roundup(filelength, 2, long)); + seekin(filepos += ld_roundup(filelength, 2, long)); } break; } @@ -147,7 +139,7 @@ char *archentry; { struct symdstruct /* to save parts of symbol before name known */ { - offset_t dvalue; + bin_off_t dvalue; flags_t dflags; }; struct symdstruct *endsymdptr; @@ -289,7 +281,7 @@ PRIVATE void reedmodheader() PRIVATE bool_pt redsym(symptr, value) register struct symstruct *symptr; -offset_t value; +bin_off_t value; { register struct redlist *rlptr; char class; @@ -340,13 +332,13 @@ unsigned length; return sum; } -PUBLIC offset_t readconvsize(countindex) +PUBLIC bin_off_t readconvsize(countindex) unsigned countindex; { return readsize(convertsize[countindex]); } -PUBLIC offset_t readsize(count) +PUBLIC bin_off_t readsize(count) unsigned count; { char buf[MAX_OFFSET_SIZE]; diff --git a/ld/syshead.h b/ld/syshead.h new file mode 100644 index 0000000..33f1123 --- /dev/null +++ b/ld/syshead.h @@ -0,0 +1,121 @@ + +#ifndef STDC_HEADERS_MISSING +#include +#include +#include +#endif + +#ifndef POSIX_HEADERS_MISSING +#include +#include +#include +#include +#endif + +#ifdef MSDOS +#undef POSIX_HEADERS_MISSING + +#include +#include +#include + +#define A_OUT_INCL "a_out.h" +#undef min +#define R_OK 0 +#define mode_t unsigned short +#define SEEK_SET 0 +#define STDOUT_FILENO 0 +#endif + +#ifndef A_OUT_INCL +#define A_OUT_INCL "a.out.h" +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +/******************************************************************************/ + +/* EEEEyuk!! */ + +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif + +#ifdef STDC_HEADERS_MISSING +extern int errno; +char *strcat P((char *dest, const char *src)); +unsigned long strtoul P((const char *s, char **endptr, int base)); +void exit P((int status)); +void *malloc P((unsigned size)); +int strncmp P((const char *s1, const char *s2, unsigned n)); +char *strncpy P((char *dest, const char *src, unsigned n)); +char * strcpy P((char* dest, char* src)); +void *memset P((void *s, int c, unsigned n)); +#endif + +#ifdef POSIX_HEADERS_MISSING +#include +#include + +#define R_OK 0 +int access P((const char *path, int amode)); +#define SEEK_SET 0 +#define STDOUT_FILENO 0 + +#define mode_t unsigned short +#define off_t long + +int chmod P((const char *path, int mode)); +int close P((int fd)); +int creat P((const char *path, int mode)); +int fstat P((int fd, struct stat *statbuf)); +off_t lseek P((int fd, off_t offset, int whence)); +int open P((const char *path, int oflag, ...)); +int read P((int fd, void *buf, unsigned nbytes)); +mode_t umask P((int oldmask)); +int write P((int fd, const void *buf, unsigned nbytes)); +#endif + +#ifndef A_OUT_INCL +# ifdef BSD_A_OUT +# ifdef STANDARD_GNU_A_OUT +# define A_OUT_INCL +# else +# define A_OUT_INCL "bsd-a.out.h" +# endif + +# ifdef MSDOS +# define A_OUT_INCL "a_out.h" +# else +# define A_OUT_INCL "a.out.h" /* maybe local copy of for X-link */ +# endif +# endif /* BSD_A_OUT */ +#endif + +# ifdef BSD_A_OUT +# ifdef STANDARD_GNU_A_OUT +# define RELOC_INFO_SIZE 8 /* unportable bitfields - bcc doesn't pack */ +# else +# define RELOC_INFO_SIZE (sizeof (struct relocation_info)) +# endif +# define C_EXT N_EXT +# define C_STAT 0 +# define n_was_name n_un.n_name +# define n_was_numaux n_other +# define n_was_other n_numaux +# define n_was_sclass n_type +# define n_was_strx n_un.n_strx +# define n_was_type n_desc +# else /* not BSD_A_OUT */ +# define n_was_name n_name +# define n_was_numaux n_numaux +# define n_was_other n_other +# define n_was_sclass n_sclass +# define n_was_strx n_value +# define n_was_type n_type +# endif /* BSD_A_OUT */ + diff --git a/ld/table.c b/ld/table.c index cbe4217..509c838 100644 --- a/ld/table.c +++ b/ld/table.c @@ -2,20 +2,13 @@ /* Copyright (C) 1994 Bruce Evans */ +#include "syshead.h" #include "const.h" #include "align.h" #include "obj.h" #include "type.h" #include "globvar.h" -#ifdef STDC_HEADERS_MISSING -void *malloc P((unsigned size)); -char * strcpy P((char* dest, char* src)); -#else -#include -#include -#endif - #define GOLDEN 157 /* GOLDEN/HASHTABSIZE approx golden ratio */ #define HASHTABSIZE 256 diff --git a/ld/type.h b/ld/type.h index 142ea53..a419871 100644 --- a/ld/type.h +++ b/ld/type.h @@ -22,9 +22,9 @@ typedef int fastin_pt; typedef unsigned flags_t; /* unsigned makes shifts logical */ #ifdef LONG_OFFSETS -typedef unsigned long offset_t; +typedef unsigned long bin_off_t; #else -typedef unsigned offset_t; +typedef unsigned bin_off_t; #endif struct entrylist /* list of entry symbols */ @@ -55,13 +55,13 @@ struct redlist /* list of redefined (exported) symbols */ struct redlist *rlnext; /* next on list */ struct symstruct *rlsymptr; /* to symbol with same name, flags */ struct modstruct *rlmodptr; /* module for this redefinition */ - offset_t rlvalue; /* value for this redefinition */ + bin_off_t rlvalue; /* value for this redefinition */ }; struct symstruct /* symbol table entry format */ { struct modstruct *modptr; /* module where symbol is defined */ - offset_t value; /* value of symbol */ + bin_off_t value; /* value of symbol */ flags_t flags; /* see below (unsigned makes shifts logical) */ struct symstruct *next; /* next symbol with same hash value */ char name[1]; /* name is any string beginning here */ @@ -71,11 +71,13 @@ struct symstruct /* symbol table entry format */ /* prototypes */ +#ifndef P #ifdef __STDC__ #define P(x) x #else #define P(x) () #endif +#endif /* dump.c */ void dumpmods P((void)); @@ -92,8 +94,8 @@ void openin P((char *filename)); void openout P((char *filename)); void putstr P((char *message)); #ifdef OBJ_H -void put08x P((offset_t num)); -void put08lx P((offset_t num)); +void put08x P((bin_off_t num)); +void put08lx P((bin_off_t num)); #endif void putbstr P((unsigned width, char *str)); void putbyte P((int ch)); @@ -116,7 +118,7 @@ void redefined P((char *name, char *message, char *archentry, char *deffilename, char *defarchentry)); void reserved P((char *name)); #ifdef OBJ_H -void size_error P((int seg, offset_t count, offset_t size)); +void size_error P((int seg, bin_off_t count, bin_off_t size)); #endif void undefined P((char *name)); void usage P((void)); @@ -130,8 +132,8 @@ void objinit P((void)); void readsyms P((char *filename, bool_pt trace)); #ifdef OBJ_H void entrysym P((struct symstruct *symptr)); -offset_t readconvsize P((unsigned countindex)); -offset_t readsize P((unsigned count)); +bin_off_t readconvsize P((unsigned countindex)); +bin_off_t readsize P((unsigned count)); unsigned segsizecount P((unsigned seg, struct modstruct *modptr)); #endif diff --git a/ld/writebin.c b/ld/writebin.c index 3e7602d..fd3a3b9 100644 --- a/ld/writebin.c +++ b/ld/writebin.c @@ -7,52 +7,14 @@ static long bdataoffset; /* Copyright (C) 1994 Bruce Evans */ -#ifdef A_OUT_H -# include A_OUT_H -#else -# ifdef BSD_A_OUT -# ifdef STANDARD_GNU_A_OUT -# include -# define RELOC_INFO_SIZE 8 /* unportable bitfields - bcc doesn't pack */ -# else -# include "bsd-a.out.h" -# define RELOC_INFO_SIZE (sizeof (struct relocation_info)) -# endif -# define C_EXT N_EXT -# define C_STAT 0 -# define n_was_name n_un.n_name -# define n_was_numaux n_other -# define n_was_other n_numaux -# define n_was_sclass n_type -# define n_was_strx n_un.n_strx -# define n_was_type n_desc -# else /* not BSD_A_OUT */ -# ifdef MSDOS -# include "a_out.h" -# else -# include "a.out.h" /* maybe local copy of for X-link */ -# endif -# define n_was_name n_name -# define n_was_numaux n_numaux -# define n_was_other n_other -# define n_was_sclass n_sclass -# define n_was_strx n_value -# define n_was_type n_type -# endif /* BSD_A_OUT */ -#endif - +#include "syshead.h" +#include A_OUT_INCL #include "const.h" #include "obj.h" #include "type.h" #undef EXTERN #include "globvar.h" -#ifdef STDC_HEADERS_MISSING -void *memset P((void *s, int c, unsigned n)); -#else -#include -#endif - #ifdef EDOS # define FILEHEADERLENGTH 0 #endif @@ -95,13 +57,13 @@ void *memset P((void *s, int c, unsigned n)); #define memsizeof(struc, mem) sizeof(((struc *) 0)->mem) PRIVATE bool_t bits32; /* nonzero for 32-bit executable */ -PRIVATE offset_t combase[NSEG]; /* bases of common parts of segments */ -PRIVATE offset_t comsz[NSEG]; /* sizes of common parts of segments */ +PRIVATE bin_off_t combase[NSEG];/* bases of common parts of segments */ +PRIVATE bin_off_t comsz[NSEG]; /* sizes of common parts of segments */ PRIVATE fastin_t curseg; /* current segment, 0 to $F */ -PRIVATE offset_t edataoffset; /* end of data */ -PRIVATE offset_t endoffset; /* end of bss */ -PRIVATE offset_t etextoffset; /* end of text */ -PRIVATE offset_t etextpadoff; /* end of padded text */ +PRIVATE bin_off_t edataoffset; /* end of data */ +PRIVATE bin_off_t endoffset; /* end of bss */ +PRIVATE bin_off_t etextoffset; /* end of text */ +PRIVATE bin_off_t etextpadoff; /* end of padded text */ #ifdef BSD_A_OUT PRIVATE unsigned ndreloc; /* number of data relocations */ #endif @@ -111,17 +73,17 @@ PRIVATE unsigned ntreloc; /* number of text relocations */ PRIVATE bool_t reloc_output; /* nonzero to leave reloc info in output */ #endif PRIVATE unsigned relocsize; /* current relocation size 1, 2 or 4 */ -PRIVATE offset_t segadj[NSEG]; /* adjusts (file offset - seg offset) */ +PRIVATE bin_off_t segadj[NSEG]; /* adjusts (file offset - seg offset) */ /* depends on zero init */ -PRIVATE offset_t segbase[NSEG]; /* bases of data parts of segments */ +PRIVATE bin_off_t segbase[NSEG];/* bases of data parts of segments */ PRIVATE char segboundary[9] = "__seg0DH"; /* name of seg boundary __seg0DL to __segfCH */ -PRIVATE offset_t segpos[NSEG]; /* segment positions for current module */ -PRIVATE offset_t segsz[NSEG]; /* sizes of data parts of segments */ +PRIVATE bin_off_t segpos[NSEG]; /* segment positions for current module */ +PRIVATE bin_off_t segsz[NSEG]; /* sizes of data parts of segments */ /* depends on zero init */ PRIVATE bool_t sepid; /* nonzero for separate I & D */ PRIVATE bool_t stripflag; /* nonzero to strip symbols */ -PRIVATE offset_t spos; /* position in current seg */ +PRIVATE bin_off_t spos; /* position in current seg */ PRIVATE bool_t uzp; /* nonzero for unmapped zero page */ #ifdef EDOS @@ -131,7 +93,7 @@ FORWARD char *idconvert P((struct entrylist *elptr, char *commandname)); FORWARD void linkmod P((struct modstruct *modptr)); FORWARD void linkrefs P((struct modstruct *modptr)); FORWARD void padmod P((struct modstruct *modptr)); -FORWARD void setsym P((char *name, offset_t value)); +FORWARD void setsym P((char *name, bin_off_t value)); FORWARD void symres P((char *name)); FORWARD void setseg P((fastin_pt newseg)); FORWARD void skip P((unsigned countsize)); @@ -140,7 +102,7 @@ FORWARD void writeheader P((char *commandname)); #else FORWARD void writeheader P((void)); #endif -FORWARD void writenulls P((offset_t count)); +FORWARD void writenulls P((bin_off_t count)); extern int doscomfile; @@ -219,7 +181,7 @@ bool_pt arguzp; struct modstruct *modptr; fastin_t seg; unsigned sizecount; - offset_t tempoffset; + bin_off_t tempoffset; sepid = argsepid; bits32 = argbits32; @@ -305,7 +267,7 @@ bool_pt arguzp; #endif #endif { - tempoffset = roundup(symptr->value, 4, offset_t); + tempoffset = ld_roundup(symptr->value, 4, bin_off_t); /* temp kludge quad alignment for 386 */ symptr->value = comsz[seg = symptr->flags & SEGM_MASK]; comsz[seg] += tempoffset; @@ -322,8 +284,8 @@ bool_pt arguzp; /* adjust sizes to even to get quad boundaries */ /* this should be specifiable dynamically */ - segsz[seg] = roundup(segsz[seg], 4, offset_t); - comsz[seg] = roundup(comsz[seg], 4, offset_t); + segsz[seg] = ld_roundup(segsz[seg], 4, bin_off_t); + comsz[seg] = ld_roundup(comsz[seg], 4, bin_off_t); #endif cptr += sizecount; } @@ -342,7 +304,7 @@ bool_pt arguzp; etextpadoff = etextoffset = combase[0] + comsz[0]; if (sepid) { - etextpadoff = roundup(etextoffset, 0x10, offset_t); + etextpadoff = ld_roundup(etextoffset, 0x10, bin_off_t); segadj[1] += etextpadoff - bdataoffset; } else if (bdataoffset == 0) @@ -360,9 +322,9 @@ bool_pt arguzp; if (tempoffset > 0x100) fatalerror("direct page segment too large"); if ((((segbase[seg] + tempoffset) ^ segbase[seg]) - & ~(offset_t) 0xFF) != 0) + & ~(bin_off_t) 0xFF) != 0) segpos[seg] = segbase[seg] = (segbase[seg] + 0xFF) - & ~(offset_t) 0xFF; + & ~(bin_off_t) 0xFF; } combase[seg] = segbase[seg] + segsz[seg]; segadj[seg] = segadj[seg - 1]; @@ -420,7 +382,14 @@ bool_pt arguzp; setsym("__etext", etextoffset); setsym("__edata", edataoffset); setsym("__end", endoffset = combase[NSEG - 1] + comsz[NSEG - 1]); - setsym("__segoff", (offset_t)(segadj[1]-segadj[0])/0x10); + setsym("__segoff", (bin_off_t)(segadj[1]-segadj[0])/0x10); + if( !bits32 ) + { + if( etextoffset > 65535L ) + fatalerror("text segment too large for 16bit"); + if( endoffset > 65535L ) + fatalerror("data segment too large for 16bit"); + } openout(outfilename); #ifdef BSD_A_OUT @@ -472,7 +441,7 @@ bool_pt arguzp; { #ifdef BSD_A_OUT offtocn((char *) &extsym.n_was_strx, - (offset_t) stringoff, 4); + (bin_off_t) stringoff, 4); #else strncpy((char *) extsym.n_was_name, symptr->name, sizeof extsym.n_was_name); @@ -511,7 +480,7 @@ bool_pt arguzp; } } #ifdef BSD_A_OUT - offtocn((char *) &extsym.n_was_strx, (offset_t) stringoff, 4); + offtocn((char *) &extsym.n_was_strx, (bin_off_t) stringoff, 4); writeout((char *) &extsym.n_was_strx, 4); for (modptr = modfirst; modptr != NUL_PTR; modptr = modptr->modnext) if (modptr->loadflag) @@ -615,7 +584,7 @@ struct modstruct *modptr; char buf[ABS_TEXT_MAX]; int command; unsigned char modify; - offset_t offset; + bin_off_t offset; int symbolnum; struct symstruct **symparray; struct symstruct *symptr; @@ -787,9 +756,9 @@ struct modstruct *modptr; PRIVATE void padmod(modptr) struct modstruct *modptr; { - offset_t count; + bin_off_t count; fastin_t seg; - offset_t size; + bin_off_t size; unsigned sizecount; char *sizeptr; @@ -803,7 +772,7 @@ struct modstruct *modptr; /* pad to quad boundary */ /* not padding in-between common areas which sometimes get into file */ - if ((size = roundup(segpos[seg], 4, offset_t) - segpos[seg]) != 0) + if ((size = ld_roundup(segpos[seg], 4, bin_off_t) - segpos[seg]) != 0) { setseg(seg); writenulls(size); @@ -815,7 +784,7 @@ struct modstruct *modptr; PRIVATE void setsym(name, value) char *name; -offset_t value; +bin_off_t value; { struct symstruct *symptr; @@ -861,7 +830,7 @@ fastin_pt newseg; PRIVATE void skip(countsize) unsigned countsize; { - writenulls((offset_t) readsize(countsize)); + writenulls((bin_off_t) readsize(countsize)); } #ifdef EDOS @@ -870,7 +839,7 @@ PRIVATE void writeheader(commandname) char *commandname; { char buf[MAX_OFFSET_SIZE]; - offset_t offset; + bin_off_t offset; unsigned headlength; char *name; struct entrylist *elptr; @@ -977,7 +946,7 @@ PRIVATE void writeheader() offtocn((char *) &header.a_entry, page_size(), sizeof header.a_entry); #ifndef STANDARD_GNU_A_OUT - offtocn((char *) &header.a_total, (offset_t) + offtocn((char *) &header.a_total, (bin_off_t) (endoffset < 0x00010000L ? 0x00010000L : endoffset + 0x0008000L), sizeof header.a_total); #endif @@ -989,9 +958,12 @@ PRIVATE void writeheader() #endif /* MINIX */ PRIVATE void writenulls(count) -offset_t count; +bin_off_t count; { + long lcount = count; + if( lcount < 0 ) + fatalerror("org command requires reverse seek"); spos += count; - while (count--) + while (count-- > 0) writechar(0); } -- cgit v1.2.1