1
0
mirror of https://github.com/golang/go synced 2024-11-25 13:57:57 -07:00

nm: silently ignore .o files in .a files

Update #1334.

R=r
CC=golang-dev
https://golang.org/cl/3553041
This commit is contained in:
Russ Cox 2010-12-10 11:32:48 -08:00
parent 71bd053ada
commit 4324a31376

View File

@ -126,31 +126,34 @@ void
doar(Biobuf *bp) doar(Biobuf *bp)
{ {
int offset, size, obj; int offset, size, obj;
char membername[SARNAME]; char name[SARNAME];
multifile = 1; multifile = 1;
for (offset = Boffset(bp);;offset += size) { for (offset = Boffset(bp);;offset += size) {
size = nextar(bp, offset, membername); size = nextar(bp, offset, name);
if (size < 0) { if (size < 0) {
error("phase error on ar header %d", offset); error("phase error on ar header %d", offset);
return; return;
} }
if (size == 0) if (size == 0)
return; return;
if (strcmp(membername, symname) == 0) if (strcmp(name, symname) == 0)
continue; continue;
obj = objtype(bp, 0); obj = objtype(bp, 0);
if (obj < 0) { if (obj < 0) {
// perhaps foreign object
if(strlen(name) > 2 && strcmp(name+strlen(name)-2, ".o") == 0)
return;
error("inconsistent file %s in %s", error("inconsistent file %s in %s",
membername, filename); name, filename);
return; return;
} }
if (!readar(bp, obj, offset+size, 1)) { if (!readar(bp, obj, offset+size, 1)) {
error("invalid symbol reference in file %s", error("invalid symbol reference in file %s",
membername); name);
return; return;
} }
filename = membername; filename = name;
nsym=0; nsym=0;
objtraverse(psym, 0); objtraverse(psym, 0);
printsyms(symptr, nsym); printsyms(symptr, nsym);