diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-08 15:30:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-08 15:30:22 +0000 |
commit | 9adab5dd169afd191efd1dcbf50dae0f726a0a42 (patch) | |
tree | 55e1207fb22e51fd55c08d7f337c1822acf46f7b /libgo/misc | |
parent | b5ec4de777870e2d4ff2a5de604eafd1bf0e50df (diff) | |
download | gcc-9adab5dd169afd191efd1dcbf50dae0f726a0a42.zip gcc-9adab5dd169afd191efd1dcbf50dae0f726a0a42.tar.gz gcc-9adab5dd169afd191efd1dcbf50dae0f726a0a42.tar.bz2 |
libgo: update to Go1.10rc2
Reviewed-on: https://go-review.googlesource.com/92736
From-SVN: r257493
Diffstat (limited to 'libgo/misc')
-rw-r--r-- | libgo/misc/cgo/errors/src/err1.go | 2 | ||||
-rw-r--r-- | libgo/misc/cgo/test/issue19832.go | 16 | ||||
-rw-r--r-- | libgo/misc/cgo/test/issue4029.c | 19 | ||||
-rw-r--r-- | libgo/misc/cgo/test/issue4029.go | 17 |
4 files changed, 31 insertions, 23 deletions
diff --git a/libgo/misc/cgo/errors/src/err1.go b/libgo/misc/cgo/errors/src/err1.go index 61bbcd2..2c232cf 100644 --- a/libgo/misc/cgo/errors/src/err1.go +++ b/libgo/misc/cgo/errors/src/err1.go @@ -5,7 +5,7 @@ package main /* -#cgo LDFLAGS: -c +#cgo LDFLAGS: -L/nonexist void test() { xxx; // ERROR HERE diff --git a/libgo/misc/cgo/test/issue19832.go b/libgo/misc/cgo/test/issue19832.go deleted file mode 100644 index 4458777..0000000 --- a/libgo/misc/cgo/test/issue19832.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Issue 19832. Functions taking a pointer typedef were being expanded and triggering a compiler error. - -package cgotest - -// typedef struct { int i; } *PS; -// void T19832(PS p) {} -import "C" -import "testing" - -func test19832(t *testing.T) { - C.T19832(nil) -} diff --git a/libgo/misc/cgo/test/issue4029.c b/libgo/misc/cgo/test/issue4029.c index eab3683..7205c5a 100644 --- a/libgo/misc/cgo/test/issue4029.c +++ b/libgo/misc/cgo/test/issue4029.c @@ -4,6 +4,25 @@ // +build !windows +#include <stdint.h> +#include <dlfcn.h> + +// Write our own versions of dlopen/dlsym/dlclose so that we represent +// the opaque handle as a Go uintptr rather than a Go pointer to avoid +// garbage collector confusion. See issue 23663. + +uintptr_t dlopen4029(char* name, int flags) { + return (uintptr_t)(dlopen(name, flags)); +} + +uintptr_t dlsym4029(uintptr_t handle, char* name) { + return (uintptr_t)(dlsym((void*)(handle), name)); +} + +int dlclose4029(uintptr_t handle) { + return dlclose((void*)(handle)); +} + void call4029(void *arg) { void (*fn)(void) = arg; fn(); diff --git a/libgo/misc/cgo/test/issue4029.go b/libgo/misc/cgo/test/issue4029.go index 5789b99..8e468d3 100644 --- a/libgo/misc/cgo/test/issue4029.go +++ b/libgo/misc/cgo/test/issue4029.go @@ -7,10 +7,15 @@ package cgotest /* +#include <stdint.h> #include <dlfcn.h> #cgo linux LDFLAGS: -ldl -extern void call4029(void *arg); +extern uintptr_t dlopen4029(char*, int); +extern uintptr_t dlsym4029(uintptr_t, char*); +extern int dlclose4029(uintptr_t); + +extern void call4029(uintptr_t arg); */ import "C" @@ -51,15 +56,15 @@ func test4029(t *testing.T) { } func loadThySelf(t *testing.T, symbol string) { - this_process := C.dlopen(nil, C.RTLD_NOW) - if this_process == nil { + this_process := C.dlopen4029(nil, C.RTLD_NOW) + if this_process == 0 { t.Error("dlopen:", C.GoString(C.dlerror())) return } - defer C.dlclose(this_process) + defer C.dlclose4029(this_process) - symbol_address := C.dlsym(this_process, C.CString(symbol)) - if symbol_address == nil { + symbol_address := C.dlsym4029(this_process, C.CString(symbol)) + if symbol_address == 0 { t.Error("dlsym:", C.GoString(C.dlerror())) return } |