]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: take section symbols' value into account for PE
authorShenghou Ma <minux.ma@gmail.com>
Tue, 22 May 2012 18:27:44 +0000 (02:27 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Tue, 22 May 2012 18:27:44 +0000 (02:27 +0800)
    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

src/cmd/ld/ldpe.c

index feb8620bdb1bde9ac1e8df266db42dcf6872fb45..942f69ae1a212b3869c35b32a3601e8c2e55b5e7 100644 (file)
@@ -300,6 +300,11 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
                                        rp->add = le64(rsect->base+rp->off);
                                        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);