mirror of
https://github.com/golang/go
synced 2024-11-22 02:44:39 -07:00
search for runtime.a in the package path instead of hardcoding
the location. remove last remnants of broken -l flag. R=rsc CC=golang-dev https://golang.org/cl/201042
This commit is contained in:
parent
c2cb0d70d5
commit
2f1a321d4f
@ -104,7 +104,9 @@ main(int argc, char *argv[])
|
||||
ARGBEGIN {
|
||||
default:
|
||||
c = ARGC();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
if(c == 'l')
|
||||
usage();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
debug[c]++;
|
||||
break;
|
||||
case 'o':
|
||||
@ -136,7 +138,6 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'u': /* produce dynamically loadable module */
|
||||
dlm = 1;
|
||||
debug['l']++;
|
||||
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
|
||||
readundefs(ARGF(), SIMPORT);
|
||||
break;
|
||||
@ -259,9 +260,7 @@ main(int argc, char *argv[])
|
||||
lastp = firstp;
|
||||
|
||||
addlibpath("command line", "command line", argv[0], "main");
|
||||
|
||||
if(!debug['l'])
|
||||
loadlib();
|
||||
loadlib();
|
||||
|
||||
// mark some functions that are only referenced after linker code editing
|
||||
// TODO(kaib): this doesn't work, the prog can't be found in runtime
|
||||
|
@ -100,7 +100,9 @@ main(int argc, char *argv[])
|
||||
ARGBEGIN {
|
||||
default:
|
||||
c = ARGC();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
if(c == 'l')
|
||||
usage();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
debug[c]++;
|
||||
break;
|
||||
case 'o': /* output to (next arg) */
|
||||
@ -131,7 +133,6 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'u': /* produce dynamically loadable module */
|
||||
dlm = 1;
|
||||
debug['l']++;
|
||||
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
|
||||
readundefs(ARGF(), SIMPORT);
|
||||
break;
|
||||
@ -347,9 +348,7 @@ main(int argc, char *argv[])
|
||||
lastp = firstp;
|
||||
|
||||
addlibpath("command line", "command line", argv[0], "main");
|
||||
|
||||
if(!debug['l'])
|
||||
loadlib();
|
||||
loadlib();
|
||||
|
||||
deadcode();
|
||||
|
||||
|
@ -105,7 +105,9 @@ main(int argc, char *argv[])
|
||||
ARGBEGIN {
|
||||
default:
|
||||
c = ARGC();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
if(c == 'l')
|
||||
usage();
|
||||
if(c >= 0 && c < sizeof(debug))
|
||||
debug[c]++;
|
||||
break;
|
||||
case 'o': /* output to (next arg) */
|
||||
@ -137,7 +139,6 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'u': /* produce dynamically loadable module */
|
||||
dlm = 1;
|
||||
debug['l']++;
|
||||
if(argv[1] != nil && argv[1][0] != '-' && !isobjfile(argv[1]))
|
||||
readundefs(ARGF(), SIMPORT);
|
||||
break;
|
||||
@ -385,9 +386,7 @@ main(int argc, char *argv[])
|
||||
lastp = firstp;
|
||||
|
||||
addlibpath("command line", "command line", argv[0], "main");
|
||||
|
||||
if(!debug['l'])
|
||||
loadlib();
|
||||
loadlib();
|
||||
|
||||
deadcode();
|
||||
|
||||
|
@ -35,8 +35,8 @@
|
||||
int iconv(Fmt*);
|
||||
|
||||
char symname[] = SYMDEF;
|
||||
char* libdir[16] = { "." };
|
||||
int nlibdir = 1;
|
||||
char* libdir[16];
|
||||
int nlibdir = 0;
|
||||
int cout = -1;
|
||||
|
||||
char* goroot;
|
||||
@ -180,6 +180,11 @@ addlibpath(char *srcref, char *objref, char *file, char *pkg)
|
||||
for(i=0; i<libraryp; i++)
|
||||
if(strcmp(file, library[i].file) == 0)
|
||||
return;
|
||||
|
||||
if(debug['v'])
|
||||
Bprint(&bso, "%5.2f addlibpath: srcref: %s objref: %s file: %s pkg: %s\n",
|
||||
cputime(), srcref, objref, file, pkg);
|
||||
|
||||
if(libraryp == nlibrary){
|
||||
nlibrary = 50 + 2*libraryp;
|
||||
library = realloc(library, sizeof library[0] * nlibrary);
|
||||
@ -207,15 +212,24 @@ addlibpath(char *srcref, char *objref, char *file, char *pkg)
|
||||
void
|
||||
loadlib(void)
|
||||
{
|
||||
int i;
|
||||
char pname[1024];
|
||||
int i, found;
|
||||
int32 h;
|
||||
Sym *s;
|
||||
char *a;
|
||||
|
||||
i = strlen(goroot)+strlen(goarch)+strlen(goos)+20;
|
||||
a = mal(i);
|
||||
snprint(a, i, "%s/pkg/%s_%s/runtime.a", goroot, goos, goarch);
|
||||
addlibpath("internal", "internal", a, "runtime");
|
||||
found = 0;
|
||||
for(i=0; i<nlibdir; i++) {
|
||||
snprint(pname, sizeof pname, "%s/runtime.a", libdir[i]);
|
||||
if(debug['v'])
|
||||
Bprint(&bso, "searching for runtime.a in %s\n", pname);
|
||||
if(access(pname, AEXIST) >= 0) {
|
||||
addlibpath("internal", "internal", pname, "runtime");
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found) Bprint(&bso, "warning: unable to find runtime.a\n");
|
||||
|
||||
loop:
|
||||
xrefresolv = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user