aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm.s
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-11-01 12:25:41 -0400
committerAustin Clements <austin@google.com>2018-11-12 20:27:18 +0000
commitaf1bfe0aa39091a4103bd29d8659f6267aad9df0 (patch)
tree57774ef97c6f5fdf742bd942f2b487cd84b049db /src/runtime/asm.s
parent6096b85b1326c22ec07c2aed2d78f3bef513ea69 (diff)
downloadgo-af1bfe0aa39091a4103bd29d8659f6267aad9df0.tar.gz
go-af1bfe0aa39091a4103bd29d8659f6267aad9df0.zip
runtime: correct ABI information for all functions
There are three cases where we don't currently have the visibility to get the ABIs of runtime symbols right, which this CL fixes: 1. For Go functions referenced from non-Go code in other packages. This is runtime.morestackc (which is referenced from function prologues) and a few syscall symbols. For these we need to generate ABI0 wrappers, so this CL adds dummy calls in the assembly code to force wrapper generation. There are many other cross-package references to runtime and runtime/internal/atomic, but these are handled specially by cmd/go. 2. For calls generated by the compiler to runtime Go functions, there are a few symbols that aren't declared in builtins.go because we've never needed their type information before. Now we at least need their ABI information, so these are added to builtins.go. 3. For calls generated by the compiler to runtime assembly functions, the compiler is going to assume the internal ABI is available, so we add Go stubs to the runtime to trigger wrapper generation. For these we're probably going to want to provide internal ABI definitions directly in the assembly for performance, but for now the ABIs are the same so it doesn't matter. For #27539. Change-Id: I9c224e7408d2ef4dd9b0e4c9d7e962ddfe111245 Reviewed-on: https://go-review.googlesource.com/c/146822 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/asm.s')
-rw-r--r--src/runtime/asm.s8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/asm.s b/src/runtime/asm.s
index 6b209b2d1f..314f99d69b 100644
--- a/src/runtime/asm.s
+++ b/src/runtime/asm.s
@@ -38,3 +38,11 @@ GLOBL runtime·memstats(SB), NOPTR, $0
// This function must be sizeofSkipFunction bytes.
TEXT runtime·skipPleaseUseCallersFrames(SB),NOSPLIT,$0-0
SKIP64; SKIP64; SKIP64; SKIP64
+
+// abi0Syms is a dummy symbol that creates ABI0 wrappers for Go
+// functions called from assembly in other packages.
+TEXT abi0Syms<>(SB),NOSPLIT,$0-0
+ // obj assumes it can call morestack* using ABI0, but
+ // morestackc is actually defined in Go.
+ CALL ·morestackc(SB)
+ // References from syscall are automatically collected by cmd/go.