mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
allow multiple -L options
R=rsc DELTA=31 (15 added, 3 deleted, 13 changed) OCL=35364 CL=35364
This commit is contained in:
parent
e8210824f6
commit
e6bc5bf5af
@ -296,7 +296,6 @@ EXTERN vlong INITDAT;
|
||||
EXTERN int32 INITRND;
|
||||
EXTERN vlong INITTEXT;
|
||||
EXTERN char* INITENTRY; /* entry point */
|
||||
EXTERN char* LIBDIR;
|
||||
EXTERN Biobuf bso;
|
||||
EXTERN int32 bsssize;
|
||||
EXTERN int cbc;
|
||||
|
@ -39,6 +39,8 @@ char symname[] = SYMDEF;
|
||||
char thechar = '6';
|
||||
char* thestring = "amd64";
|
||||
char* paramspace = "FP";
|
||||
char* libdir[16]; // contains "." first, goroot last
|
||||
int nlibdir = 0;
|
||||
|
||||
/*
|
||||
* -H2 -T4136 -R4096 is plan9 64-bit format
|
||||
@ -96,7 +98,7 @@ main(int argc, char *argv[])
|
||||
INITDAT = -1;
|
||||
INITRND = -1;
|
||||
INITENTRY = 0;
|
||||
LIBDIR = nil;
|
||||
libdir[nlibdir++] = "."; // look in dot first
|
||||
|
||||
ARGBEGIN {
|
||||
default:
|
||||
@ -114,7 +116,11 @@ main(int argc, char *argv[])
|
||||
HEADTYPE = atolwhex(EARGF(usage()));
|
||||
break;
|
||||
case 'L':
|
||||
LIBDIR = EARGF(usage());
|
||||
if(nlibdir >= nelem(libdir)-1) {
|
||||
print("too many -L's: %d\n", nlibdir);
|
||||
usage();
|
||||
}
|
||||
libdir[nlibdir++] = EARGF(usage());
|
||||
break;
|
||||
case 'T':
|
||||
INITTEXT = atolwhex(EARGF(usage()));
|
||||
@ -125,7 +131,6 @@ main(int argc, char *argv[])
|
||||
case 'R':
|
||||
INITRND = atolwhex(EARGF(usage()));
|
||||
break;
|
||||
break;
|
||||
case 'x': /* produce export table */
|
||||
doexp = 1;
|
||||
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
|
||||
@ -146,6 +151,9 @@ main(int argc, char *argv[])
|
||||
if(strcmp(goarch, thestring) != 0)
|
||||
print("goarch is not known: %s\n", goarch);
|
||||
|
||||
// put goroot in the libdir list.
|
||||
libdir[nlibdir++] = smprint("%s/pkg/%s_%s", goroot, goos, goarch);
|
||||
|
||||
if(HEADTYPE == -1) {
|
||||
HEADTYPE = 2;
|
||||
if(strcmp(goos, "linux") == 0)
|
||||
@ -699,11 +707,11 @@ addlib(char *src, char *obj)
|
||||
|
||||
if(search) {
|
||||
// try dot, -L "libdir", and then goroot.
|
||||
snprint(pname, sizeof pname, "./%s", name);
|
||||
if(access(pname, AEXIST) < 0 && LIBDIR != nil)
|
||||
snprint(pname, sizeof pname, "%s/%s", LIBDIR, name);
|
||||
if(access(pname, AEXIST) < 0)
|
||||
snprint(pname, sizeof pname, "%s/pkg/%s_%s/%s", goroot, goos, goarch, name);
|
||||
for(i=0; i<nlibdir; i++) {
|
||||
snprint(pname, sizeof pname, "%s/%s", libdir[i], name);
|
||||
if(access(pname, AEXIST) >= 0)
|
||||
break;
|
||||
}
|
||||
strcpy(name, pname);
|
||||
}
|
||||
cleanname(name);
|
||||
|
@ -259,7 +259,6 @@ EXTERN int32 INITDAT;
|
||||
EXTERN int32 INITRND;
|
||||
EXTERN int32 INITTEXT;
|
||||
EXTERN char* INITENTRY; /* entry point */
|
||||
EXTERN char* LIBDIR;
|
||||
EXTERN Biobuf bso;
|
||||
EXTERN int32 bsssize;
|
||||
EXTERN int32 casepc;
|
||||
|
@ -42,6 +42,8 @@ char *noname = "<none>";
|
||||
char symname[] = SYMDEF;
|
||||
char thechar = '8';
|
||||
char *thestring = "386";
|
||||
char* libdir[16]; // contains "." first, goroot last
|
||||
int nlibdir = 0;
|
||||
|
||||
/*
|
||||
* -H0 -T0x40004C -D0x10000000 is garbage unix
|
||||
@ -113,7 +115,11 @@ main(int argc, char *argv[])
|
||||
HEADTYPE = atolwhex(EARGF(usage()));
|
||||
break;
|
||||
case 'L':
|
||||
LIBDIR = EARGF(usage());
|
||||
if(nlibdir >= nelem(libdir)-1) {
|
||||
print("too many -L's: %d\n", nlibdir);
|
||||
usage();
|
||||
}
|
||||
libdir[nlibdir++] = EARGF(usage());
|
||||
break;
|
||||
case 'T':
|
||||
INITTEXT = atolwhex(EARGF(usage()));
|
||||
@ -693,11 +699,11 @@ addlib(char *src, char *obj)
|
||||
|
||||
if(search) {
|
||||
// try dot, -L "libdir", and then goroot.
|
||||
snprint(pname, sizeof pname, "./%s", name);
|
||||
if(access(pname, AEXIST) < 0 && LIBDIR != nil)
|
||||
snprint(pname, sizeof pname, "%s/%s", LIBDIR, name);
|
||||
if(access(pname, AEXIST) < 0)
|
||||
snprint(pname, sizeof pname, "%s/pkg/%s_%s/%s", goroot, goos, goarch, name);
|
||||
for(i=0; i<nlibdir; i++) {
|
||||
snprint(pname, sizeof pname, "%s/%s", libdir[i], name);
|
||||
if(access(pname, AEXIST) >= 0)
|
||||
break;
|
||||
}
|
||||
strcpy(name, pname);
|
||||
}
|
||||
cleanname(name);
|
||||
|
Loading…
Reference in New Issue
Block a user