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

ld: fix link Windows PE __declspec(dllimport) symbol

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4568077
This commit is contained in:
Wei Guangjing 2011-06-14 11:05:59 -04:00 committed by Russ Cox
parent 2ad42a8249
commit 9e2ffc315f
2 changed files with 3 additions and 1 deletions

View File

@ -249,7 +249,7 @@ dynrelocsym(Sym *s)
return; return;
for(r=s->r; r<s->r+s->nr; r++) { for(r=s->r; r<s->r+s->nr; r++) {
targ = r->sym; targ = r->sym;
if(r->sym->plt == -2) { // make dynimport JMP table for PE object files. if(r->sym->plt == -2 && r->sym->got != -2) { // make dynimport JMP table for PE object files.
targ->plt = rel->size; targ->plt = rel->size;
r->sym = rel; r->sym = rel;
r->add = targ->plt; r->add = targ->plt;

View File

@ -403,6 +403,8 @@ readsym(PeObj *obj, int i, PeSym **y)
if(s != nil && s->type == 0 && !(sym->sclass == IMAGE_SYM_CLASS_STATIC && sym->value == 0)) if(s != nil && s->type == 0 && !(sym->sclass == IMAGE_SYM_CLASS_STATIC && sym->value == 0))
s->type = SXREF; s->type = SXREF;
if(strncmp(sym->name, "__imp__", 6) == 0)
s->got = -2; // flag for __imp__
sym->sym = s; sym->sym = s;
return 0; return 0;