1
0
mirror of https://github.com/golang/go synced 2024-11-20 02:54:39 -07:00

cmd/ld: take section symbols' value into account for PE

ld -r could generate multiple section symbols for the same section,
but with different values, we have to take that into account.
    Fixes #3322.
    Part of issue 3261.
    For CL 5822049.

R=golang-dev, iant, rsc, iant
CC=golang-dev
https://golang.org/cl/5823059
This commit is contained in:
Shenghou Ma 2012-05-23 02:27:44 +08:00
parent 090f9fc3ef
commit 1c4b77a7c8

View File

@ -300,6 +300,11 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
rp->add = le64(rsect->base+rp->off); rp->add = le64(rsect->base+rp->off);
break; break;
} }
// ld -r could generate multiple section symbols for the
// same section but with different values, we have to take
// that into account
if (obj->pesym[symindex].name[0] == '.')
rp->add += obj->pesym[symindex].value;
} }
qsort(r, rsect->sh.NumberOfRelocations, sizeof r[0], rbyoff); qsort(r, rsect->sh.NumberOfRelocations, sizeof r[0], rbyoff);