Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion loader/goroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
"": true,
"crypto/": true,
"crypto/rand/": false,
"crypto/tls/": false,
"crypto/x509/": true,
"crypto/x509/internal/": true,
"crypto/x509/internal/macos/": false,
Expand Down Expand Up @@ -279,6 +278,17 @@ func pathsToOverride(goMinor int, needsSyscallPackage bool) map[string]bool {
paths["crypto/internal/entropy/v1.0.0/"] = false
}

// crypto/tls: TinyGo's version is a thin wrapper around a netdev-provided
// (hardware/firmware-offloaded) TLS socket, which only makes sense on
// embedded/wasm targets that have such a netdev. On the host/native target
// (raw-syscall netdev, no TLS offload) there is no real TLS that way, so use
// Go's full software crypto/tls instead — leaving crypto/tls out of the
// overrides map makes the goroot link Go's implementation. needsSyscallPackage
// is true exactly for the embedded/wasm targets.
if needsSyscallPackage {
paths["crypto/tls/"] = false
}

if needsSyscallPackage {
paths["syscall/"] = true // include syscall/js
paths["internal/syscall/"] = true
Expand Down
8 changes: 8 additions & 0 deletions src/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ func registerWeakPointer(ptr unsafe.Pointer) unsafe.Pointer {
return ptr
}

//go:linkname makeStrongFromWeak weak.runtime_makeStrongFromWeak
func makeStrongFromWeak(u unsafe.Pointer) unsafe.Pointer {
// Counterpart to registerWeakPointer above. Because weak pointers are never
// collected here (the "weak" handle is just the pointer itself), the
// referent is always still alive, so return it unchanged.
return u
}

var godebugUpdate func(string, string)

//go:linkname godebug_setUpdate internal/godebug.setUpdate
Expand Down
Loading