mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime, syscall: link Solaris binaries directly instead of using dlopen/dlsym
Before CL 8214 (use .plt instead of .got on Solaris) Solaris used a dynamic linking scheme that didn't permit lazy binding. To speed program startup, Go binaries only used it for a small number of symbols required by the runtime. Other symbols were resolved on demand on first use, and were cached for subsequent use. This required some moderately complex code in the syscall package. CL 8214 changed the way dynamic linking is implemented, and now lazy binding is supported. As now all symbols are resolved lazily by the dynamic loader, there is no need for the complex code in the syscall package that did the same. This CL makes Go programs link directly with the necessary shared libraries and deletes the lazy-loading code implemented in Go. Change-Id: Ifd7275db72de61b70647242e7056dd303b1aee9e Reviewed-on: https://go-review.googlesource.com/9184 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
2b90c3e8ed
commit
fe5ef5c9d7
6 changed files with 359 additions and 489 deletions
|
|
@ -9,9 +9,6 @@ import "unsafe"
|
|||
var (
|
||||
libc_chdir,
|
||||
libc_chroot,
|
||||
libc_dlopen,
|
||||
libc_dlclose,
|
||||
libc_dlsym,
|
||||
libc_execve,
|
||||
libc_fcntl,
|
||||
libc_forkx,
|
||||
|
|
@ -85,48 +82,6 @@ func syscall_close(fd int32) int32 {
|
|||
return int32(sysvicall1(&libc_close, uintptr(fd)))
|
||||
}
|
||||
|
||||
func syscall_dlopen(name *byte, mode uintptr) (handle uintptr, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlopen)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&name)),
|
||||
}
|
||||
entersyscallblock(0)
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
|
||||
exitsyscall(0)
|
||||
if call.r1 == 0 {
|
||||
return call.r1, call.err
|
||||
}
|
||||
return call.r1, 0
|
||||
}
|
||||
|
||||
func syscall_dlclose(handle uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlclose)),
|
||||
n: 1,
|
||||
args: uintptr(unsafe.Pointer(&handle)),
|
||||
}
|
||||
entersyscallblock(0)
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
|
||||
exitsyscall(0)
|
||||
return call.r1
|
||||
}
|
||||
|
||||
func syscall_dlsym(handle uintptr, name *byte) (proc uintptr, err uintptr) {
|
||||
call := libcall{
|
||||
fn: uintptr(unsafe.Pointer(&libc_dlsym)),
|
||||
n: 2,
|
||||
args: uintptr(unsafe.Pointer(&handle)),
|
||||
}
|
||||
entersyscallblock(0)
|
||||
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
|
||||
exitsyscall(0)
|
||||
if call.r1 == 0 {
|
||||
return call.r1, call.err
|
||||
}
|
||||
return call.r1, 0
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func syscall_execve(path, argv, envp uintptr) (err uintptr) {
|
||||
call := libcall{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue