flagstr("r", "dir1:dir2:...: set ELF dynamic linker search path", &rpath);
flagcount("race", "enable race detector", &flag_race);
flagcount("s", "disable symbol table", &debug['s']);
+ flagstr("tmpdir", "leave temporary files in this directory", &tmpdir);
flagcount("u", "reject unsafe packages", &debug['u']);
flagcount("v", "print link trace", &debug['v']);
flagcount("w", "disable DWARF generation", &debug['w']);
flagstr("r", "dir1:dir2:...: set ELF dynamic linker search path", &rpath);
flagcount("race", "enable race detector", &flag_race);
flagcount("s", "disable symbol table", &debug['s']);
+ flagcount("shared", "generate shared object", &flag_shared);
+ flagstr("tmpdir", "leave temporary files in this directory", &tmpdir);
flagcount("u", "reject unsafe packages", &debug['u']);
flagcount("v", "print link trace", &debug['v']);
flagcount("w", "disable DWARF generation", &debug['w']);
- flagcount("shared", "generate shared object", &flag_shared);
flagparse(&argc, &argv, usage);
flagcount("race", "enable race detector", &flag_race);
flagcount("s", "disable symbol table", &debug['s']);
flagcount("n", "dump symbol table", &debug['n']);
+ flagstr("tmpdir", "leave temporary files in this directory", &tmpdir);
flagcount("u", "reject unsafe packages", &debug['u']);
flagcount("v", "print link trace", &debug['v']);
flagcount("w", "disable DWARF generation", &debug['w']);
}
}
-static char *tmpdir;
-
static void
rmtemp(void)
{
return;
// create temporary directory and arrange cleanup
- // TODO: Add flag to specify tempdir, which is then not cleaned up.
- tmpdir = mktempdir();
- atexit(rmtemp);
-
+ if(tmpdir == nil) {
+ tmpdir = mktempdir();
+ atexit(rmtemp);
+ }
+
// change our output to temporary object file
close(cout);
p = smprint("%s/go.o", tmpdir);
EXTERN int flag_shared;
EXTERN char* tracksym;
EXTERN char* interpreter;
+EXTERN char* tmpdir;
enum
{
EXTERN Segment segtext;
EXTERN Segment segdata;
-EXTERN Segment segsym;
-EXTERN Segment segdwarf;
+EXTERN Segment segdwarf;
void addlib(char *src, char *obj);
void addlibpath(char *srcref, char *objref, char *file, char *pkg);