mirror of
https://github.com/golang/go
synced 2024-11-22 00:44:39 -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:
parent
28cb9fd509
commit
4d7c81bc67
@ -331,7 +331,6 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
|
|
||||||
symbols = nil;
|
symbols = nil;
|
||||||
|
|
||||||
USED(pkg);
|
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f ldelf %s\n", cputime(), pn);
|
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)
|
if(sect->type != ElfSectNobits && map(obj, sect) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
name = smprint("%s(%s)", pn, sect->name);
|
name = smprint("%s(%s)", pkg, sect->name);
|
||||||
s = lookup(name, version);
|
s = lookup(name, version);
|
||||||
free(name);
|
free(name);
|
||||||
switch((int)sect->flags&(ElfSectFlagAlloc|ElfSectFlagWrite|ElfSectFlagExec)) {
|
switch((int)sect->flags&(ElfSectFlagAlloc|ElfSectFlagWrite|ElfSectFlagExec)) {
|
||||||
|
@ -440,7 +440,6 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
Reloc *r, *rp;
|
Reloc *r, *rp;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
USED(pkg);
|
|
||||||
version++;
|
version++;
|
||||||
base = Boffset(f);
|
base = Boffset(f);
|
||||||
if(Bread(f, hdr, sizeof hdr) != sizeof hdr)
|
if(Bread(f, hdr, sizeof hdr) != sizeof hdr)
|
||||||
@ -566,7 +565,7 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
continue;
|
continue;
|
||||||
if(strcmp(sect->name, "__eh_frame") == 0)
|
if(strcmp(sect->name, "__eh_frame") == 0)
|
||||||
continue;
|
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);
|
s = lookup(name, version);
|
||||||
if(s->type != 0) {
|
if(s->type != 0) {
|
||||||
werrstr("duplicate %s/%s", sect->segname, sect->name);
|
werrstr("duplicate %s/%s", sect->segname, sect->name);
|
||||||
|
@ -145,7 +145,6 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
PeSym *sym;
|
PeSym *sym;
|
||||||
|
|
||||||
USED(len);
|
USED(len);
|
||||||
USED(pkg);
|
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f ldpe %s\n", cputime(), pn);
|
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)
|
if(map(obj, sect) < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
name = smprint("%s(%s)", pn, sect->name);
|
name = smprint("%s(%s)", pkg, sect->name);
|
||||||
s = lookup(name, version);
|
s = lookup(name, version);
|
||||||
free(name);
|
free(name);
|
||||||
switch(sect->sh.Characteristics&(IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_CNT_INITIALIZED_DATA|
|
switch(sect->sh.Characteristics&(IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_CNT_INITIALIZED_DATA|
|
||||||
|
Loading…
Reference in New Issue
Block a user