cmd/compile: '_rt0_amd64_windows_lib' is not called when linking with VS2015 #30347
Comments
I could be wrong, but I don't think this is supported. Go only supports GCC C compiler on Windows. Alex |
Yea... That could be the case. :( It would be interesting if we could add support for it though. Not sure how much work that would be? I guess this issue has something to do with that the global constructor(s) in the archive is not recognized by the VS linker. Just as a test I tried to call it manually. Didn't work. :) But I'm not sure what _rt0_amd64_windows_lib expects in terms of register setup etc. @dmitshur So perhaps this should be tagged question then? Does anyone know what it would take to make this work. (if possible even possible.) |
I do not know. Sorry. There is #20982 that might be related to this. Alex |
@alexbrainman Thanks. I must have missed that one. It is related. I did not try to use the MSVC tools to build it all but if #20982 were to be merged that would be super helpful for my case. Thanks |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes (go1.11.5)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Compile any package with -buildmode=c-archive on Windows using Go1.11.5 and TDM-GCC-64 (mingw64). Link the library with a small application using VisualStudio 2015 and call any C exported Go function in the library.
What did you expect to see?
Function should be executed just like when the application was built with Mingw.
What did you see instead?
The application deadlocks when calling the function because runtime waits for the 'runtime_init_wait' object in src\runtime\cgo\gcc_libinit_windows.c:77. It looks like _rt0_amd64_windows_lib is never called if you link with VisualStudio 2015 (I suspect later versions have the same problem)
I also noted a warning during build "main.a(go.o) : warning LNK4078: multiple '.text' sections found with different attributes (60600060)" I'm not sure if this is the cause of the issue...?
Go_minimal_c-archive.zip
The text was updated successfully, but these errors were encountered: