Shcc Patch #1
John R. MacMillan
jrmacmillan at lily.waterloo.edu
Tue Nov 8 14:57:07 AEST 1988
A bug fix and an "enhancement".
The bug fix is to make the -h option work as documented. Remind me
never to change option letters at the last moment again.
The enhancement is a warning if you try to use -n or -N and the shared
libraries. Before, it quietly made an object with the correct magic
number which used shared libs and dumped core as soon as you ran it
(thanks to Gary S. Trujillo <gnosys!gst at WJH12.HARVARD.EDU> for
finding this). Now it warns you, honours the -[nN], and doesn't use
shared libraries.
Feed me to patch(1)
*** OLD/shcc.c Mon Nov 7 23:13:19 1988
--- shcc.c Mon Nov 7 22:57:08 1988
***************
*** 6,11
*
* Modification History:
*
* Release 1.1 88/10/20
* Initial release
*/
--- 6,15 -----
*
* Modification History:
*
+ * Release 1.1.1.1 88/11/07
+ * Change warning associated with -p and shared libs, add warnings
+ * for -n and -N with shared libs
+ *
* Release 1.1 88/10/20
* Initial release
*/
***************
*** 11,17
*/
#ifndef lint
! static char *SCCS = "@(#)shcc.c 1.1 88/10/20";
#endif
#include "shcc.h"
--- 15,21 -----
*/
#ifndef lint
! static char *SCCS = "@(#)shcc.c 1.1.1.1 88/11/07";
#endif
#include "shcc.h"
***************
*** 114,119
int cpu, fpu;
int exitstatus = 0;
char *name;
--- 118,125 -----
int cpu, fpu;
+ char ldmagic = MAGIC0413;
+
int exitstatus = 0;
char *name;
***************
*** 123,128
char **argv;
{
char **filep;
char *suffix();
void fatal();
extern char **AddArg();
--- 129,135 -----
char **argv;
{
char **filep;
+ int ldwarning = 0;
char *suffix();
void fatal();
extern char **AddArg();
***************
*** 174,187
(void) putenv( "CENVIRON=CPU=68010" );
/*
- * And a silly error check of my own...
- */
-
- if( profile && quick )
- warn( "%s: Warning, profiled programs cannot use shared library\n", name );
-
-
- /*
* Set up for the preliminary passes, and do them on each input
* file
*/
--- 181,186 -----
(void) putenv( "CENVIRON=CPU=68010" );
/*
* Set up for the preliminary passes, and do them on each input
* file
*/
***************
*** 199,205
* If we're still kicking, let's load the sucker
*/
! if( passes & LOAD )
DoLoad();
CleanUp();
--- 198,220 -----
* If we're still kicking, let's load the sucker
*/
! if( passes & LOAD ) {
! /*
! * Warn about things that conflict with shared libs
! */
! if( profile && !noshlib ) {
! warn( "%s: warning: profiled programs will not use shared library\n", name );
! ldwarning++;
! }
! if((ldmagic == MAGIC0407||ldmagic == MAGIC0410) && !noshlib) {
! warn( "%s: warning: programs linked with -%c will not use the shared library\n", name, ldmagic );
! ldwarning++;
! }
! if( ldwarning ) {
! noshlib++;
! quick = 0;
! }
!
DoLoad();
}
***************
*** 201,206
if( passes & LOAD )
DoLoad();
CleanUp();
--- 216,222 -----
}
DoLoad();
+ }
CleanUp();
*** OLD/shcc.h Mon Nov 7 23:13:21 1988
--- shcc.h Mon Nov 7 22:57:08 1988
***************
*** 3,8
*
* Modification History:
*
* Release 1.1 88/10/20
* Initial release
*/
--- 3,12 -----
*
* Modification History:
*
+ * Release 1.1.1.1 88/11/07
+ * Change warning associated with -p and shared libs, add warnings
+ * for -n and -N with shared libs
+ *
* Release 1.1 88/10/20
* Initial release
*/
***************
*** 128,133
*/
extern int cpu, fpu;
extern int exitstatus;
--- 132,144 -----
*/
extern int cpu, fpu;
+
+ #define MAGIC0407 'N'
+ #define MAGIC0410 'n'
+ #define MAGIC0413 'z'
+ #define MAGIC0413F 'F'
+
+ extern char ldmagic;
extern int exitstatus;
*** OLD/options.c Mon Nov 7 23:13:22 1988
--- options.c Mon Nov 7 23:10:27 1988
***************
*** 3,8
*
* Modification History:
*
* Release 1.1 88/10/20
* Initial release
*/
--- 3,16 -----
*
* Modification History:
*
+ *
+ * Release 1.1.1.2 88/11/07
+ * Fix handling of -h, make sure -j and -q are exclusive
+ *
+ * Release 1.1.1.1 88/11/07
+ * Change warning associated with -p and shared libs, add warnings
+ * for -n and -N with shared libs
+ *
* Release 1.1 88/10/20
* Initial release
*/
***************
*** 8,14
*/
#ifndef lint
! static char *SCCS = "@(#)options.c 1.1 88/10/20";
#endif
#include "shcc.h"
--- 16,22 -----
*/
#ifndef lint
! static char *SCCS = "@(#)options.c 1.1.1.2 88/11/07";
#endif
#include "shcc.h"
***************
*** 40,45
switch( opt ) {
case 'j':
noshlib++;
break;
case 'q':
quick++;
--- 48,54 -----
switch( opt ) {
case 'j':
noshlib++;
+ quick = 0;
break;
case 'q':
quick++;
***************
*** 43,48
break;
case 'q':
quick++;
break;
case 'v':
verbose++;
--- 52,58 -----
break;
case 'q':
quick++;
+ noshlib = 0;
break;
case 'v':
verbose++;
***************
*** 49,55
break;
case 'p':
profile++;
- noshlib++;
ldinargv = AddArg( "-L/lib/libp", ldinargv,
&ldinargc, &ldinmax );
break;
--- 59,64 -----
break;
case 'p':
profile++;
ldinargv = AddArg( "-L/lib/libp", ldinargv,
&ldinargc, &ldinmax );
break;
***************
*** 121,127
case 'K':
Kflag++;
break;
! case 'i':
givenifile++;
ifile = optarg;
break;
--- 130,136 -----
case 'K':
Kflag++;
break;
! case 'h':
givenifile++;
ifile = optarg;
break;
***************
*** 300,305
} else if( strchr( LDOUTARGS, *ch ) ) {
ldoutargv = AddArg( arg, ldoutargv, &ldoutargc,
&ldoutmax );
} else if( strchr( LDINARGS, *ch ) ) {
ldinargv = AddArg( arg, ldinargv, &ldinargc,
&ldinmax );
--- 309,317 -----
} else if( strchr( LDOUTARGS, *ch ) ) {
ldoutargv = AddArg( arg, ldoutargv, &ldoutargc,
&ldoutmax );
+ if( *ch == MAGIC0407 || *ch == MAGIC0410 || *ch == MAGIC0413
+ || *ch == MAGIC0413F )
+ ldmagic = *ch;
} else if( strchr( LDINARGS, *ch ) ) {
ldinargv = AddArg( arg, ldinargv, &ldinargc,
&ldinmax );
*** OLD/shcc.man Mon Nov 7 23:23:33 1988
--- shcc.man Mon Nov 7 23:30:31 1988
***************
*** 1,5
."
! ." shcc.man 88/10/20
."
.if \*(Nu .ds Nu "SHCC
.if \*(Nm .ds Nm "Shcc
--- 1,5 -----
."
! ." shcc.man 88/11/07
."
.if \*(Nu .ds Nu "SHCC
.if \*(Nm .ds Nm "Shcc
***************
*** 132,139
.I \*(Nl
does not expect this argument.
.PP
! Profiled objects cannot use the shared library. Specifying both
! .BR \-p " and " \-q
will cause a warning.
.PP
Typical use of the
--- 132,139 -----
.I \*(Nl
does not expect this argument.
.PP
! Profiled objects cannot use the shared library. Specifying
! .BR \-p " without " \-j
will cause a warning.
.PP
Objects linked with
***************
*** 135,140
Profiled objects cannot use the shared library. Specifying both
.BR \-p " and " \-q
will cause a warning.
.PP
Typical use of the
.B \-h
--- 135,150 -----
Profiled objects cannot use the shared library. Specifying
.BR \-p " without " \-j
will cause a warning.
+ .PP
+ Objects linked with
+ .BR \-n " or " \-N
+ cannot use the shared library. Specifying
+ .BR \-n " or " \-N " without " \-j
+ will cause a warning. The
+ .B \-F
+ option does not cause a warning because
+ .IR ld (1)
+ will blow up on its own.
.PP
Typical use of the
.B \-h
--
John R. MacMillan Space. The final frontier.
jrmacmillan at lily.waterloo.edu Also a cool place to hang out
...!watmath!lily!jrmacmillan for the evening.
More information about the Unix-pc.sources
mailing list