Thank you for the reply!
How exactly did you create the .so file?
$ go build -o libgotest.so -buildmode=c-shared -compiler=gccgo test.go
How exactly are you running it?
I used the .so file as a plugin in my simulator.
After loading the library using dlmopen, we get the symbol of the 'mainGo' function with 'dlsym'.
Then we tried to execute the 'mainGo' function.
Here you may get the disassembly for 'mainGo'. As you can see from the disassembly `_cgo_wait_runtime_init_done` function was called to initialize the runtime.
Inside `_cgo_wait_runtime_init_done` function pthread_cond_wait called, and as a result other threads was created to initialize the runtime.
Please look
here and
here for the bt of two of the threads. A new go-routine was created from the first thread, and it is inside here the segmentation fault appeared.
Here is the bt.