]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj, runtime: fixes for defer in 386 shared libraries
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 1 Jun 2016 23:07:55 +0000 (11:07 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Fri, 3 Jun 2016 02:50:27 +0000 (02:50 +0000)
commit26849746c9c7ca290d6cbb7ca5f3cf71c971e980
treee894cc6742f10b21f3c8bf599deaf91305abdf15
parent5799973c3e25545ac0e7d20f32a1453531c69399
cmd/internal/obj, runtime: fixes for defer in 386 shared libraries

Any defer in a shared object crashed when GOARCH=386. This turns out to be two
bugs:

 1) Calls to morestack were not processed to be PIC safe (must have been
    possible to trigger this another way too)
 2) jmpdefer needs to rewind the return address of the deferred function past
    the instructions that load the GOT pointer into BX, not just past the call

Bug 2) requires re-introducing the a way for .s files to know when they are
being compiled for dynamic linking but I've tried to do that in as minimal
a way as possible.

Fixes #15916

Change-Id: Ia0d09b69ec272a176934176b8eaef5f3bfcacf04
Reviewed-on: https://go-review.googlesource.com/23623
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testshared/src/depBase/dep.go
src/cmd/go/build.go
src/cmd/internal/obj/x86/obj6.go
src/runtime/asm_386.s