Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA957 ; Wed, 10 Feb 93 07:00:13 EST Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!dkuug!flshub!phk From: phk@data.fls.dk (P-HK/Poul-Henning Kamp) Newsgroups: comp.unix.bsd Subject: [386BSD] Patches for gcc-2.3.3: part 2 Message-ID: <1993Feb9.135107.1930@data.fls.dk> Date: 9 Feb 93 13:51:07 GMT Organization: FLS Data A/S, Valby, Copenhagen, Denmark. Lines: 645 This is a "jumbo" patch fixing ***SOME*** of the problems you encounter when trying to compile /usr/src with gcc-2.3.3. where what ---------------------------------------------------------------------------- crt0.c if -m486 is specified alignment is 16 byte in text. csh/Makefile -fcombine-regs not supported npx.c some mangling of asm()'s to make gas cope. pccons.c get rid of some arrays not being used which gcc2 chokes on. systm.h strlen declaration missing const subr_xxx.c strlen declaration missing const init_main.c add empty __main() {} for gcc2's sake segments.h #pragma pack(1) needed. route change struct named 'sin' to 's_in' tftp change struct named 'sin' to 's_in' tftpd change struct named 'sin' to 's_in' tar remove #pragma once from regexp.h diff remove #pragma once from regexp.h ---------------------------------------------------------------------------- *** /gandalf/D/usr/src/lib/csu.i386/crt0.c Fri Jul 3 02:17:40 1992 --- usr/src/lib/csu.i386/crt0.c Sun Jan 24 20:53:16 1993 *************** *** 51,54 **** --- 51,59 ---- asm(".text"); asm(".long 0xc000c000"); + #if 1 /* more needed for alignment on i486/gcc-2.3.3 */ + asm(".long 0xc000c000"); + asm(".long 0xc000c000"); + asm(".long 0xc000c000"); + #endif extern unsigned char etext; diff -r -C2 ../R/usr/src/bin/csh/Makefile usr/src/bin/csh/Makefile *** ../R/usr/src/bin/csh/Makefile Wed Jun 3 02:57:39 1992 --- usr/src/bin/csh/Makefile Wed Jan 20 19:00:09 1993 *************** *** 7,11 **** PROG= csh ! CFLAGS+=-fcombine-regs -fstrength-reduce -DFILEC -DNLS -DSHORT_STRINGS -I. SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \ func.c glob.c hist.c init.c lex.c misc.c parse.c print.c printf.c \ --- 7,11 ---- PROG= csh ! CFLAGS+=-fstrength-reduce -DFILEC -DNLS -DSHORT_STRINGS -I. SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \ func.c glob.c hist.c init.c lex.c misc.c parse.c print.c printf.c \ *** /gandalf/D/usr/src/sys.386bsd/i386/isa/npx.c Mon Jul 13 13:24:27 1992 --- usr/src/sys.386bsd/i386/isa/npx.c Fri Jan 22 23:30:37 1993 *************** *** 127,131 **** asm(" fldcw %0" : : "g" (wd)); if (curpcb) { ! asm(" fnsave %0 " : : "g" (curpcb->pcb_savefpu) ); curpcb->pcb_flags |= FP_NEEDSRESTORE; } --- 127,131 ---- asm(" fldcw %0" : : "g" (wd)); if (curpcb) { ! asm(" fnsave 0(%0) " : : "a" (&curpcb->pcb_savefpu) ); curpcb->pcb_flags |= FP_NEEDSRESTORE; } *************** *** 142,146 **** npxproc = curproc; npxpcb = curpcb; ! asm(" frstor %0 " : : "g" (curpcb->pcb_savefpu) ); } --- 142,146 ---- npxproc = curproc; npxpcb = curpcb; ! asm(" frstor 0(%0) " : : "a" (&curpcb->pcb_savefpu) ); } *************** *** 151,155 **** if (npxproc == 0) panic ("npxunload"); ! asm(" fsave %0 " : : "g" (npxpcb->pcb_savefpu) ); npxproc = 0 ; } --- 151,155 ---- if (npxproc == 0) panic ("npxunload"); ! asm(" fsave 0(%0) " : : "a" (&npxpcb->pcb_savefpu) ); npxproc = 0 ; } *************** *** 168,172 **** /* sync state in process context structure, in advance of debugger/process looking for it */ if (npxproc == 0 || npxexists == 0) panic ("npxintr"); ! asm (" fnsave %0 " : : "g" (npxpcb->pcb_savefpu) ); #ifdef notyet --- 168,172 ---- /* sync state in process context structure, in advance of debugger/process looking for it */ if (npxproc == 0 || npxexists == 0) panic ("npxintr"); ! asm (" fnsave 0(%0) " : : "a" (&npxpcb->pcb_savefpu) ); #ifdef notyet *************** *** 207,211 **** load_cr0(rcr0() & ~CR0_EM); /* stop emulating */ if (curpcb->pcb_flags & FP_NEEDSRESTORE) ! asm(" frstor %0 " : : "g" (curpcb->pcb_savefpu)); curpcb->pcb_flags |= FP_WASUSED | FP_NEEDSSAVE; curpcb->pcb_flags &= ~FP_NEEDSRESTORE; --- 207,211 ---- load_cr0(rcr0() & ~CR0_EM); /* stop emulating */ if (curpcb->pcb_flags & FP_NEEDSRESTORE) ! asm(" frstor 0(%0) " : : "a" (&curpcb->pcb_savefpu)); curpcb->pcb_flags |= FP_WASUSED | FP_NEEDSSAVE; curpcb->pcb_flags &= ~FP_NEEDSRESTORE; *** /gandalf/D/usr/src/sys.386bsd/i386/isa/pccons.c Sat Jan 23 09:59:29 1993 --- usr/src/sys.386bsd/i386/isa/pccons.c Fri Jan 22 22:05:57 1993 *************** *** 859,862 **** --- 859,863 ---- unsigned __debug = 0; /*0xffe */; + #if 0 static char scantokey[] { 0, *************** *** 1127,1130 **** --- 1128,1132 ---- 118, /* F7 */ }; + #endif #define CODE_SIZE 4 /* Use a max of 4 for now... */ typedef struct *** /gandalf/D/usr/src/sys.386bsd/sys/systm.h Sat Jan 23 10:00:57 1993 --- usr/src/sys.386bsd/sys/systm.h Fri Jan 22 22:06:31 1993 *************** *** 105,109 **** void bzero __P((void *buf, u_int len)); int bcmp __P((void *str1, void *str2, u_int len)); ! int strlen __P((char *string)); int copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done)); --- 105,109 ---- void bzero __P((void *buf, u_int len)); int bcmp __P((void *str1, void *str2, u_int len)); ! int strlen __P((const char *string)); int copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done)); *** /gandalf/D/usr/src/sys.386bsd/kern/init_main.c Sun Jul 12 02:32:04 1992 --- usr/src/sys.386bsd/kern/init_main.c Fri Jan 22 23:34:52 1993 *************** *** 85,88 **** --- 85,91 ---- int boothowto; + /* This is for GCC-2 */ + __main() {} + /* * System startup; initialize the world, create process 0, *** /gandalf/D/usr/src/sys.386bsd/i386/include/segments.h Mon Jul 13 12:39:11 1992 --- usr/src/sys.386bsd/i386/include/segments.h Fri Jan 22 23:45:51 1993 *************** *** 43,46 **** --- 43,48 ---- */ + #pragma pack(1) + /* * Selectors *************** *** 195,196 **** --- 197,199 ---- #define NIDT 256 #define NRSVIDT 32 /* reserved entries for cpu exceptions */ + #pragma pack(4) diff -r -C2 //usr/src/sbin/route/route.c usr/src/sbin/route/route.c *** //usr/src/sbin/route/route.c Sat Feb 8 02:37:01 1992 --- usr/src/sbin/route/route.c Fri Jan 22 15:41:25 1993 *************** *** 79,83 **** union sockunion { struct sockaddr sa; ! struct sockaddr_in sin; #ifdef notdef struct sockaddr_ns sns; --- 79,83 ---- union sockunion { struct sockaddr sa; ! struct sockaddr_in s_in; #ifdef notdef struct sockaddr_ns sns; *************** *** 99,103 **** int iflag, verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; ! struct sockaddr_in sin = { sizeof(sin), AF_INET }; struct rt_metrics rt_metrics; u_long rtm_inits; --- 99,103 ---- int iflag, verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; ! struct sockaddr_in s_in = { sizeof(s_in), AF_INET }; struct rt_metrics rt_metrics; u_long rtm_inits; *************** *** 672,676 **** if (af == AF_INET && hp && hp->h_addr_list[1]) { hp->h_addr_list++; ! bcopy(hp->h_addr_list[0], (caddr_t)&so_dst.sin.sin_addr, hp->h_length); } else --- 672,676 ---- if (af == AF_INET && hp && hp->h_addr_list[1]) { hp->h_addr_list++; ! bcopy(hp->h_addr_list[0], (caddr_t)&so_dst.s_in.sin_addr, hp->h_length); } else *************** *** 707,713 **** void ! inet_makenetandmask(net, sin) u_long net; ! register struct sockaddr_in *sin; { u_long addr, mask = 0; --- 707,713 ---- void ! inet_makenetandmask(net, s_in) u_long net; ! register struct sockaddr_in *s_in; { u_long addr, mask = 0; *************** *** 737,749 **** mask = -1; } ! sin->sin_addr.s_addr = htonl(addr); ! sin = &so_mask.sin; ! sin->sin_addr.s_addr = htonl(mask); ! sin->sin_len = 0; ! sin->sin_family = 0; ! cp = (char *)(&sin->sin_addr + 1); ! while (*--cp == 0 && cp > (char *)sin) ; ! sin->sin_len = 1 + cp - (char *)sin; } --- 737,749 ---- mask = -1; } ! s_in->sin_addr.s_addr = htonl(addr); ! s_in = &so_mask.s_in; ! s_in->sin_addr.s_addr = htonl(mask); ! s_in->sin_len = 0; ! s_in->sin_family = 0; ! cp = (char *)(&s_in->sin_addr + 1); ! while (*--cp == 0 && cp > (char *)s_in) ; ! s_in->sin_len = 1 + cp - (char *)s_in; } *************** *** 813,818 **** if (((val = inet_addr(s)) != -1) && (which != RTA_DST || forcenet == 0)) { ! su->sin.sin_addr.s_addr = val; ! if (inet_lnaof(su->sin.sin_addr) != INADDR_ANY) return (1); else { --- 813,818 ---- if (((val = inet_addr(s)) != -1) && (which != RTA_DST || forcenet == 0)) { ! su->s_in.sin_addr.s_addr = val; ! if (inet_lnaof(su->s_in.sin_addr) != INADDR_ANY) return (1); else { *************** *** 819,823 **** val = ntohl(val); out: if (which == RTA_DST) ! inet_makenetandmask(val, &su->sin); return (0); } --- 819,823 ---- val = ntohl(val); out: if (which == RTA_DST) ! inet_makenetandmask(val, &su->s_in); return (0); } *************** *** 835,840 **** if (hp) { *hpp = hp; ! su->sin.sin_family = hp->h_addrtype; ! bcopy(hp->h_addr, (char *)&su->sin.sin_addr, hp->h_length); return (1); } --- 835,840 ---- if (hp) { *hpp = hp; ! su->s_in.sin_family = hp->h_addrtype; ! bcopy(hp->h_addr, (char *)&su->s_in.sin_addr, hp->h_length); return (1); } *************** *** 1199,1203 **** case AF_INET: (void) printf("%s: inet %s; ", ! which, inet_ntoa(su->sin.sin_addr)); break; #ifdef notdef --- 1199,1203 ---- case AF_INET: (void) printf("%s: inet %s; ", ! which, inet_ntoa(su->s_in.sin_addr)); break; #ifdef notdef *** /gandalf/D/usr/src/sys.386bsd/kern/subr_xxx.c Tue Dec 24 23:24:08 1991 --- usr/src/sys.386bsd/kern/subr_xxx.c Sun Jan 24 09:46:08 1993 *************** *** 199,203 **** #ifdef NEED_STRLEN strlen(s1) ! register char *s1; { register int len; --- 199,203 ---- #ifdef NEED_STRLEN strlen(s1) ! const register char *s1; { register int len; diff -r -C2 //usr/src/usr.bin/tftp//main.c usr/src/usr.bin/tftp//main.c *** //usr/src/usr.bin/tftp//main.c Fri Apr 19 03:21:48 1991 --- usr/src/usr.bin/tftp//main.c Fri Jan 22 15:36:29 1993 *************** *** 62,66 **** #define TIMEOUT 5 /* secs between rexmt's */ ! struct sockaddr_in sin; int f; short port; --- 62,66 ---- #define TIMEOUT 5 /* secs between rexmt's */ ! struct sockaddr_in s_in; int f; short port; *************** *** 128,132 **** char *argv[]; { ! struct sockaddr_in sin; int top; --- 128,132 ---- char *argv[]; { ! struct sockaddr_in s_in; int top; *************** *** 141,147 **** exit(3); } ! bzero((char *)&sin, sizeof (sin)); ! sin.sin_family = AF_INET; ! if (bind(f, (struct sockaddr *)&sin, sizeof (sin)) < 0) { perror("tftp: bind"); exit(1); --- 141,147 ---- exit(3); } ! bzero((char *)&s_in, sizeof (s_in)); ! s_in.sin_family = AF_INET; ! if (bind(f, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) { perror("tftp: bind"); exit(1); *************** *** 181,191 **** host = gethostbyname(argv[1]); if (host) { ! sin.sin_family = host->h_addrtype; ! bcopy(host->h_addr, &sin.sin_addr, host->h_length); strcpy(hostname, host->h_name); } else { ! sin.sin_family = AF_INET; ! sin.sin_addr.s_addr = inet_addr(argv[1]); ! if (sin.sin_addr.s_addr == -1) { connected = 0; printf("%s: unknown host\n", argv[1]); --- 181,191 ---- host = gethostbyname(argv[1]); if (host) { ! s_in.sin_family = host->h_addrtype; ! bcopy(host->h_addr, &s_in.sin_addr, host->h_length); strcpy(hostname, host->h_name); } else { ! s_in.sin_family = AF_INET; ! s_in.sin_addr.s_addr = inet_addr(argv[1]); ! if (s_in.sin_addr.s_addr == -1) { connected = 0; printf("%s: unknown host\n", argv[1]); *************** *** 313,318 **** return; } ! bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); ! sin.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); --- 313,318 ---- return; } ! bcopy(hp->h_addr, (caddr_t)&s_in.sin_addr, hp->h_length); ! s_in.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); *************** *** 332,336 **** printf("putting %s to %s:%s [%s]\n", cp, hostname, targ, mode); ! sin.sin_port = port; sendfile(fd, targ, mode); return; --- 332,336 ---- printf("putting %s to %s:%s [%s]\n", cp, hostname, targ, mode); ! s_in.sin_port = port; sendfile(fd, targ, mode); return; *************** *** 350,354 **** printf("putting %s to %s:%s [%s]\n", argv[n], hostname, targ, mode); ! sin.sin_port = port; sendfile(fd, targ, mode); } --- 350,354 ---- printf("putting %s to %s:%s [%s]\n", argv[n], hostname, targ, mode); ! s_in.sin_port = port; sendfile(fd, targ, mode); } *************** *** 406,411 **** continue; } ! bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); ! sin.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); --- 406,411 ---- continue; } ! bcopy(hp->h_addr, (caddr_t)&s_in.sin_addr, hp->h_length); ! s_in.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); *************** *** 421,425 **** printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); ! sin.sin_port = port; recvfile(fd, src, mode); break; --- 421,425 ---- printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); ! s_in.sin_port = port; recvfile(fd, src, mode); break; *************** *** 434,438 **** printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); ! sin.sin_port = port; recvfile(fd, src, mode); } --- 434,438 ---- printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); ! s_in.sin_port = port; recvfile(fd, src, mode); } diff -r -C2 //usr/src/usr.bin/tftp//tftp.c usr/src/usr.bin/tftp//tftp.c *** //usr/src/usr.bin/tftp//tftp.c Fri Apr 19 03:21:49 1991 --- usr/src/usr.bin/tftp//tftp.c Fri Jan 22 15:34:36 1993 *************** *** 56,60 **** extern int errno; ! extern struct sockaddr_in sin; /* filled in by main */ extern int f; /* the opened socket */ extern int trace; --- 56,60 ---- extern int errno; ! extern struct sockaddr_in s_in; /* filled in by main */ extern int f; /* the opened socket */ extern int trace; *************** *** 123,127 **** tpacket("sent", dp, size + 4); n = sendto(f, dp, size + 4, 0, ! (struct sockaddr *)&sin, sizeof (sin)); if (n != size + 4) { perror("tftp: sendto"); --- 123,127 ---- tpacket("sent", dp, size + 4); n = sendto(f, dp, size + 4, 0, ! (struct sockaddr *)&s_in, sizeof (s_in)); if (n != size + 4) { perror("tftp: sendto"); *************** *** 141,145 **** goto abort; } ! sin.sin_port = from.sin_port; /* added */ if (trace) tpacket("received", ap, n); --- 141,145 ---- goto abort; } ! s_in.sin_port = from.sin_port; /* added */ if (trace) tpacket("received", ap, n); *************** *** 221,226 **** if (trace) tpacket("sent", ap, size); ! if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&sin, ! sizeof (sin)) != size) { alarm(0); perror("tftp: sendto"); --- 221,226 ---- if (trace) tpacket("sent", ap, size); ! if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&s_in, ! sizeof (s_in)) != size) { alarm(0); perror("tftp: sendto"); *************** *** 240,244 **** goto abort; } ! sin.sin_port = from.sin_port; /* added */ if (trace) tpacket("received", dp, n); --- 240,244 ---- goto abort; } ! s_in.sin_port = from.sin_port; /* added */ if (trace) tpacket("received", dp, n); *************** *** 280,284 **** ap->th_opcode = htons((u_short)ACK); /* has seen err msg */ ap->th_block = htons((u_short)block); ! (void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&sin, sizeof (sin)); write_behind(file, convert); /* flush last buffer */ fclose(file); --- 280,284 ---- ap->th_opcode = htons((u_short)ACK); /* has seen err msg */ ap->th_block = htons((u_short)block); ! (void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&s_in, sizeof (s_in)); write_behind(file, convert); /* flush last buffer */ fclose(file); *************** *** 349,354 **** if (trace) tpacket("sent", tp, length); ! if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&sin, ! sizeof (sin)) != length) perror("nak"); } --- 349,354 ---- if (trace) tpacket("sent", tp, length); ! if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&s_in, ! sizeof (s_in)) != length) perror("nak"); } diff -r -C2 //usr/src/libexec/tftpd/tftpd.c usr/src/libexec/tftpd/tftpd.c *** //usr/src/libexec/tftpd/tftpd.c Fri Apr 12 23:26:58 1991 --- usr/src/libexec/tftpd/tftpd.c Fri Jan 22 15:42:59 1993 *************** *** 70,74 **** extern int errno; ! struct sockaddr_in sin = { AF_INET }; int peer; int rexmtval = TIMEOUT; --- 70,74 ---- extern int errno; ! struct sockaddr_in s_in = { AF_INET }; int peer; int rexmtval = TIMEOUT; *************** *** 165,169 **** exit(1); } ! if (bind(peer, (struct sockaddr *)&sin, sizeof (sin)) < 0) { syslog(LOG_ERR, "bind: %m\n"); exit(1); --- 165,169 ---- exit(1); } ! if (bind(peer, (struct sockaddr *)&s_in, sizeof (s_in)) < 0) { syslog(LOG_ERR, "bind: %m\n"); exit(1); *** /usr/src/usr.bin/tar/regex.h Tue Feb 25 22:36:29 1992 --- ./usr/src/usr.bin/tar/regex.h Sat Jan 30 11:18:15 1993 *************** *** 19,23 **** #ifdef __GNUC__ - #pragma once #endif --- 19,22 ---- *** /usr/src/usr.bin/diff/regex.h Sun Apr 5 00:40:09 1992 --- ./usr/src/usr.bin/diff/regex.h Sat Jan 30 11:18:59 1993 *************** *** 19,23 **** #ifdef __GNUC__ - #pragma once #endif --- 19,22 ---- -- phk@data.fls.dk || The seven hazards of computing: Poul-Henning Kamp || The hardware, the software, the supplier FLS DATA A/S, Denmark || the application, the user, the operator Phone: (+45) 36 18 12 35 || and the data. Stan Kelly-Bootle