mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo, runtime, runtime/cgo: use cgo context function
Add support for the context function set by runtime.SetCgoTraceback. The context function was added in CL 17761, without support. This CL is the support. This CL has not been tested for real C code, as a working context function for C code requires unwind support that does not seem to exist. I wanted to get the CL out before the freeze. I apologize for the length of this CL. It's mostly plumbing, but unfortunately the plumbing is processor-specific. Change-Id: I8ce11a0de9b3dafcc29efd2649d776e93bff0e90 Reviewed-on: https://go-review.googlesource.com/22508 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
c717675c35
commit
5f9a870bf1
27 changed files with 714 additions and 227 deletions
|
|
@ -511,7 +511,6 @@ file compiled by gcc, the file x.cgo2.c:
|
|||
void
|
||||
_cgo_be59f0f25121_Cfunc_puts(void *v)
|
||||
{
|
||||
_cgo_wait_runtime_init_done();
|
||||
struct {
|
||||
char* p0;
|
||||
int r;
|
||||
|
|
@ -520,8 +519,7 @@ file compiled by gcc, the file x.cgo2.c:
|
|||
a->r = puts((void*)a->p0);
|
||||
}
|
||||
|
||||
It waits for Go runtime to be initialized (required for shared libraries),
|
||||
extracts the arguments from the pointer to _Cfunc_puts's argument
|
||||
It extracts the arguments from the pointer to _Cfunc_puts's argument
|
||||
frame, invokes the system C function (in this case, puts), stores the
|
||||
result in the frame, and returns.
|
||||
|
||||
|
|
@ -539,8 +537,8 @@ linkage to the desired libraries. The main function is provided by
|
|||
_cgo_main.c:
|
||||
|
||||
int main() { return 0; }
|
||||
void crosscall2(void(*fn)(void*, int), void *a, int c) { }
|
||||
void _cgo_wait_runtime_init_done() { }
|
||||
void crosscall2(void(*fn)(void*, int, uintptr_t), void *a, int c, uintptr_t ctxt) { }
|
||||
uintptr_t _cgo_wait_runtime_init_done() { }
|
||||
void _cgo_allocate(void *a, int c) { }
|
||||
void _cgo_panic(void *a, int c) { }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue