Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* DEC/OSF1 assembler dies if fd=0 is closed
@ 1995-04-11  4:00 chris mcdonald
  1995-04-12  4:00 ` life is easier if you use existing tools (was Re: DEC/OSF1 assembler dies if fd=0 is closed) Mark Bartelt
  0 siblings, 1 reply; 2+ messages in thread
From: chris mcdonald @ 1995-04-11  4:00 UTC (permalink / raw)


I'm afraid that I don't read this newsgroup very often, so this may be well
known.

When using gcc (2.6.*) on our DEC Alpha OSF1v2, I've found that if file
descriptor 0 has been closed before the assembler is (eventually) invoked,
the assembler will choke with a useless error such as:

    as1: Error: , line 0: Obsolete or corrupt binasm file: /tmp/ctmaaagAoa

As this only occurs when using gcc (and not DEC's cc) I suspect it has
something to do with gcc's default use of the -pipe switch under OSF.

I only discovered this (eventually) because gcc was being invoked from a
daemon which had fd=0,1,2 all closed. The problem did not occur on our Suns.

The program below demonstrates the problem - if invoked with any arguments
the assembler will fail.

_______________________________________________________________________________
                       Chris McDonald     EMAIL:  chris@cs.uwa.edu.au
       Department of Computer Science       WWW:  http://www.cs.uwa.edu.au/
  The University of Western Australia     PHONE:  ((+61) 09) 380 2533
     Crawley, Western Australia, 6907       FAX:  ((+61) 09) 380 1089



#include <stdio.h>
#include <stdlib.h>

#define	CC_PATH		"/bin/cc"
#define	GCC_PATH	"/usr/gnu/bin/gcc"

int main(argc, argv) int argc; char **argv;
{
    extern char		*strrchr();

    char		*argv0;
    char		*args[8];
    int			ac, pid, status;

    argv0 = (argv0 = strrchr(argv[0],'/')) ? argv0+1 : argv[0];
    argc--; argv++;

    ac		= 0;
    args[ac++]	= "gcc";

    switch (pid = (int)fork()) {
    case -1 :
	(void)fprintf(stderr,"%s: cannot fork\n",argv0);
	status = 1;
	break;
    case 0 :
	args[ac++]	= "-c";
	args[ac++]	= "-o";
	args[ac++]	= "try.o";
	args[ac++]	= "try.c";
	args[ac++]	= (char *)NULL;

	{
	    char	**av		= args;

	    while(*av)
		(void)fprintf(stderr,"%s ", *av++);
	    (void)fputc('\n',stderr);
	}

	if(argc > 0)
	    (void)close(0);

	(void)execv(GCC_PATH, args);
	exit(1);
        break;

    default :
	while(wait(&status) != pid)	/* wait for child to exit */
	    ;
	status = (status >> 8)&0177;
	break;
    }

    (void)fprintf(stderr,"%s exit(%d)\n", args[0], status);
    return(status);
    exit(status);
}



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-04-12  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-04-11  4:00 DEC/OSF1 assembler dies if fd=0 is closed chris mcdonald
1995-04-12  4:00 ` life is easier if you use existing tools (was Re: DEC/OSF1 assembler dies if fd=0 is closed) Mark Bartelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox