From: David Crawshaw Date: Fri, 17 Apr 2015 02:01:20 +0000 (-0400) Subject: runtime: export main.main for android X-Git-Tag: go1.5beta1~1051 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c8aba85e4a83c2023bed4e1e8ae3c480ecf835ec;p=gostls13.git runtime: export main.main for android Previously we started the Go runtime from a JNI function call, which eventually called the program's main function. Now the runtime is initialized by an ELF initialization function as a c-shared library, and the program's main function is not called. So now we export main so it can be called from JNI. This is necessary for all-Go apps because unlike a normal shared library, the program loading the library is not written by or known to the programmer. As far as they are concerned, the .so is everything. In fact the same code is compiled for iOS as a normal Go program. Change-Id: I61c6a92243240ed229342362231b1bfc7ca526ba Reviewed-on: https://go-review.googlesource.com/9015 Reviewed-by: Hyang-Ah Hana Kim --- diff --git a/src/runtime/os_android_arm.go b/src/runtime/os_android_arm.go index be7c3c000b..52c8c86ee8 100644 --- a/src/runtime/os_android_arm.go +++ b/src/runtime/os_android_arm.go @@ -6,10 +6,10 @@ package runtime import _ "unsafe" // for go:cgo_export_static and go:cgo_export_dynamic -// Export the runtime entry point symbol. +// Export the main function. // -// Used by the app package to start the Go runtime after loading -// a shared library via JNI. See golang.org/x/mobile/app. +// Used by the app package to start all-Go Android apps that are +// loaded via JNI. See golang.org/x/mobile/app. -//go:cgo_export_static _rt0_arm_linux1 -//go:cgo_export_dynamic _rt0_arm_linux1 +//go:cgo_export_static main.main +//go:cgo_export_dynamic main.main