Commit 9e2ffc31 authored by Wei Guangjing's avatar Wei Guangjing Committed by Russ Cox

ld: fix link Windows PE __declspec(dllimport) symbol

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4568077
parent 2ad42a82
...@@ -249,7 +249,7 @@ dynrelocsym(Sym *s) ...@@ -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;
......
...@@ -403,6 +403,8 @@ readsym(PeObj *obj, int i, PeSym **y) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment