Subject: Object file symbols limited to 8 characters [+FIX] (#167 - #10 of 19) Index: cc,as,ld,ar,ranlib,nm,nlist,adb,... (2.11BSD) Description: For some time now (seem like eons;-)) the object file format used by Unix for the PDP-11 has restricted symbols to 8 significant characters (actually 7 due to the C compiler prefixing symbols with a leading tilde (~) or underscore (_)). Aside from the "creative constraints" this imposes on the programmer there was the continuing problem of 'name collisions', especially when porting applications from machines whose object file format permitted longer symbol names. Numerous workarounds have been employed in the past. The most common one relied on a combination of a name collision detection program ('shortc') and the flexname capability of the C preprocessor ('cpp'). This served to mask the problem while making debugging difficult due to mangled/synthetic symbol names. Repeat-By: Attempt to compile the following program: int this_is_a_long_name; int this_is_a_long_name_too; main() { exit(0)}; Fix: This section is repeated in each of the 19 parts which make up the update kit. You should read it perhaps once or twice, but then skip over it (how to do that is mentioned below). Taking a "hint" from the a.out(5) man page: "The compiler will note name collisions when they occur within a single file... There is really little that can be done about this. Some thought is being given to modifying the loader to flag detectable collisions, but the real solution would be to change over to the 4BSD a.out format. This would involve modifying the compiler, assembler and adb and then simply porting the 4.3BSD ld, nm, ranlib, strip and nlist. Or perhaps simply porting the entire 4.3BSD suite might be best ... Anyone interested in a project?" This I have done. No more volunteers for the project need apply ;-) The new limit on symbol length is 32 characters! There is still a limit (but it is _much_ more reasonable now) simply because of address space constraints - it needs to be possible to hold at least one of the 'symbol' or 'string' tables in memory in many cases (nice to hold both, but - i know, get a 486;-)). It must be noted though that it is almost trivial now to raise the limit if that is desired - the programs which need to know the maximum length of a symbol string all have an easily changed #define statement now (usually MAXSYMLEN but there are a couple exceptions). The 'string table' format itself doesn't care how long the strings are. The actual a.out format won't have to change again to accomodate a higher limit on symbol name length! The "string table" object file format has been ported and all the necessary changes made throughout the entire system. The changes were *massive* and widespread. Programs affected of course included the assembler and compiler. Other programs affected were anything which accessed a symbol table entry either via nlist(3) [ps, pstat, fstat, vmstat, etc] or by reading object files [ld, ranlib, nm, adb, strip, etc]. The actual changes to the compiler and assembler were minor because those programs had already been modified earlier (updates #142, 143, 152, 153). The compiler only needed to have the maximum size of a symbol name raised. The assembler already knew how to generate 'string table' object files - all that needed to be done in 'as' was to flip a bit telling it to generate the new object format instead of the old style. +++++++++++++++ And now for a bit of a narrative about what was done. The detailed instructions for applying this part (#10 of 19) of the update kit follow the 'story' below. This started out as a semi-organized accounting of what was done but then devolved into a semi-rambling tale due to the sheer bulk of the changes. You can skip to the details for applying #167 by searching for the string "=======" below - this header is replicated in all parts of this kit. +++++++++++++++ Alas, the remaining changes were not so simple. Complete replacements for ranlib(1), ar(1), nlist(3) were ported from the Net-2 release. Other programs such as symorder(1) and two new programs 'symcompact' and 'strcompact' (used to compress/compact symbol and string tables) were written from scratch. Perhaps the two hardest parts of the whole effort were rewriting the linker 'ld' and making *large* modifications to the debugger 'adb'. This was a very difficult job. 'ld needed to scan new style ranlib archives, as well as using the "virtual memory" facility (the 'libvmf' routines posted earlier) for symbol table management and so on. 'adb' was a MESS (having been written in a pseudo block structured macro language). Since the new symbol table entry could be so much larger than the old it was no longer possible for adb to hold as much of the symbol table in memory - an alternate method took a while to develope and implement, more on that in the patch which deals with adb (actually the changes to adb are so large there are two substantial parts of this update kit just for adb!). After the basic programs (ar, ld, ranlib, etc) were running the system had to be completely recompiled from sources, beginning with the object libraries. After those were done the process of recompiling the rest of the system could proceed. Guess what happens when you recreate libc.a with a buggy linker? Yep - the system is rendered useless until backup copies of everything can be reloaded. Don't let this happen to you - be sure (and i'll repeat the point later) to back up the system (or at least key executables and .a files) before installing this upgrade. In all there were about 330 files modified during the change of object file format. Some of these were not directly related to the new object file format. There were a number of (obsolete) references to "BSD2_10" lingering in the system. Those have been replaced with "pdp11" and the 'BSD2_10' define has been removed from the C preprocessor (cpp). DO NOT use 'BSD2_10' to #ifdef pdp-11 sensitive code, use "pdp11" instead. During the recompile of the libraries a fairly large number of "shortened" names were lengthened - these included syscall routines such as "gethostname" which no longer had to be munged into "gethname". Also a surprising number of typographical errors were uncovered (mainly in the Fortran libraries) where an extra character (beyond the 7th character) was left off or accidentally added. These were all fixed and eventually, after a couple evenings, the libraries were built and installed. After the libraries were done it was the application programs' turn to be recompiled. This took the better part of a couple weeks to finally make it thru due to (as it turned out) the iterative nature of the task. A symbol would come up undefined and have to be tracked down exactly where the wrong definition/use was coming from. Finally, however, the task was done and it was time to move on to the kernel. The kernel proved to be suprisingly easy - no real complications arose except when it came time to reboot, a bug had been introduced into 'autoconfig' (who uses 'nlist' to scan the kernel symbol table). Ouch! That was another couple late nights. Since the compiler supports unsigned longs now a number of small changes which ifdef'd 'u_long' to 'long' were removed. REMEMBER - you need to recompile 'autoconfig' and install it before rebooting the new kernel ;-) The performance of 'ps' though (and anything else which used nlist(3), 'fstat', 'w' are good examples) was unacceptably slow. So, amidst other delays (real work, the earthquake - which almost tossed the disc drive to the floor, etc) the "symorder" program was written (with ideas borrowed from the Net-2 version). The symorder(1) program rather insists on holding both the symbol and string tables in memory - this was a problem (or could be if the kernel symbol table grows much more) so two new and original programs were written: 'symcompact' and 'strcompact'. The first program compacts the symbol table by removing 'register' local variables (they're of no use to anyone - the debugger doesn't/can't do anything with them) and redundant global text symbols (symbols in an overlaid program which are in the root segment do not need both the '~' and '_' symbols present). The second program 'strcompact' is one that any 'string table' based object file system can use. It implements "shared strings" for symbols - if a program has many references to 'error' as a local symbol, why store the string 'error' more than once? Simply store one instance and then update the symbol table entries to all point to the same string! Using both 'strcompact' and 'symcompact' on the /unix image resulted in a file that was 15kb smaller. Running 'symorder' then puts the most frequently used symbols at the front of the symbol table, the performance of 'w', 'pstat', and other programs which nlist(3) the kernel was now acceptable. Some of the parts of this kit are large. The large patch files have been split into pieces which the 'patch' will handle, other parts (the replacement 'ar' sources) were left as a single 'shar' file rather than split them up. Each part of this kit consists of: a 'patchfile' - this is used with the "patch" program to update files. an optional 'script' - this is run ("sh script") to perform initialization, remove files, create directories and so on. an optional 'new.sources' - this is a "shar" file containing complete sources for a program. ALL pathnames are _absolute_ - this way you do not have to "cd" around the system, you should be able to apply all the patches while you are in /tmp (or /usr/tmp - wherever you have the most free space). Be sure that you have at least 40mb free on /usr before rebuilding the system - if you do not then building in stages will be necessary. Part 19 contains the detailed instructions for rebuilding the system _after_ the previous 18 patches have been applied. The patches (#158 thru #175) should be applied in order following the directions in each part. DO NOT recompile anything once the patching has begun until requested to do so in part 19. Many of the system include files are modified and the object file format is being changed - recompilation will not be possible until the transformation of the system and object libraries is complete. AT A MINIMUM you will want to back up the following files (unless you have a known good backup already made) in case you need to recompile something before part 19 is done: /bin/ar /bin/ld /bin/nm /bin/as /usr/bin/ranlib /lib/c0 /lib/crt0.o /lib/mcrt0.o /lib/libc.a /bin/nm /usr/include/*.h /usr/include/sys/*.h In part 19 there is a *complete* list of all files affected (all 336 of them) - you may wish to back those up also. And now the common header ('boilerplate') is over (at last ;-)), let the installation guide begin. As always, the complete 2.11BSD updates are available via anonymous FTP to 'ftp.iipo.gtegsc.com' in the directory /pub/2.11BSD ========== #167 (Part #10 of 19) This part updates the following files. BACK THESE UP if you have any worries about the proceedure or do not have a bootable backup already at hand. /usr/src/lib/c2/c2.h /usr/src/lib/c2/c21.c /usr/src/lib/cpp/Makefile /usr/src/lib/ccom/c0.h /usr/src/lib/libc/gen/nlist.c /usr/src/lib/libc/gen/syslog.c /usr/src/lib/libc/gen/Makefile /usr/src/lib/libc/net/named/gethnamadr.c /usr/src/lib/libc/net/named/Makefile /usr/src/lib/libc/net/Makefile /usr/src/lib/libc/pdp/gen/nsym.c /usr/src/lib/libc/pdp/gen/Makefile /usr/src/lib/libc/pdp/gen/rollback.s /usr/src/lib/libc/pdp/gen/setjmp.s /usr/src/lib/libc/pdp/csu/mcount.s /usr/src/lib/libc/pdp/sys/gethostname.s /usr/src/lib/libc/pdp/sys/getsockname.s /usr/src/lib/libc/pdp/sys/gethostid.s /usr/src/lib/libc/pdp/sys/sethostid.s /usr/src/lib/libc/pdp/sys/sethostname.s /usr/src/lib/libc/stdio/getw.c /usr/src/lib/libc/stdio/putw.c /usr/src/lib/libc/inet/inet_addr.c 0) Be in a temp directory ("cd /tmp" or "cd /usr/tmp") 1) Save the following shar archive to a file (/tmp/167 for example) 2) Unpack the archive: sh 167 3) Run the script: ./script 4) Patch the files: patch -p0 < patchfile 5) Unpack the new source replacements: sh new.sources 6) rm 167 script patchfile new.sources Part 10 of 19 is done. DO NOT rebuild or compile _anything_ at this point! ====== cut here #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # script # patchfile # new.sources # This archive created: Fri Feb 4 22:52:07 1994 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'script' then echo shar: "will not over-write existing file 'script'" else sed 's/^X//' << \SHAR_EOF > 'script' X#! /bin/sh X Xrm -f /usr/src/lib/libc/gen/nlist.c Xrm -f /usr/src/lib/libc/gen/nsym.c SHAR_EOF chmod 755 'script' fi if test -f 'patchfile' then echo shar: "will not over-write existing file 'patchfile'" else sed 's/^X//' << \SHAR_EOF > 'patchfile' X*** /usr/src/lib/c2/c2.h.old Tue Oct 29 14:08:45 1991 X--- /usr/src/lib/c2/c2.h Sun Jan 2 15:09:25 1994 X*************** X*** 1,9 **** X--- 1,15 ---- X /* X * Header for object code improver X+ * X+ * Several character buffers (used to store contents of registers, X+ * constants, etc) needed to be increased in size to handle the X+ * larger symbols passed thru from the compiler. X */ X X #include X X+ #define MAXCPS 32 X+ X #ifndef CHECK X #define CHECK(x) X #endif X*************** X*** 118,127 **** X char *alastr; X char *firstr; X char revbr[]; X! char regs[12][20]; X! char conloc[20]; X! char conval[20]; X! char ccloc[20]; X X #define RT1 10 X #define RT2 11 X--- 124,133 ---- X char *alastr; X char *firstr; X char revbr[]; X! char regs[12][MAXCPS + 1]; X! char conloc[MAXCPS + 1]; X! char conval[MAXCPS + 1]; X! char ccloc[MAXCPS + 1]; X X #define RT1 10 X #define RT2 11 X*** /usr/src/lib/c2/c21.c.old Wed Mar 18 02:56:08 1992 X--- /usr/src/lib/c2/c21.c Sun Jan 2 15:09:56 1994 X*************** X*** 229,235 **** X repladdr(p, 0, flt); X source(regs[RT1]); X if (p->back->op == TST && !flt && not_sp(regs[RT1])) { X! char rt1[20]; X strcpy(rt1, regs[RT1]); X singop(p->back); X if (!strcmp("(sp)+", regs[RT1])) { X--- 229,235 ---- X repladdr(p, 0, flt); X source(regs[RT1]); X if (p->back->op == TST && !flt && not_sp(regs[RT1])) { X! char rt1[MAXCPS + 2]; X strcpy(rt1, regs[RT1]); X singop(p->back); X if (!strcmp("(sp)+", regs[RT1])) { X*** /usr/src/lib/cpp/Makefile.old Mon Jan 18 08:47:51 1993 X--- /usr/src/lib/cpp/Makefile Sun Jan 2 23:10:43 1994 X*************** X*** 12,18 **** X # If you don't have split I/D, you'll have to edit the constant X # SBSIZE in cpp.c to reflect this. X X! CFLAGS=-O -Dpdp11=1 -DFLEXNAMES -DBSD2_10 X SEPFLAG=-i X X cpp : cpp.o cpy.o rodata.o X--- 12,18 ---- X # If you don't have split I/D, you'll have to edit the constant X # SBSIZE in cpp.c to reflect this. X X! CFLAGS=-O -Dpdp11=1 -DFLEXNAMES X SEPFLAG=-i X X cpp : cpp.o cpy.o rodata.o X*** /usr/src/lib/ccom/c0.h.old Sun Jun 6 20:19:33 1993 X--- /usr/src/lib/ccom/c0.h Sun Jan 2 15:05:59 1994 X*************** X*** 12,20 **** X * NOTE: there are _exactly_ 4 references to this in all of c0. There are X * _NO_ references to it in c1. Just make sure that the value is less than X * 79 and c1 will be oblivious to the length of a symbol name. X */ X X! #define MAXCPS 8 /* # chars per symbol */ X X #define LTYPE long /* change to int if no long consts */ X #define MAXINT 077777 /* Largest positive short integer */ X--- 12,23 ---- X * NOTE: there are _exactly_ 4 references to this in all of c0. There are X * _NO_ references to it in c1. Just make sure that the value is less than X * 79 and c1 will be oblivious to the length of a symbol name. X+ * X+ * NOTE: The optimizer (c2) needs to be updated if the size of a symbol X+ * changes. See the file c2.h X */ X X! #define MAXCPS 32 /* # chars per symbol */ X X #define LTYPE long /* change to int if no long consts */ X #define MAXINT 077777 /* Largest positive short integer */ X*** /usr/src/lib/libc/gen/syslog.c.old Fri Dec 29 20:02:38 1989 X--- /usr/src/lib/libc/gen/syslog.c Mon Jan 10 21:58:49 1994 X*************** X*** 5,11 **** X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)syslog.c 5.9 (Berkeley) 5/7/86"; X #endif LIBC_SCCS and not lint X X /* X--- 5,11 ---- X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)syslog.c 5.9.1 (2.11BSD GTE) 1/1/94"; X #endif LIBC_SCCS and not lint X X /* X*************** X*** 42,48 **** X X static char logname[] = "/dev/log"; X static char ctty[] = "/dev/console"; X! #ifdef BSD2_10 X static char logfile[] = "/usr/adm/messages"; X static int ToFile = 0; /* set if logfile is used */ X #endif X--- 42,48 ---- X X static char logname[] = "/dev/log"; X static char ctty[] = "/dev/console"; X! #ifdef pdp11 X static char logfile[] = "/usr/adm/messages"; X static int ToFile = 0; /* set if logfile is used */ X #endif X*************** X*** 124,130 **** X c = MAXLINE; X X /* output the message to the local logger */ X! #ifdef BSD2_10 X if (ToFile) { X if (write(LogFile, outline, c) == c) X return; X--- 124,130 ---- X c = MAXLINE; X X /* output the message to the local logger */ X! #ifdef pdp11 X if (ToFile) { X if (write(LogFile, outline, c) == c) X return; X*************** X*** 178,184 **** X strncpy(SyslogAddr.sa_data, logname, sizeof SyslogAddr.sa_data); X if (LogStat & LOG_NDELAY) { X LogFile = socket(AF_UNIX, SOCK_DGRAM, 0); X! #ifdef BSD2_10 X if (LogFile < 0) { X LogFile = open(logfile, O_WRONLY|O_APPEND); X ToFile = 1; X--- 178,184 ---- X strncpy(SyslogAddr.sa_data, logname, sizeof SyslogAddr.sa_data); X if (LogStat & LOG_NDELAY) { X LogFile = socket(AF_UNIX, SOCK_DGRAM, 0); X! #ifdef pdp11 X if (LogFile < 0) { X LogFile = open(logfile, O_WRONLY|O_APPEND); X ToFile = 1; X*** /usr/src/lib/libc/gen/Makefile.old Fri Mar 12 22:28:31 1993 X--- /usr/src/lib/libc/gen/Makefile Sat Jan 1 13:55:28 1994 X*************** X*** 181,188 **** X strcasecmp.o: strcasecmp.c X swab.o: swab.c X syslog.o: syslog.c /usr/include/sys/types.h /usr/include/netdb.h X! syslog.o: /usr/include/short_names.h /usr/include/sys/socket.h X! syslog.o: /usr/include/short_names.h /usr/include/sys/file.h X syslog.o: /usr/include/sys/signal.h /usr/include/sys/syslog.h X syslog.o: /usr/include/strings.h X system.o: system.c /usr/include/signal.h X--- 181,188 ---- X strcasecmp.o: strcasecmp.c X swab.o: swab.c X syslog.o: syslog.c /usr/include/sys/types.h /usr/include/netdb.h X! syslog.o: /usr/include/sys/socket.h X! syslog.o: /usr/include/sys/file.h X syslog.o: /usr/include/sys/signal.h /usr/include/sys/syslog.h X syslog.o: /usr/include/strings.h X system.o: system.c /usr/include/signal.h X*** /usr/src/lib/libc/net/named/gethnamadr.c.old Mon Dec 26 14:55:07 1988 X--- /usr/src/lib/libc/net/named/gethnamadr.c Mon Jan 10 21:59:26 1994 X*************** X*** 11,17 **** X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)gethostnamadr.c 6.31 (Berkeley) 3/14/88"; X #endif /* LIBC_SCCS and not lint */ X X #include X--- 11,17 ---- X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)gethostnamadr.c 6.31.1 (2.11BSD GTE) 1/1/94"; X #endif /* LIBC_SCCS and not lint */ X X #include X*************** X*** 24,35 **** X #include X #include X #include X- X- #ifdef BSD2_10 X- #define host_addrs h_addrs X- #define _gethtbyaddr _ghtbaddr X- #define _gethtbyname _ghtbname X- #endif X X #define MAXALIASES 35 X #define MAXADDRS 35 X--- 24,29 ---- X*** /usr/src/lib/libc/net/named/Makefile.old Sat Sep 17 00:50:50 1988 X--- /usr/src/lib/libc/net/named/Makefile Sat Jan 1 13:54:11 1994 X*************** X*** 43,57 **** X # DO NOT DELETE THIS LINE -- mkdep uses it. X # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. X X! gethnamadr.o: gethnamadr.c /usr/include/sys/types.h /usr/include/sys/socket.h X! gethnamadr.o: /usr/include/short_names.h /usr/include/netinet/in.h X! gethnamadr.o: /usr/include/short_names.h /usr/include/ctype.h X! gethnamadr.o: /usr/include/netdb.h /usr/include/short_names.h X! gethnamadr.o: /usr/include/stdio.h /usr/include/errno.h X! gethnamadr.o: /usr/include/arpa/inet.h /usr/include/short_names.h X! gethnamadr.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X sethostent.o: sethostent.c /usr/include/sys/types.h /usr/include/arpa/nameser.h X! sethostent.o: /usr/include/netinet/in.h /usr/include/short_names.h X! sethostent.o: /usr/include/resolv.h X X # IF YOU PUT ANYTHING HERE IT WILL GO AWAY X--- 43,57 ---- X # DO NOT DELETE THIS LINE -- mkdep uses it. X # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. X X! gethnamadr.o: gethnamadr.c /usr/include/sys/param.h X! gethnamadr.o: /usr/include/sys/localopts.h /usr/include/machine/machparam.h X! gethnamadr.o: /usr/include/sys/types.h /usr/include/signal.h X! gethnamadr.o: /usr/include/sys/types.h /usr/include/sys/socket.h X! gethnamadr.o: /usr/include/netinet/in.h /usr/include/ctype.h X! gethnamadr.o: /usr/include/netdb.h /usr/include/stdio.h /usr/include/errno.h X! gethnamadr.o: /usr/include/arpa/inet.h /usr/include/arpa/nameser.h X! gethnamadr.o: /usr/include/resolv.h X sethostent.o: sethostent.c /usr/include/sys/types.h /usr/include/arpa/nameser.h X! sethostent.o: /usr/include/netinet/in.h /usr/include/resolv.h X X # IF YOU PUT ANYTHING HERE IT WILL GO AWAY X*** /usr/src/lib/libc/net/Makefile.old Sat Sep 17 00:46:34 1988 X--- /usr/src/lib/libc/net/Makefile Sat Jan 1 13:52:51 1994 X*************** X*** 54,117 **** X # DO NOT DELETE THIS LINE -- mkdep uses it. X # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. X X! getnbyaddr.o: getnbyaddr.c /usr/include/netdb.h /usr/include/short_names.h X! getnbyname.o: getnbyname.c /usr/include/netdb.h /usr/include/short_names.h X getnent.o: getnent.c /usr/include/stdio.h /usr/include/sys/types.h X! getnent.o: /usr/include/sys/socket.h /usr/include/short_names.h X! getnent.o: /usr/include/arpa/inet.h /usr/include/short_names.h X! getnent.o: /usr/include/netdb.h /usr/include/short_names.h /usr/include/ctype.h X getpent.o: getpent.c /usr/include/stdio.h /usr/include/sys/types.h X! getpent.o: /usr/include/sys/socket.h /usr/include/short_names.h X! getpent.o: /usr/include/netdb.h /usr/include/short_names.h /usr/include/ctype.h X! getpname.o: getpname.c /usr/include/netdb.h /usr/include/short_names.h X! getproto.o: getproto.c /usr/include/netdb.h /usr/include/short_names.h X! getsbyname.o: getsbyname.c /usr/include/netdb.h /usr/include/short_names.h X! getsbyport.o: getsbyport.c /usr/include/netdb.h /usr/include/short_names.h X getsent.o: getsent.c /usr/include/stdio.h /usr/include/sys/types.h X! getsent.o: /usr/include/sys/socket.h /usr/include/short_names.h X! getsent.o: /usr/include/netdb.h /usr/include/short_names.h /usr/include/ctype.h X herror.o: herror.c /usr/include/sys/types.h /usr/include/sys/uio.h X rcmd.o: rcmd.c /usr/include/stdio.h /usr/include/ctype.h /usr/include/pwd.h X rcmd.o: /usr/include/sys/param.h /usr/include/sys/localopts.h X! rcmd.o: /usr/include/machine/machparam.h /usr/include/signal.h X! rcmd.o: /usr/include/sys/types.h /usr/include/sys/file.h X rcmd.o: /usr/include/sys/signal.h /usr/include/sys/socket.h X! rcmd.o: /usr/include/short_names.h /usr/include/sys/stat.h X! rcmd.o: /usr/include/netinet/in.h /usr/include/short_names.h X! rcmd.o: /usr/include/netdb.h /usr/include/short_names.h /usr/include/errno.h X res_comp.o: res_comp.c /usr/include/sys/types.h /usr/include/stdio.h X res_comp.o: /usr/include/arpa/nameser.h X res_debug.o: res_debug.c /usr/include/sys/types.h /usr/include/netinet/in.h X! res_debug.o: /usr/include/short_names.h /usr/include/stdio.h X! res_debug.o: /usr/include/arpa/nameser.h X res_init.o: res_init.c /usr/include/sys/types.h /usr/include/sys/socket.h X! res_init.o: /usr/include/short_names.h /usr/include/netinet/in.h X! res_init.o: /usr/include/short_names.h /usr/include/stdio.h X res_init.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X res_mkquery.o: res_mkquery.c /usr/include/stdio.h /usr/include/sys/types.h X! res_mkquery.o: /usr/include/netinet/in.h /usr/include/short_names.h X! res_mkquery.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X res_query.o: res_query.c /usr/include/sys/param.h /usr/include/sys/localopts.h X! res_query.o: /usr/include/machine/machparam.h /usr/include/signal.h X! res_query.o: /usr/include/sys/types.h /usr/include/sys/socket.h X! res_query.o: /usr/include/short_names.h /usr/include/netinet/in.h X! res_query.o: /usr/include/short_names.h /usr/include/ctype.h X! res_query.o: /usr/include/netdb.h /usr/include/short_names.h X! res_query.o: /usr/include/stdio.h /usr/include/errno.h /usr/include/strings.h X! res_query.o: /usr/include/arpa/inet.h /usr/include/short_names.h X! res_query.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X res_send.o: res_send.c /usr/include/sys/param.h /usr/include/sys/localopts.h X! res_send.o: /usr/include/machine/machparam.h /usr/include/signal.h X! res_send.o: /usr/include/sys/types.h /usr/include/sys/time.h X! res_send.o: /usr/include/time.h /usr/include/sys/socket.h X! res_send.o: /usr/include/short_names.h /usr/include/sys/uio.h X! res_send.o: /usr/include/netinet/in.h /usr/include/short_names.h X! res_send.o: /usr/include/stdio.h /usr/include/errno.h X res_send.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X rexec.o: rexec.c /usr/include/sys/types.h /usr/include/sys/socket.h X! rexec.o: /usr/include/short_names.h /usr/include/netinet/in.h X! rexec.o: /usr/include/short_names.h /usr/include/stdio.h /usr/include/netdb.h X! rexec.o: /usr/include/short_names.h /usr/include/errno.h X ruserpass.o: ruserpass.c /usr/include/stdio.h /usr/include/utmp.h X ruserpass.o: /usr/include/ctype.h /usr/include/sys/types.h X ruserpass.o: /usr/include/sys/stat.h /usr/include/errno.h X--- 54,109 ---- X # DO NOT DELETE THIS LINE -- mkdep uses it. X # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. X X! getnbyaddr.o: getnbyaddr.c /usr/include/netdb.h X! getnbyname.o: getnbyname.c /usr/include/netdb.h X getnent.o: getnent.c /usr/include/stdio.h /usr/include/sys/types.h X! getnent.o: /usr/include/sys/socket.h /usr/include/arpa/inet.h X! getnent.o: /usr/include/netdb.h /usr/include/ctype.h X getpent.o: getpent.c /usr/include/stdio.h /usr/include/sys/types.h X! getpent.o: /usr/include/sys/socket.h /usr/include/netdb.h /usr/include/ctype.h X! getpname.o: getpname.c /usr/include/netdb.h X! getproto.o: getproto.c /usr/include/netdb.h X! getsbyname.o: getsbyname.c /usr/include/netdb.h X! getsbyport.o: getsbyport.c /usr/include/netdb.h X getsent.o: getsent.c /usr/include/stdio.h /usr/include/sys/types.h X! getsent.o: /usr/include/sys/socket.h /usr/include/netinet/in.h X! getsent.o: /usr/include/netdb.h /usr/include/ctype.h X herror.o: herror.c /usr/include/sys/types.h /usr/include/sys/uio.h X rcmd.o: rcmd.c /usr/include/stdio.h /usr/include/ctype.h /usr/include/pwd.h X rcmd.o: /usr/include/sys/param.h /usr/include/sys/localopts.h X! rcmd.o: /usr/include/machine/machparam.h /usr/include/sys/types.h X! rcmd.o: /usr/include/signal.h /usr/include/sys/types.h /usr/include/sys/file.h X rcmd.o: /usr/include/sys/signal.h /usr/include/sys/socket.h X! rcmd.o: /usr/include/sys/stat.h /usr/include/netinet/in.h /usr/include/netdb.h X! rcmd.o: /usr/include/errno.h X res_comp.o: res_comp.c /usr/include/sys/types.h /usr/include/stdio.h X res_comp.o: /usr/include/arpa/nameser.h X res_debug.o: res_debug.c /usr/include/sys/types.h /usr/include/netinet/in.h X! res_debug.o: /usr/include/stdio.h /usr/include/arpa/nameser.h X res_init.o: res_init.c /usr/include/sys/types.h /usr/include/sys/socket.h X! res_init.o: /usr/include/netinet/in.h /usr/include/stdio.h X res_init.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X res_mkquery.o: res_mkquery.c /usr/include/stdio.h /usr/include/sys/types.h X! res_mkquery.o: /usr/include/netinet/in.h /usr/include/arpa/nameser.h X! res_mkquery.o: /usr/include/resolv.h X res_query.o: res_query.c /usr/include/sys/param.h /usr/include/sys/localopts.h X! res_query.o: /usr/include/machine/machparam.h /usr/include/sys/types.h X! res_query.o: /usr/include/signal.h /usr/include/sys/types.h X! res_query.o: /usr/include/sys/socket.h /usr/include/netinet/in.h X! res_query.o: /usr/include/ctype.h /usr/include/netdb.h /usr/include/stdio.h X! res_query.o: /usr/include/errno.h /usr/include/strings.h X! res_query.o: /usr/include/arpa/inet.h /usr/include/arpa/nameser.h X! res_query.o: /usr/include/resolv.h X res_send.o: res_send.c /usr/include/sys/param.h /usr/include/sys/localopts.h X! res_send.o: /usr/include/machine/machparam.h /usr/include/sys/types.h X! res_send.o: /usr/include/signal.h /usr/include/sys/types.h X! res_send.o: /usr/include/sys/time.h /usr/include/time.h X! res_send.o: /usr/include/sys/socket.h /usr/include/sys/uio.h X! res_send.o: /usr/include/netinet/in.h /usr/include/stdio.h /usr/include/errno.h X res_send.o: /usr/include/arpa/nameser.h /usr/include/resolv.h X rexec.o: rexec.c /usr/include/sys/types.h /usr/include/sys/socket.h X! rexec.o: /usr/include/netinet/in.h /usr/include/stdio.h /usr/include/netdb.h X! rexec.o: /usr/include/errno.h X ruserpass.o: ruserpass.c /usr/include/stdio.h /usr/include/utmp.h X ruserpass.o: /usr/include/ctype.h /usr/include/sys/types.h X ruserpass.o: /usr/include/sys/stat.h /usr/include/errno.h X*** /usr/src/lib/libc/pdp/gen/Makefile.old Sun Jul 3 21:55:04 1988 X--- /usr/src/lib/libc/pdp/gen/Makefile Mon Jan 10 21:59:57 1994 X*************** X*** 3,18 **** X # All rights reserved. The Berkeley software License Agreement X # specifies the terms and conditions for redistribution. X # X! # @(#)Makefile 5.6 (Berkeley) 1/25/87 X # X SRCS= _setjmp.s abs.s alloca.s atof.c bcmp.s bcopy.s bzero.s disktab.c \ X ecvt.c fabs.s ffs.s frexp.s index.s insque.s ldexp.s ldfps.s \ X! modf.s remque.s rindex.s rollback.s setjmp.s setjmperr.c strcat.s \ X! strcmp.s strcpy.s strlen.s strncat.s strncmp.s strncpy.s X OBJS= _setjmp.o abs.o alloca.o atof.o bcmp.o bcopy.o bzero.o disktab.o \ X ecvt.o fabs.o ffs.o frexp.o index.o insque.o ldexp.o ldfps.o \ X! modf.o remque.o rindex.o rollback.o setjmp.o setjmperr.o strcat.o \ X! strcmp.o strcpy.o strlen.o strncat.o strncmp.o strncpy.o X CFLAGS= -O ${DEFS} X TAGSFILE=tags X X--- 3,18 ---- X # All rights reserved. The Berkeley software License Agreement X # specifies the terms and conditions for redistribution. X # X! # @(#)Makefile 5.6.1 (2.11BSD GTE) 10/31/93 X # X SRCS= _setjmp.s abs.s alloca.s atof.c bcmp.s bcopy.s bzero.s disktab.c \ X ecvt.c fabs.s ffs.s frexp.s index.s insque.s ldexp.s ldfps.s \ X! modf.s nsym.c remque.s rindex.s rollback.s setjmp.s setjmperr.c \ X! strcat.s strcmp.s strcpy.s strlen.s strncat.s strncmp.s strncpy.s X OBJS= _setjmp.o abs.o alloca.o atof.o bcmp.o bcopy.o bzero.o disktab.o \ X ecvt.o fabs.o ffs.o frexp.o index.o insque.o ldexp.o ldfps.o \ X! modf.o nsym.o remque.o rindex.o rollback.o setjmp.o setjmperr.o \ X! strcat.o strcmp.o strcpy.o strlen.o strncat.o strncmp.o strncpy.o X CFLAGS= -O ${DEFS} X TAGSFILE=tags X X*************** X*** 87,92 **** X--- 87,93 ---- X insque.o: insque.s ./DEFS.h X ldexp.o: ldexp.s ./DEFS.h X modf.o: modf.s ./DEFS.h X+ nsym.o: nsym.c /usr/include/a.out.h X remque.o: remque.s ./DEFS.h X rindex.o: rindex.s ./DEFS.h X rollback.o: rollback.s X*** /usr/src/lib/libc/pdp/gen/rollback.s.old Sun Jan 25 05:03:31 1987 X--- /usr/src/lib/libc/pdp/gen/rollback.s Sat Jan 1 21:21:50 1994 X*************** X*** 4,13 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef LIBC_SCCS X! <@(#)rollback.s 1.3 (Berkeley) 1/6/87\0> X .even X! #endif LIBC_SCCS X X /* X * rollback(fp::r0) X--- 4,13 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(LIBC_SCCS) && !defined(lint) X! <@(#)rollback.s 1.4 (2.11BSD GTE) 1/1/94\0> X .even X! #endif X X /* X * rollback(fp::r0) X*************** X*** 28,36 **** X * X * Caveat: Don't use register variables in routines using setjmp's! X */ X- iot = 4 X X! .globl __ljerr / just in case we roll off the end ... X .globl rollback X rollback: X cmp r5,r0 / if (we're longjmp'ing to ourselves) X--- 28,35 ---- X * X * Caveat: Don't use register variables in routines using setjmp's! X */ X X! .globl _longjmperror / just in case we roll off the end ... X .globl rollback X rollback: X cmp r5,r0 / if (we're longjmp'ing to ourselves) X*************** X*** 40,46 **** X beq 2f / goto 2f; X mov (r5),r5 / while ((r5 = r5->next_frame) != 0) X bne 1b X! jsr pc,__ljerr / call longjmperror X iot / and die if we return X 2: X mov r5,r2 / r2 = immediately nested frame X--- 39,45 ---- X beq 2f / goto 2f; X mov (r5),r5 / while ((r5 = r5->next_frame) != 0) X bne 1b X! jsr pc,_longjmperror / call longjmperror X iot / and die if we return X 2: X mov r5,r2 / r2 = immediately nested frame X*** /usr/src/lib/libc/pdp/gen/setjmp.s.old Sun Jan 25 05:03:32 1987 X--- /usr/src/lib/libc/pdp/gen/setjmp.s Sat Jan 1 21:22:50 1994 X*************** X*** 4,13 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef LIBC_SCCS X! <@(#)setjmp.s 1.3 (Berkeley) 1/6/87\0> X .even X! #endif LIBC_SCCS X X /* X * val = setjmp(env) X--- 4,13 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(LIBC_SCCS) && !defined(lint) X! <@(#)setjmp.s 1.4 (2.11BSD GTE) 1/1/94\0> X .even X! #endif X X /* X * val = setjmp(env) X*************** X*** 59,67 **** X X SC_FP = 8. / offset of sc_fp in sigcontext X SC_R0 = 12. / offset of sc_r0 in sigcontext X- iot = 4 X X! .globl rollback, _sigreturn, __ljerr X ENTRY(longjmp) X mov 2(sp),r1 / r1 = env X mov SC_FP(r1),r0 / r0 = env->sc_fp X--- 59,66 ---- X X SC_FP = 8. / offset of sc_fp in sigcontext X SC_R0 = 12. / offset of sc_r0 in sigcontext X X! .globl rollback, _sigreturn, _longjmperror X ENTRY(longjmp) X mov 2(sp),r1 / r1 = env X mov SC_FP(r1),r0 / r0 = env->sc_fp X*************** X*** 73,77 **** X mov r0,SC_R0(r1) / env->sc_r0 = r0 (`return' val) X mov 2(sp),-(sp) / push env X jsr pc,_sigreturn / perform sigreturn(env) X! jsr pc,__ljerr / if sigreturn returns, it's an error X iot / and die if longjmperror returns X--- 72,76 ---- X mov r0,SC_R0(r1) / env->sc_r0 = r0 (`return' val) X mov 2(sp),-(sp) / push env X jsr pc,_sigreturn / perform sigreturn(env) X! jsr pc,_longjmperror / if sigreturn returns, it's an error X iot / and die if longjmperror returns X*** /usr/src/lib/libc/pdp/csu/mcount.s.old Sat May 9 12:31:25 1987 X--- /usr/src/lib/libc/pdp/csu/mcount.s Fri Jan 21 23:02:26 1994 X*************** X*** 53,65 **** X #include "../sys/SYS.h" X #undef PROF X X! /* X! * Unforgivably brain damaged assembler won't recognize names properly ... X! */ X! #define _countbase _countba X! #define _countend _counten X! X! .text X ASENTRY(mcount) X tst _countbase / buffer set up yet? X beq 2f / nope, just exit X--- 53,59 ---- X #include "../sys/SYS.h" X #undef PROF X X! .text X ASENTRY(mcount) X tst _countbase / buffer set up yet? X beq 2f / nope, just exit X*** /usr/src/lib/libc/pdp/sys/gethostname.s.old Thu Jan 29 05:52:17 1987 X--- /usr/src/lib/libc/pdp/sys/gethostname.s Sun Jan 2 00:59:53 1994 X*************** X*** 4,14 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef SYSLIBC_SCCS X! _sccsid: <@(#)gethostname.s 2.5 (Berkeley) 1/29/87\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(gethname,gethostname,norm) X--- 4,14 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(SYSLIBC_SCCS) && !defined(lint) X! _sccsid: <@(#)gethostname.s 2.6 (2.11BSD GTE) 1/2/94\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(gethostname,gethostname,norm) X*** /usr/src/lib/libc/pdp/sys/getsockname.s.old Thu Jan 29 05:52:21 1987 X--- /usr/src/lib/libc/pdp/sys/getsockname.s Sun Jan 2 01:03:32 1994 X*************** X*** 4,14 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef SYSLIBC_SCCS X! _sccsid: <@(#)getsockname.s 2.5 (Berkeley) 1/29/87\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(getsname,getsockname,norm) X--- 4,14 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(SYSLIBC_SCCS) && !defined(lint) X! _sccsid: <@(#)getsockname.s 2.6 (2.11BSD GTE) 1/2/94\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(getsockname,getsockname,norm) X*** /usr/src/lib/libc/pdp/sys/gethostid.s.old Thu Jan 29 05:52:16 1987 X--- /usr/src/lib/libc/pdp/sys/gethostid.s Sun Jan 2 01:04:43 1994 X*************** X*** 4,14 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef SYSLIBC_SCCS X! _sccsid: <@(#)gethostid.s 2.5 (Berkeley) 1/29/87\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(gethstid,gethostid,noerror) X--- 4,14 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(SYSLIBC_SCCS) && !defined(lint) X! _sccsid: <@(#)gethostid.s 2.6 (2.11BSD GTE) 1/2/94\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(gethostid,gethostid,noerror) X*** /usr/src/lib/libc/pdp/sys/sethostid.s.old Thu Jan 29 05:52:35 1987 X--- /usr/src/lib/libc/pdp/sys/sethostid.s Sun Jan 2 14:33:44 1994 X*************** X*** 4,14 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef SYSLIBC_SCCS X! _sccsid: <@(#)sethostid.s 2.5 (Berkeley) 1/29/87\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(sethstid,sethostid,norm) X--- 4,14 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(SYSLIBC_SCCS) && !defined(lint) X! _sccsid: <@(#)sethostid.s 2.6 (2.11BSD GTE) 1/2/94\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(sethostid,sethostid,norm) X*** /usr/src/lib/libc/pdp/sys/sethostname.s.old Thu Jan 29 05:52:36 1987 X--- /usr/src/lib/libc/pdp/sys/sethostname.s Sun Jan 2 14:35:16 1994 X*************** X*** 4,14 **** X * specifies the terms and conditions for redistribution. X */ X X! #ifdef SYSLIBC_SCCS X! _sccsid: <@(#)sethostname.s 2.5 (Berkeley) 1/29/87\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(sethname,sethostname,norm) X--- 4,14 ---- X * specifies the terms and conditions for redistribution. X */ X X! #if defined(SYSLIBC_SCCS) && !defined(lint) X! _sccsid: <@(#)sethostname.s 2.6 (2.11BSD GTE) 1/2/94\0> X .even X #endif SYSLIBC_SCCS X X #include "SYS.h" X X! PSEUDO(sethostname,sethostname,norm) X*** /usr/src/lib/libc/stdio/getw.c.old Sun Jan 18 17:13:02 1987 X--- /usr/src/lib/libc/stdio/getw.c Mon Jan 10 22:00:18 1994 X*************** X*** 1,6 **** X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)getw.c 5.2 (Berkeley) 3/9/86"; X! #endif LIBC_SCCS and not lint X X #include X X--- 1,6 ---- X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)getw.c 5.2.1 (2.11BSD GTE) 1/1/94"; X! #endif X X #include X X*************** X*** 19,25 **** X return(w); X } X X! #ifdef BSD2_10 X long X getlw(iop) X register FILE *iop; X--- 19,25 ---- X return(w); X } X X! #ifdef pdp11 X long X getlw(iop) X register FILE *iop; X*************** X*** 35,38 **** X return(EOF); X return(w); X } X! #endif BSD2_10 X--- 35,38 ---- X return(EOF); X return(w); X } X! #endif X*** /usr/src/lib/libc/stdio/putw.c.old Sun Jan 18 17:13:44 1987 X--- /usr/src/lib/libc/stdio/putw.c Mon Jan 10 22:00:32 1994 X*************** X*** 1,6 **** X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)putw.c 5.2 (Berkeley) 3/9/86"; X! #endif LIBC_SCCS and not lint X X #include X X--- 1,6 ---- X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)putw.c 5.2.1 (2.11BSD GTE) 1/1/94"; X! #endif X X #include X X*************** X*** 16,22 **** X return(ferror(iop)); X } X X! #ifdef BSD2_10 X putlw(w, iop) X long w; X register FILE *iop; X--- 16,22 ---- X return(ferror(iop)); X } X X! #ifdef pdp11 X putlw(w, iop) X long w; X register FILE *iop; X*************** X*** 29,32 **** X putc(*p++, iop); X return(ferror(iop)); X } X! #endif BSD2_10 X--- 29,32 ---- X putc(*p++, iop); X return(ferror(iop)); X } X! #endif X*** /usr/src/lib/libc/inet/inet_addr.c.old Mon Dec 26 14:29:06 1988 X--- /usr/src/lib/libc/inet/inet_addr.c Mon Jan 10 22:14:12 1994 X*************** X*** 5,12 **** X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)inet_addr.c 5.2 (Berkeley) 3/9/86"; X! #endif LIBC_SCCS and not lint X X #include X #include X--- 5,12 ---- X */ X X #if defined(LIBC_SCCS) && !defined(lint) X! static char sccsid[] = "@(#)inet_addr.c 5.2.1 (2.11BSD GTE) 1/1/94"; X! #endif X X #include X #include X*************** X*** 23,34 **** X inet_addr(cp) X register char *cp; X { X- #ifdef BSD2_10 X register u_long val, base; X register u_int n; /* can't switch on longs - should be an int anyway */ X- #else !BSD2_10 X- register u_long val, base, n; X- #endif BSD2_10 X register char c; X u_long parts[4], *pp = parts; X X--- 23,30 ---- SHAR_EOF chmod 640 'patchfile' fi if test -f 'new.sources' then echo shar: "will not over-write existing file 'new.sources'" else sed 's/^X//' << \SHAR_EOF > 'new.sources' X#! /bin/sh X# This is a shell archive, meaning: X# 1. Remove everything above the #! /bin/sh line. X# 2. Save the resulting text in a file. X# 3. Execute the file with /bin/sh (not csh) to create: X# /usr/src/lib/libc/gen/nlist.c X# /usr/src/lib/libc/pdp/gen/nsym.c X# This archive created: Fri Jan 28 21:22:57 1994 Xexport PATH; PATH=/bin:/usr/bin:$PATH Xif test -f '/usr/src/lib/libc/gen/nlist.c' Xthen X echo shar: "will not over-write existing file '/usr/src/lib/libc/gen/nlist.c'" Xelse Xsed 's/^X//' << \SHAR_EOF > '/usr/src/lib/libc/gen/nlist.c' XX/* XX * Copyright (c) 1989 The Regents of the University of California. XX * All rights reserved. XX * XX * Redistribution and use in source and binary forms are permitted XX * provided that: (1) source distributions retain this entire copyright XX * notice and comment, and (2) distributions including binaries display XX * the following acknowledgement: ``This product includes software XX * developed by the University of California, Berkeley and its contributors'' XX * in the documentation or other materials provided with the distribution XX * and in all advertising materials mentioning features or use of this XX * software. Neither the name of the University nor the names of its XX * contributors may be used to endorse or promote products derived XX * from this software without specific prior written permission. XX * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR XX * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED XX * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. XX */ XX XX#if defined(LIBC_SCCS) && !defined(lint) XXstatic char sccsid[] = "@(#)nlist.c 5.7.1 (2.11BSD GTE) 12/31/93"; XX#endif XX XX#include XX#include XX#include XX#include XX XXtypedef struct nlist NLIST; XX#define _strx n_un.n_strx XX#define _name n_un.n_name XX#define ISVALID(p) (p->_name && p->_name[0]) XX XXnlist(name, list) XX char *name; XX NLIST *list; XX{ XX register NLIST *p, *s; XX struct xexec ebuf; XX FILE *fstr, *fsym; XX NLIST nbuf; XX off_t strings_offset, symbol_offset, symbol_size, lseek(); XX int entries, len, maxlen; XX char sbuf[128]; XX XX entries = -1; XX XX if (!(fsym = fopen(name, "r"))) XX return(-1); XX if (fread((char *)&ebuf, 1, sizeof(ebuf), fsym) < sizeof (ebuf.e) || XX N_BADMAG(ebuf.e)) XX goto done1; XX XX symbol_offset = N_SYMOFF(ebuf); XX symbol_size = ebuf.e.a_syms; XX strings_offset = N_STROFF(ebuf); XX if (fseek(fsym, symbol_offset, L_SET)) XX goto done1; XX XX if (!(fstr = fopen(name, "r"))) XX goto done1; XX XX /* XX * clean out any left-over information for all valid entries. XX * Type and value defined to be 0 if not found; historical XX * versions cleared other and desc as well. Also figure out XX * the largest string length so don't read any more of the XX * string table than we have to. XX */ XX for (p = list, entries = maxlen = 0; ISVALID(p); ++p, ++entries) { XX p->n_type = 0; XX p->n_ovly = 0; XX p->n_value = 0; XX if ((len = strlen(p->_name)) > maxlen) XX maxlen = len; XX } XX if (++maxlen > sizeof(sbuf)) { /* for the NULL */ XX (void)fprintf(stderr, "nlist: sym 2 big\n"); XX entries = -1; XX goto done2; XX } XX XX for (s = &nbuf; symbol_size; symbol_size -= sizeof(NLIST)) { XX if (fread((char *)s, sizeof(NLIST), 1, fsym) != 1) XX goto done2; XX if (!s->_strx) XX continue; XX if (fseek(fstr, strings_offset + s->_strx, L_SET)) XX goto done2; XX (void)fread(sbuf, sizeof(sbuf[0]), maxlen, fstr); XX for (p = list; ISVALID(p); p++) XX if (!strcmp(p->_name, sbuf)) { XX p->n_value = s->n_value; XX p->n_type = s->n_type; XX p->n_ovly = s->n_ovly; XX if (!--entries) XX goto done2; XX } XX } XXdone2: (void)fclose(fstr); XXdone1: (void)fclose(fsym); XX return(entries); XX} XSHAR_EOF Xchmod 444 '/usr/src/lib/libc/gen/nlist.c' Xfi Xif test -f '/usr/src/lib/libc/pdp/gen/nsym.c' Xthen X echo shar: "will not over-write existing file '/usr/src/lib/libc/pdp/gen/nsym.c'" Xelse Xsed 's/^X//' << \SHAR_EOF > '/usr/src/lib/libc/pdp/gen/nsym.c' XX XX/* XX * Program Name: nsym.c XX * Author: S.M. Schultz XX * XX * ----------- Modification History ------------ XX * Version Date Reason For Modification XX * 1.0 31Oct93 1. Initial release into the public domain. XX * Calculating the offsets of the string XX * and symbol tables in an executable is XX * rather messy and verbose when dealing XX * with overlaid objects. The macros (in XX * a.out.h) N_STROFF, N_SYMOFF, etc simply XX * call these routines. XX * -------------------------------------------------- XX*/ XX XX#include XX XXoff_t XXn_stroff(ep) XX register struct xexec *ep; XX { XX off_t l; XX XX l = n_symoff(ep); XX l += ep->e.a_syms; XX return(l); XX } XX XXoff_t XXn_datoff(ep) XX register struct xexec *ep; XX { XX off_t l; XX XX l = n_treloc(ep); XX l -= ep->e.a_data; XX return(l); XX } XX XX/* XX * Obviously if bit 0 of the flags word (a_flag) is not off then there's XX * no relocation information present and this routine shouldn't have been XX * called. XX*/ XX XXoff_t XXn_dreloc(ep) XX register struct xexec *ep; XX { XX off_t l; XX register u_short *ov = ep->o.ov_siz; XX register int i; XX XX l = (off_t)sizeof (struct exec) + ep->e.a_text + ep->e.a_data; XX if (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6) XX { XX for (i = 0; i < NOVL; i++) XX l += *ov++; XX l += sizeof (struct ovlhdr); XX } XX l += ep->e.a_text; XX return(l); XX } XX XXoff_t XXn_treloc(ep) XX register struct xexec *ep; XX { XX off_t l; XX XX l = n_dreloc(ep); XX l -= ep->e.a_text; XX return(l); XX } XX XXoff_t XXn_symoff(ep) XX register struct xexec *ep; XX { XX register int i; XX register u_short *ov; XX off_t sum, l; XX XX l = (off_t) N_TXTOFF(ep->e); XX sum = (off_t)ep->e.a_text + ep->e.a_data; XX if (ep->e.a_magic == A_MAGIC5 || ep->e.a_magic == A_MAGIC6) XX { XX for (ov = ep->o.ov_siz, i = 0; i < NOVL; i++) XX sum += *ov++; XX } XX l += sum; XX if ((ep->e.a_flag & 1) == 0) /* relocation present? */ XX l += sum; XX return(l); XX } XSHAR_EOF Xchmod 644 '/usr/src/lib/libc/pdp/gen/nsym.c' Xfi Xexit 0 X# End of shell archive SHAR_EOF chmod 640 'new.sources' fi exit 0 # End of shell archive