1
0
mirror of https://github.com/golang/go synced 2024-11-21 17:44:40 -07:00

cmd/ld: consistent binary for cgo programs

We use pkg path instead of file name (which contains $WORK) in section symbols names.

R=golang-dev, fullung, rsc, iant
CC=golang-dev
https://golang.org/cl/6445085
This commit is contained in:
Shenghou Ma 2012-09-20 00:18:41 +08:00
parent 28cb9fd509
commit 4d7c81bc67
3 changed files with 3 additions and 6 deletions

View File

@ -331,7 +331,6 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
symbols = nil;
USED(pkg);
if(debug['v'])
Bprint(&bso, "%5.2f ldelf %s\n", cputime(), pn);
@ -519,7 +518,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
if(sect->type != ElfSectNobits && map(obj, sect) < 0)
goto bad;
name = smprint("%s(%s)", pn, sect->name);
name = smprint("%s(%s)", pkg, sect->name);
s = lookup(name, version);
free(name);
switch((int)sect->flags&(ElfSectFlagAlloc|ElfSectFlagWrite|ElfSectFlagExec)) {

View File

@ -440,7 +440,6 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
Reloc *r, *rp;
char *name;
USED(pkg);
version++;
base = Boffset(f);
if(Bread(f, hdr, sizeof hdr) != sizeof hdr)
@ -566,7 +565,7 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
continue;
if(strcmp(sect->name, "__eh_frame") == 0)
continue;
name = smprint("%s(%s/%s)", pn, sect->segname, sect->name);
name = smprint("%s(%s/%s)", pkg, sect->segname, sect->name);
s = lookup(name, version);
if(s->type != 0) {
werrstr("duplicate %s/%s", sect->segname, sect->name);

View File

@ -145,7 +145,6 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
PeSym *sym;
USED(len);
USED(pkg);
if(debug['v'])
Bprint(&bso, "%5.2f ldpe %s\n", cputime(), pn);
@ -213,7 +212,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
if(map(obj, sect) < 0)
goto bad;
name = smprint("%s(%s)", pn, sect->name);
name = smprint("%s(%s)", pkg, sect->name);
s = lookup(name, version);
free(name);
switch(sect->sh.Characteristics&(IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_CNT_INITIALIZED_DATA|