diff +context=3 obinutil/aoutenca.h binutils/aoutenca.h *** obinutil/aoutenca.h Sun Mar 24 18:16:00 1991 --- binutils/aoutenca.h Thu Mar 7 00:11:52 1991 *************** *** 37,43 **** --- 37,47 ---- #if !defined (A_OUT_ENCAP_H) #define A_OUT_ENCAP_H 1 + #ifdef GNUDOS + #include "aoutgnu.h" + #else #include "a.out.gnu.h" + #endif #define N_FLAGS_COFF_ENCAPSULATE 0x20 /* coff header precedes bsd header */ diff +context=3 obinutil/ar.c binutils/ar.c *** obinutil/ar.c Sun Mar 24 18:16:00 1991 --- binutils/ar.c Thu Mar 7 00:11:52 1991 *************** *** 27,37 **** --- 27,45 ---- #ifdef A_OUT #ifdef COFF_ENCAPSULATE + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" + #endif #else + #ifdef GNUDOS + #include + #else #include #endif #endif + #endif #ifdef MACH_O #ifndef A_OUT *************** *** 284,289 **** --- 292,301 ---- { int i; + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif + operation = 0; verbose = 0; newer_only = 0; *************** *** 1956,1962 **** --- 1968,1976 ---- xmalloc (size) unsigned int size; { + #ifndef GNUDOS extern char *malloc (); + #endif char *result = malloc (size); if (result == 0) fatal ("virtual memory exhausted", 0); *************** *** 1968,1974 **** --- 1982,1990 ---- char *ptr; unsigned int size; { + #ifndef GNUDOS extern char *realloc (); + #endif char *result = realloc (ptr, size); if (result == 0) fatal ("virtual memory exhausted"); diff +context=3 obinutil/ld.c binutils/ld.c *** obinutil/ld.c Sun Mar 24 18:16:04 1991 --- binutils/ld.c Thu Mar 7 00:11:54 1991 *************** *** 17,22 **** --- 17,26 ---- /* Written by Richard Stallman with some help from Eric Albert. Set, indirect, and warning symbol features added by Randy Smith. */ + + #ifdef GNUDOS + #define TARGET -1 + #endif /* Define how to initialize system-dependent header fields. */ #ifdef sun *************** *** 51,60 **** --- 55,72 ---- #endif #ifdef COFF_ENCAPSULATE + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" + #endif + #else + #ifdef GNUDOS + #include #else #include #endif + #endif #ifndef N_SET_MAGIC #define N_SET_MAGIC(exec, val) ((exec).a_magic = val) *************** *** 552,558 **** --- 564,574 ---- extern char *cplus_demangle (); /* Demangler function to use. */ + #ifdef GNUDOS + char *(*demangler)() = cplus_demangle; + #else char *(*demangler)() = NULL; + #endif /* Number of buckets in symbol hash table */ #define TABSIZE 1009 *************** *** 885,890 **** --- 901,907 ---- struct glosym **cmdline_references; int cl_refs_allocated; + #ifndef GNUDOS void bcopy (), bzero (); int malloc (), realloc (); #ifndef alloca *************** *** 891,896 **** --- 908,914 ---- int alloca (); #endif int free (); + #endif int xmalloc (); int xrealloc (); *************** *** 939,944 **** --- 957,966 ---- } #endif /* RLIMIT_STACK */ + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif + page_size = getpagesize (); progname = argv[0]; *************** *** 1206,1211 **** --- 1228,1241 ---- /* Append the standard search directories to the user-specified ones. */ { int n = sizeof standard_search_dirs / sizeof standard_search_dirs[0]; + #ifdef GNUDOS + extern char *getenv(); + int libcnt; + char *lib_env = getenv("GCCLIB"); + if (lib_env) + for (libcnt = 0; libcnt < n; libcnt++) + standard_search_dirs[libcnt] = lib_env; + #endif n_search_dirs += n; search_dirs = (char **) xrealloc (search_dirs, n_search_dirs * sizeof (char *)); *************** *** 2128,2134 **** --- 2158,2168 ---- for (namelen = 0; namelen < sizeof hdr1.ar_name && hdr1.ar_name[namelen] != 0 && hdr1.ar_name[namelen] != ' ' + #ifdef GNUDOS + ; + #else && hdr1.ar_name[namelen] != '/'; + #endif namelen++); name = (char *) xmalloc (namelen+1); *************** *** 3367,3372 **** --- 3401,3410 ---- if (entry_symbol == 0) entry_symbol = getsym("start"); #endif + #ifdef GNUDOS + if (entry_symbol == 0) + entry_symbol = getsym("start"); + #endif outheader.a_data = data_size; outheader.a_bss = bss_size; outheader.a_entry = (entry_symbol ? entry_symbol->value *************** *** 4735,4740 **** --- 4773,4779 ---- } #ifdef USG + #ifndef GNUDOS void bzero (p, n) *************** *** 4755,4760 **** --- 4794,4800 ---- return (4096); } + #endif #endif #if TARGET == SUN4 diff +context=3 obinutil/makefile binutils/makefile *** obinutil/makefile Sun Mar 24 18:16:04 1991 --- binutils/makefile Thu Mar 7 00:11:54 1991 *************** *** 22,35 **** GNUCC = gcc -O bindir=/usr/local/bin # for BSD systems ! CFLAGS = -g # Don't add robotussin; it won't compile on BSD or GNU systems. # objdump is not here because it (at least used to) not compile # on most systems (trouble with N_DATADDR). I've fixed some of # those problems, though. ! PROGS = $(archpfx)gprof $(archpfx)ld $(archpfx)size \ ! $(archpfx)nm $(archpfx)strip $(archpfx)ar $(archpfx)ranlib # for USG systems using COFF_ENCAPSULATE # also, you will want to make the target libc.a (but it takes a long time) --- 22,42 ---- GNUCC = gcc -O bindir=/usr/local/bin + # GNUDOS: use these + CFLAGS = -O -DGNUDOS + PROGS = ld size nm strip ar objdump gprof + CC = gcc + .c.o: + $(CC) $(CFLAGS) -c $*.c + # for BSD systems ! #CFLAGS = -g # Don't add robotussin; it won't compile on BSD or GNU systems. # objdump is not here because it (at least used to) not compile # on most systems (trouble with N_DATADDR). I've fixed some of # those problems, though. ! #PROGS = $(archpfx)gprof $(archpfx)ld $(archpfx)size \ ! # $(archpfx)nm $(archpfx)strip $(archpfx)ar $(archpfx)ranlib # for USG systems using COFF_ENCAPSULATE # also, you will want to make the target libc.a (but it takes a long time) *************** *** 74,80 **** # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might # fail unnecessarily. I've also seen some unix malloc's fail, even when # there is enough memory. So use the new GNU malloc. ! MALLOC = $(archpfx)gmalloc.o GNU_GETOPT = $(archpfx)getopt.o GNU_GETOPT_LONG = $(archpfx)getopt.o $(archpfx)getopt1.o --- 81,88 ---- # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might # fail unnecessarily. I've also seen some unix malloc's fail, even when # there is enough memory. So use the new GNU malloc. ! # GNUDOS: we already have it ! # MALLOC = $(archpfx)gmalloc.o GNU_GETOPT = $(archpfx)getopt.o GNU_GETOPT_LONG = $(archpfx)getopt.o $(archpfx)getopt1.o *************** *** 115,121 **** $(archpfx)ranlib.o: ranlib.c $(CC) -c $(CFLAGS) -DAR_PROG=\"$(bindir)/ar\" ranlib.c $(OUTPUT_OPTION) ! $(archpfx)objdump: $(archpfx)objdump.o $(GNU_GETOPT_LONG) a.out.gnu.h $(CC) $(CFLAGS) -o $(archpfx)objdump $(archpfx)objdump.o \ $(GNU_GETOPT_LONG) $(LIBS) --- 123,129 ---- $(archpfx)ranlib.o: ranlib.c $(CC) -c $(CFLAGS) -DAR_PROG=\"$(bindir)/ar\" ranlib.c $(OUTPUT_OPTION) ! $(archpfx)objdump: $(archpfx)objdump.o $(GNU_GETOPT_LONG) aoutgnu.h $(CC) $(CFLAGS) -o $(archpfx)objdump $(archpfx)objdump.o \ $(GNU_GETOPT_LONG) $(LIBS) diff +context=3 obinutil/nm.c binutils/nm.c *** obinutil/nm.c Sun Mar 24 18:16:04 1991 --- binutils/nm.c Thu Mar 7 00:11:54 1991 *************** *** 27,38 **** --- 27,46 ---- #ifdef A_OUT #ifdef COFF_ENCAPSULATE + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" + #endif #else /* On native BSD systems, use the system's own a.out.h. */ + #ifdef GNUDOS + #include + #else #include #endif #endif + #endif #ifdef MACH_O #ifndef A_OUT *************** *** 77,83 **** --- 85,93 ---- #endif #endif + #ifndef GNUDOS char *malloc (), *realloc (); + #endif char *xmalloc (), *xrealloc (); *************** *** 261,266 **** --- 271,280 ---- {NULL, 0, NULL, 0} }; + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif + program_name = argv[0]; number_of_files = 0; *************** *** 408,415 **** --- 422,433 ---- { for (namelen = 0; ; namelen++) if (hdr1.ar_name[namelen] == 0 || hdr1.ar_name[namelen] == ' ' + #ifdef GNUDOS + ) + #else /* Some systems use a slash? Strange. */ || hdr1.ar_name[namelen] == '/') + #endif break; name = (char *) xmalloc (namelen+1); diff +context=3 obinutil/objdump.c binutils/objdump.c *** obinutil/objdump.c Sun Mar 24 18:16:04 1991 --- binutils/objdump.c Thu Mar 7 00:11:54 1991 *************** *** 24,42 **** #include #include "getopt.h" #ifndef COFF_ENCAPSULATE #include /* Tell a.out.gnu.h not to try to redefine some things. */ - #define __STRUCT_EXEC_OVERRIDE__ #define N_NLIST_DECLARED #define N_RELOCATION_INFO_DECLARED #define N_MAGIC(exec) ((exec).a_magic) #include "a.out.gnu.h" #else #include "a.out.encap.h" #endif char *malloc(); char *xmalloc(); int nsyms; struct nlist *symtbl; --- 24,62 ---- #include #include "getopt.h" + #ifdef GNUDOS + #include + #endif + #ifndef COFF_ENCAPSULATE + #ifdef GNUDOS + #include + #else #include + #endif /* Tell a.out.gnu.h not to try to redefine some things. */ #define N_NLIST_DECLARED #define N_RELOCATION_INFO_DECLARED + #ifndef GNUDOS + #define __STRUCT_EXEC_OVERRIDE__ #define N_MAGIC(exec) ((exec).a_magic) + #endif + #ifdef GNUDOS + #include "aoutgnu.h" + #else #include "a.out.gnu.h" + #endif #else + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" #endif + #endif + #ifndef GNUDOS char *malloc(); + #endif char *xmalloc(); int nsyms; struct nlist *symtbl; *************** *** 132,137 **** --- 152,161 ---- {"header", 0, &hflag, 1}, {NULL, 0, NULL, 0} }; + + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif page_size = getpagesize (); diff +context=3 obinutil/size.c binutils/size.c *** obinutil/size.c Sun Mar 24 18:16:04 1991 --- binutils/size.c Thu Mar 7 00:11:54 1991 *************** *** 26,37 **** --- 26,45 ---- #ifdef A_OUT #ifdef COFF_ENCAPSULATE + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" + #endif #else /* On native BSD systems, use the system's own a.out.h. */ + #ifdef GNUDOS + #include + #else #include #endif #endif + #endif #ifdef MACH_O #include *************** *** 61,67 **** --- 69,77 ---- int member_offset; + #ifndef GNUDOS char *malloc (); + #endif void do_one_file (), do_one_rel_file (); char *xmalloc (); *************** *** 72,77 **** --- 82,91 ---- int argc; { int i; + + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif number_of_files = argc - 1; diff +context=3 obinutil/strip.c binutils/strip.c *** obinutil/strip.c Sun Mar 24 18:16:06 1991 --- binutils/strip.c Thu Mar 7 00:11:56 1991 *************** *** 35,46 **** --- 35,54 ---- #ifdef A_OUT #ifdef COFF_ENCAPSULATE + #ifdef GNUDOS + #include "aoutencap.h" + #else #include "a.out.encap.h" + #endif #else /* On native BSD systems, use the system's own a.out.h. */ + #ifdef GNUDOS + #include + #else #include #endif #endif + #endif #ifdef MACH_O #ifndef A_OUT *************** *** 138,144 **** --- 146,154 ---- /* 1 => discard locals starting with L; 2 => discard all locals */ int discard_locals; + #ifndef GNUDOS char *malloc (); + #endif void strip_file (); int file_open (); *************** *** 169,174 **** --- 179,188 ---- struct file_entry *p; int i; + #ifdef GNUDOS + _fmode = O_BINARY; /* set default file type */ + #endif + strip_symbols = 0; /* default is to strip everything. */ discard_locals = 0; *************** *** 287,294 **** --- 301,310 ---- signal (SIGTERM, SIG_DFL); /* Handle any signal that came in while they were deferred. */ + #ifndef GNUDOS if (delayed_signal) kill (getpid (), delayed_signal); + #endif } /** Convenient functions for operating on one or all files being processed. */ *** obinutils/gprof.c Fri Jul 19 18:28:48 1991 --- binutils/gprof.c Sat Jul 20 10:11:34 1991 *************** *** 47,55 **** --- 47,59 ---- #ifdef COFF_ENCAPSULATE #include "a.out.encap.h" #else + #ifdef GNUDOS + #include + #else #include #endif #endif + #endif #ifdef MACH_O #ifndef A_OUT *************** *** 666,671 **** --- 670,676 ---- void qsort EXT4(void *, size_t, size_t, int (*)(const void *, const void *)); #endif + #ifndef GNUDOS void exit EXT1(int); int strcmp EXT2(const char *, const char *); *************** *** 686,691 **** --- 691,698 ---- int vfprintf EXT3(FILE *, const char *, va_list); #endif + #endif + void dbgprintf EXT1N(char *); void dumpsyms EXT0(); void dumpfuns EXT0(); *************** *** 797,803 **** --- 804,814 ---- exec_file_name=OBJ_NAM; /* Open the a.out file, and read in selected portions */ + #ifdef GNUDOS + fp=ck_fopen (exec_file_name, "rb"); + #else fp=ck_fopen (exec_file_name, "r"); + #endif /* Make sure its really an a.out file. If it isn't yell and scream and stamp our feet. */ *************** *** 2205,2211 **** --- 2216,2226 ---- PRINT_OBNOXIOUS_DEBUG_MESSAGE (DB_GFILE, ("gmon from `%s'", name)); + #ifdef GNUDOS + fp=ck_fopen (name, "rb"); + #else fp=ck_fopen (name, "r"); + #endif /* Read in the gmon file header and check that histogram is compatible with the other gmon files already read. */ *************** *** 2306,2311 **** --- 2321,2329 ---- long ret; FILE *fp; + #ifdef GNUDOS + ret = 18; + #else #ifdef USG #include #include *************** *** 2319,2324 **** --- 2337,2343 ---- ck_fseek (fp, (long)nl[0].n_value, 0); ck_fread ((void *)&ret, sizeof (ret), 1, fp); ck_fclose (fp); + #endif #endif PRINT_OBNOXIOUS_DEBUG_MESSAGE (DB_MISC, ("get_ticks ()=%ld", ret)); return ret;