From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200007081203.IAA00122@cse.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] cc and more From: "rob pike" Date: Sat, 8 Jul 2000 08:03:31 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: d6298c7a-eac8-11e9-9e20-41e7f4b1d025 Quinn is right; ape/cc and pcc have a nefarious bug. We never caught it because it is triggered by specifying libraries explicitly, which is almost never necessary in Plan 9 - our `autolib' #pragma figures out which libraries to use. But if you override that, for whatever reason, you can overwrite the wrong files. Quinn did ape/cc -v -o test -lc test.c which caused the output to be written to /$objtype/lib/ape/libc.a. (The -lc is unnecessary and in fact erroneous). Here are the patches: diff -n /n/dump/2000/0708/sys/src/cmd/pcc.c /sys/src/cmd/pcc.c /n/dump/2000/0708/sys/src/cmd/pcc.c:154 c pcc.c:154,157 < append(&cc, objs.strings[i]); --- > if(cflag) > append(&cc, oname); > else > append(&cc, changeext(srcs.strings[i], ot->o)); diff -n /n/dump/2000/0708/sys/src/cmd/pcc.c /sys/src/cmd/pcc.c /n/dump/2000/0708/sys/src/cmd/pcc.c:52 c /sys/src/cmd/pcc.c:52 < int i, cppn, ccn; --- > int i, cppn, ccn, oflag; /n/dump/2000/0708/sys/src/cmd/pcc.c:53 a /sys/src/cmd/pcc.c:54 > oflag = 0; /n/dump/2000/0708/sys/src/cmd/pcc.c:69 a /sys/src/cmd/pcc.c:71 > oflag = 1; /n/dump/2000/0708/sys/src/cmd/pcc.c:154 c /sys/src/cmd/pcc.c:156,159 < append(&cc, objs.strings[i]); --- > if(oflag && cflag) > append(&cc, oname); > else > append(&cc, changeext(srcs.strings[i], ot->o));