]> Cypherpunks repositories - gostls13.git/commit
runtime: initialize shared library at library-load time
authorSrdjan Petrovic <spetrovic@google.com>
Thu, 26 Mar 2015 00:50:35 +0000 (17:50 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 3 Apr 2015 01:24:51 +0000 (01:24 +0000)
commite8694c8196e39328d6d61b1f32228d21112008d7
tree3942b490997e3f0800484c4666fdd787e925bf43
parent167562f65200bc01c9ecdcf393dfa2f16de3d9c2
runtime: initialize shared library at library-load time

This is Part 2 of the change, see Part 1 here: in https://go-review.googlesource.com/#/c/7692/

Suggested by iant@, we use the library initialization entry point to:
    - create a new OS thread and run the "regular" runtime init stack on
      that thread
    - return immediately from the main (i.e., loader) thread
    - at the first CGO invocation, we wait for the runtime initialization
      to complete.

The above mechanism is implemented only on linux_amd64.  Next step is to
support it on linux_arm.  Other platforms don't yet support shared library
compiling/linking, but we intend to use the same strategy there as well.

Change-Id: Ib2c81b1b83bee837134084b75a3beecfb8de6bf4
Reviewed-on: https://go-review.googlesource.com/8094
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
18 files changed:
src/cmd/cgo/doc.go
src/cmd/cgo/out.go
src/runtime/cgo.go
src/runtime/cgo/callbacks.go
src/runtime/cgo/gcc_libinit.c [new file with mode: 0644]
src/runtime/cgo/gcc_libinit_openbsd.c [new file with mode: 0644]
src/runtime/cgo/gcc_libinit_windows.c [new file with mode: 0644]
src/runtime/cgo/libcgo.h
src/runtime/os1_linux.go
src/runtime/os_linux.go
src/runtime/proc.go
src/runtime/rt0_linux_amd64.s
src/runtime/runtime2.go
src/runtime/sys_linux_386.s
src/runtime/sys_linux_amd64.s
src/runtime/sys_linux_arm.s
src/runtime/sys_linux_arm64.s
src/runtime/sys_linux_ppc64x.s