diff options
author | Srdjan Petrovic <spetrovic@google.com> | 2015-03-17 09:47:01 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-03-27 22:52:10 +0000 |
commit | 8da54a4eec860b2b96d43abe3a40f1c08edb6493 (patch) | |
tree | 77c6a22d9cf7875fe7ad503a2874bd8969c16079 /src/runtime/rt0_linux_amd64.s | |
parent | ff1f3a11e4f1b0eee87225aec1aaaf2e74972ae0 (diff) | |
download | go-8da54a4eec860b2b96d43abe3a40f1c08edb6493.tar.gz go-8da54a4eec860b2b96d43abe3a40f1c08edb6493.zip |
cmd: linker changes for shared library initialization
Suggested by iant@, this change:
- looks for a symbol _rt0_<GOARCH>_<GOOS>_lib,
- if the symbol is present, adds a new entry into the .init_array ELF
section that points to the symbol.
The end-effect is that the symbol _rt0_<GOARCH>_<GOOS>_lib will be
invoked as soon as the (ELF) shared library is loaded, which will in turn
initialize the runtime. (To be implemented.)
Change-Id: I99911a180215a6df18f8a18483d12b9b497b48f4
Reviewed-on: https://go-review.googlesource.com/7692
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/rt0_linux_amd64.s')
-rw-r--r-- | src/runtime/rt0_linux_amd64.s | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/rt0_linux_amd64.s b/src/runtime/rt0_linux_amd64.s index 985426acc4..9d9cb34128 100644 --- a/src/runtime/rt0_linux_amd64.s +++ b/src/runtime/rt0_linux_amd64.s @@ -10,6 +10,13 @@ TEXT _rt0_amd64_linux(SB),NOSPLIT,$-8 MOVQ $main(SB), AX JMP AX +// When linking with -shared, this symbol is called when the shared library +// is loaded. +TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0 + // TODO(spetrovic): Do something useful, like calling $main. (Note that + // this has to be done in a separate thread, as main is expected to block.) + RET + TEXT main(SB),NOSPLIT,$-8 MOVQ $runtime·rt0_go(SB), AX JMP AX |