1
0
mirror of https://github.com/golang/go synced 2024-11-23 14:20:05 -07:00

cmd/cgo: add missing parameter list for function _cgo_wait_runtime_init_done

Fixes #29879
This commit is contained in:
Philipp Stephani 2019-01-23 21:04:09 +01:00
parent 829c5df586
commit 186863ab6a
5 changed files with 8 additions and 8 deletions

View File

@ -710,7 +710,7 @@ _cgo_main.c:
int main() { return 0; }
void crosscall2(void(*fn)(void*, int, uintptr_t), void *a, int c, uintptr_t ctxt) { }
uintptr_t _cgo_wait_runtime_init_done() { return 0; }
uintptr_t _cgo_wait_runtime_init_done(void) { return 0; }
void _cgo_release_context(uintptr_t ctxt) { }
char* _cgo_topofstack(void) { return (char*)0; }
void _cgo_allocate(void *a, int c) { }

View File

@ -59,14 +59,14 @@ func (p *Package) writeDefs() {
fmt.Fprintf(fm, "int main() { return 0; }\n")
if *importRuntimeCgo {
fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }\n")
fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done() { return 0; }\n")
fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done(void) { return 0; }\n")
fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__ ctxt) { }\n")
fmt.Fprintf(fm, "char* _cgo_topofstack(void) { return (char*)0; }\n")
} else {
// If we're not importing runtime/cgo, we *are* runtime/cgo,
// which provides these functions. We just need a prototype.
fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt);\n")
fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done();\n")
fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done(void);\n")
fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__);\n")
}
fmt.Fprintf(fm, "void _cgo_allocate(void *a, int c) { }\n")
@ -777,7 +777,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
fmt.Fprintf(fgcc, "extern void crosscall2(void (*fn)(void *, int, __SIZE_TYPE__), void *, int, __SIZE_TYPE__);\n")
fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done();\n")
fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done(void);\n")
fmt.Fprintf(fgcc, "extern void _cgo_release_context(__SIZE_TYPE__);\n\n")
fmt.Fprintf(fgcc, "extern char* _cgo_topofstack(void);")
fmt.Fprintf(fgcc, "%s\n", tsanProlog)
@ -1909,5 +1909,5 @@ static void GoInit(void) {
runtime_iscgo = 1;
}
extern __SIZE_TYPE__ _cgo_wait_runtime_init_done() __attribute__ ((weak));
extern __SIZE_TYPE__ _cgo_wait_runtime_init_done(void) __attribute__ ((weak));
`

View File

@ -32,7 +32,7 @@ x_cgo_sys_thread_create(void* (*func)(void*), void* arg) {
}
uintptr_t
_cgo_wait_runtime_init_done() {
_cgo_wait_runtime_init_done(void) {
void (*pfn)(struct context_arg*);
pthread_mutex_lock(&runtime_init_mu);

View File

@ -70,7 +70,7 @@ _cgo_is_runtime_initialized() {
}
uintptr_t
_cgo_wait_runtime_init_done() {
_cgo_wait_runtime_init_done(void) {
void (*pfn)(struct context_arg*);
_cgo_maybe_run_preinit();

View File

@ -61,7 +61,7 @@ void _cgo_sys_thread_start(ThreadStart *ts);
* If runtime.SetCgoTraceback is used to set a context function,
* calls the context function and returns the context value.
*/
uintptr_t _cgo_wait_runtime_init_done();
uintptr_t _cgo_wait_runtime_init_done(void);
/*
* Call fn in the 6c world.