jand@kuling.UUCP (Jan Dj{rv) (07/18/90)
In article <15520009@hpdmd48boi.hp.com> brown@hpdmd48boi.hp.com (Kevin Brown) writes: > >I have looked into it further: it is gmalloc that calls getpagesize but never >defines it. It is true that the 'ld' code defines it for itself. I am >further confused 'cuz the source for gmalloc has ominous warnings about >editing the file 'cuz it was automatically generated. > >I've also had trouble compiling ranlib 'cuz it can't find xmalloc. It looks >like the alloca.o that I got out of the gcc directory wants to call xmalloc. >This wasn't a problem for: ar,gprof,ld, nm objdump, size, and strip 'cuz >they all define their own xmalloc. > > >Any one got any hints? Did I leave something important out or not set a flag >properly? > >Thanks >Kevin Brown >brown@hpbsm15.boi.hp.com The thing is that I had an older version of binutils when I posted Tom Lanes patches for binutils, and in that version there where no problems. Here's some updated patches. The newer version of binutils is noted by the fact that it doesn't contain a hp-include/sys directory, and that it uses gmalloc.c. NOTE: I've edited gmalloc.c despite warnings (what else is there to do?) These patches makes gmalloc.c suitable only for HP-UX, or other systems with pagesize == 4096. Jan D. *** binutils/hp-bin/Makefile.orig Wed Jan 4 02:40:32 1989 --- binutils/hp-bin/Makefile Sat Jul 14 12:09:54 1990 *************** *** 7,15 **** rm -f *.o $(EXECUTABLES) hpxt : hpxt.o ioutil.o ! $(CC) -o hpxt hpxt.o ioutil.o chatr : chatr.o ioutil.o ! $(CC) -o chatr chatr.o ioutil.o hpxt.o chatr.o : ioutil.h --- 7,15 ---- rm -f *.o $(EXECUTABLES) hpxt : hpxt.o ioutil.o ! $(CC) $(CFLAGS) -o hpxt hpxt.o ioutil.o chatr : chatr.o ioutil.o ! $(CC) $(CFLAGS) -o chatr chatr.o ioutil.o hpxt.o chatr.o : ioutil.h *** binutils/hp-bin/hpxt.c.orig Fri Mar 3 16:47:59 1989 --- binutils/hp-bin/hpxt.c Sat Jul 14 12:09:55 1990 *************** *** 990,995 **** --- 990,996 ---- long output_start; long output_end; long input_end; + char * slashptr; /* Strategy: leave a hole for the header, then process the file. Afterwards, back up and write the header in place. */ *************** *** 1003,1009 **** output_end = (iou_lseek (output_file, 0, 1)); iou_lseek (output_file, header_position, 0); ! (* (index ((input_header -> ar_name), '/'))) = ' '; { char string_buffer [((sizeof (input_header -> ar_size)) + 1)]; --- 1004,1012 ---- output_end = (iou_lseek (output_file, 0, 1)); iou_lseek (output_file, header_position, 0); ! slashptr = index ((input_header -> ar_name), '/'); ! if (slashptr) ! *slashptr = ' '; { char string_buffer [((sizeof (input_header -> ar_size)) + 1)]; *** binutils/hp-bin/mkhplib.orig Tue Mar 20 21:40:16 1990 --- binutils/hp-bin/mkhplib Sat Jul 14 12:09:55 1990 *************** *** 15,21 **** # with the same name, the one we convert second will be the one we # end up with. ! foreach dir (/usr/local/lib /usr/lib /lib) cd $dir foreach i (lib*.a) echo "$dir/$i" --- 15,22 ---- # with the same name, the one we convert second will be the one we # end up with. ! # foreach dir (/usr/local/lib /usr/lib /lib) ! foreach dir (/usr/lib /lib) cd $dir foreach i (lib*.a) echo "$dir/$i" *** binutils/Makefile.orig Thu Jun 21 19:05:49 1990 --- binutils/Makefile Sat Jul 14 12:56:33 1990 *************** *** 23,29 **** 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 --- 23,29 ---- 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 *************** *** 49,57 **** # Don't add robotussin; use hpxt instead. # Note that you should leave a copy of `ar' in this directory # after you install it, since `ranlib' will try to run it from here. ! #CFLAGS = -g -Ihp-include -DUSG -DNON_NATIVE ! #PROGS = ld size nm strip ar ranlib ! #ALLOCALIBS = alloca.o # For the NeXT: # Set GNUCC = cc --- 49,57 ---- # Don't add robotussin; use hpxt instead. # Note that you should leave a copy of `ar' in this directory # after you install it, since `ranlib' will try to run it from here. ! CFLAGS = -O -Ihp-include -DUSG -DNON_NATIVE ! PROGS = ld size nm strip ar ranlib ! LIBS = alloca.o # For the NeXT: # Set GNUCC = cc *************** *** 82,88 **** # C++ demangler CPLUS_DEM = $(archpfx)cplus-dem.o ! LIBS=$(ALLOCALIBS) $(SIGNAME) all: $(PROGS) --- 82,88 ---- # C++ demangler CPLUS_DEM = $(archpfx)cplus-dem.o ! #LIBS=$(ALLOCALIBS) $(SIGNAME) all: $(PROGS) *************** *** 113,119 **** $(archpfx)ranlib: $(archpfx)ranlib.o $(GNU_GETOPT_LONG) $(CC) $(CFLAGS) -o $(archpfx)ranlib $(archpfx)ranlib.o $(GNU_GETOPT_LONG) $(LIBS) $(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 \ --- 113,119 ---- $(archpfx)ranlib: $(archpfx)ranlib.o $(GNU_GETOPT_LONG) $(CC) $(CFLAGS) -o $(archpfx)ranlib $(archpfx)ranlib.o $(GNU_GETOPT_LONG) $(LIBS) $(archpfx)ranlib.o: ranlib.c ! $(CC) -c $(CFLAGS) -DAR_PROG=\"$(bindir)/gnu-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 \ *************** *** 141,149 **** binutils.tar.Z: cd ..; tar -cohz -f binutils/binutils.tar.Z -T binutils/ARCHLIST .PHONY: install install: $(PROGS) ! for file in $(PROGS); do \ ! cp $$file $(bindir)/$${file}.new; \ ! mv $(bindir)/$${file}.new $(bindir)/$$file; \ ! done --- 141,151 ---- binutils.tar.Z: cd ..; tar -cohz -f binutils/binutils.tar.Z -T binutils/ARCHLIST + # For HPUX + alloca.o: alloca.c + $(CC) $(CFLAGS) -Dhp9000s300 -E alloca.c >alloca.s + as alloca.s -o alloca.o + .PHONY: install install: $(PROGS) ! cp $(PROGS) $(bindir) *** binutils/ranlib.c.orig Thu Mar 1 01:18:42 1990 --- binutils/ranlib.c Sat Jul 14 12:58:47 1990 *************** *** 146,152 **** } if ((status & 0x7f) != 0) { ! psignal (status & 0x7f, ar_program); exit (1); } else if (((status & 0xff00) >> 8) != 0) --- 146,152 ---- } if ((status & 0x7f) != 0) { ! fprintf(stderr, "%s: signal %d\n", prog, status & 0x7f); exit (1); } else if (((status & 0xff00) >> 8) != 0) *************** *** 230,233 **** --- 230,246 ---- largv++; } + } + + /* Like malloc but get fatal error if memory is exhausted. */ + + char * + xmalloc (size) + unsigned int size; + { + extern char *malloc (); + char *result = malloc (size); + if (result == 0) + fprintf (stderr, "virtual memory exhausted"); + return result; } *** binutils/gmalloc.c.orig Sat Jul 14 13:17:28 1990 --- binutils/gmalloc.c Sat Jul 14 12:43:33 1990 *************** *** 1114,1116 **** --- 1114,1120 ---- result = (char *) result + pagesize - adj; return result; } + size_t getpagesize() + { + return(4096); + }