mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
builder, runtime: fix duplicate symbol error with Go 1.26+ on Windows
Go 1.26 changed syscall.loadlibrary, syscall.loadsystemlibrary, and syscall.getprocaddress from declarations to definitions in syscall/dll_windows.go. TinyGo's runtime also defines these via //go:linkname, causing "symbol multiply defined!" during LLVM module linking. Resolve this by detecting duplicate function definitions before calling llvm.LinkModules and turning the incoming duplicate into a declaration, so the runtime's version wins. TinyGo's implementations must take precedence because Go 1.26's versions depend on //go:cgo_import_dynamic, which TinyGo does not support. Also fix the signature of syscall_loadsystemlibrary to match the standard library (remove unused absoluteFilepath parameter). Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -247,7 +247,7 @@ func growHeap() bool {
|
||||
}
|
||||
|
||||
//go:linkname syscall_loadsystemlibrary syscall.loadsystemlibrary
|
||||
func syscall_loadsystemlibrary(filename *uint16, absoluteFilepath *uint16) (handle, err uintptr) {
|
||||
func syscall_loadsystemlibrary(filename *uint16) (handle, err uintptr) {
|
||||
handle = _LoadLibraryExW(filename, 0, _LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
if handle == 0 {
|
||||
panic("todo: get error")
|
||||
|
||||
Reference in New Issue
Block a user