1
0
mirror of https://github.com/golang/go synced 2024-11-26 01:47:58 -07:00

redefinition fix for autolib: if first ATEXT is already defined, skip this file

SVN=126580
This commit is contained in:
Rob Pike 2008-07-09 16:40:11 -07:00
parent 6837c5927f
commit d5f4d94b80

View File

@ -461,7 +461,7 @@ objfile(char *file)
struct ar_hdr arhdr; struct ar_hdr arhdr;
char *e, *start, *stop; char *e, *start, *stop;
if(file[0] == '-' && file[1] == 'l') { if(file[0] == '-' && file[1] == 'l') { // TODO: fix this
if(debug['9']) if(debug['9'])
sprint(name, "/%s/lib/lib", thestring); sprint(name, "/%s/lib/lib", thestring);
else else
@ -819,6 +819,9 @@ ldobj(int f, long c, char *pn)
static int files; static int files;
static char **filen; static char **filen;
char **nfilen; char **nfilen;
int ntext;
ntext = 0;
if((files&15) == 0){ if((files&15) == 0){
nfilen = malloc((files+16)*sizeof(char*)); nfilen = malloc((files+16)*sizeof(char*));
@ -1062,6 +1065,13 @@ loop:
goto loop; goto loop;
case ATEXT: case ATEXT:
s = p->from.sym;
if(ntext++ == 0 && s->type != 0 && s->type != SXREF) {
/* redefinition, so file has probably been seen before */
if(debug['v'])
diag("skipping: %s: redefinition: %s", pn, s->name);
return;
}
if(curtext != P) { if(curtext != P) {
histtoauto(); histtoauto();
curtext->to.autom = curauto; curtext->to.autom = curauto;
@ -1069,7 +1079,6 @@ loop:
} }
skip = 0; skip = 0;
curtext = p; curtext = p;
s = p->from.sym;
if(s == S) { if(s == S) {
diag("%s: no TEXT symbol: %P", pn, p); diag("%s: no TEXT symbol: %P", pn, p);
errorexit(); errorexit();