diff options
| author | Ian Lance Taylor <iant@golang.org> | 2017-05-09 14:34:16 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-05-09 23:36:51 +0000 |
| commit | 5331e7e9df017374a05a66497fd367e165b8aaf5 (patch) | |
| tree | 4db5424e6ccafca41f1e200ac8289e594f40564e /src/cmd/internal/obj/ppc64/obj9.go | |
| parent | 08dca4c649ba7f90f209376ba342bd46ef14ebe5 (diff) | |
| download | go-5331e7e9df017374a05a66497fd367e165b8aaf5.tar.xz | |
cmd/internal/obj, cmd/link: fix st_other field on PPC64
In PPC64 ELF files, the st_other field indicates the number of
prologue instructions between the global and local entry points.
We add the instructions in the compiler and assembler if -shared is used.
We were assuming that the instructions were present when building a
c-archive or PIE or doing dynamic linking, on the assumption that those
are the cases where the go tool would be building with -shared.
That assumption fails when using some other tool, such as Bazel,
that does not necessarily use -shared in exactly the same way.
This CL records in the object file whether a symbol was compiled
with -shared (this will be the same for all symbols in a given compilation)
and uses that information when setting the st_other field.
Fixes #20290.
Change-Id: Ib2b77e16aef38824871102e3c244fcf04a86c6ea
Reviewed-on: https://go-review.googlesource.com/43051
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/internal/obj/ppc64/obj9.go')
| -rw-r--r-- | src/cmd/internal/obj/ppc64/obj9.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go index 72e02d39cf..b1509e3813 100644 --- a/src/cmd/internal/obj/ppc64/obj9.go +++ b/src/cmd/internal/obj/ppc64/obj9.go @@ -476,6 +476,11 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { // generate the addis instruction except as part of the // load of a large constant, and in that case there is no // way to use r12 as the source. + // + // Note that the same condition is tested in + // putelfsym in cmd/link/internal/ld/symtab.go + // where we set the st_other field to indicate + // the presence of these instructions. q = obj.Appendp(q, c.newprog) q.As = AWORD q.Pos = p.Pos |
