aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/syscall_windows_test.go
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2023-01-30 14:42:17 +0100
committerDamien Neil <dneil@google.com>2023-01-31 22:06:41 +0000
commita17d959debdb04cd550016a3501dd09d50cd62e7 (patch)
tree3fd64a6cfada925520bf0a915f1389a47f1c5552 /src/runtime/syscall_windows_test.go
parent34d026862df50e36bdb74f010f746f91b7d6a052 (diff)
downloadgo-a17d959debdb04cd550016a3501dd09d50cd62e7.tar.xz
runtime: always use LoadLibraryEx to load system libraries
This CL removes a fallback that used LoadLibraryA when the runtime was loading system DLLs on Windows 7, Windows Server 2008 R2, or earlier. We can safely remove that fallback now, as go1.21 will require at least Windows 8 or Server 2012. This CL also saves some syscall initialization time and bytes: new: init syscall @2.3 ms, 0 ms clock, 1000 bytes, 18 allocs old: init syscall @3.6 ms, 0.52 ms clock, 1744 bytes, 24 allocs Updates #57003 Change-Id: I7dcc1173537785b6b580e9f78632c0c74da658d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/463842 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/runtime/syscall_windows_test.go')
-rw-r--r--src/runtime/syscall_windows_test.go23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go
index abc28387e6..b49da32384 100644
--- a/src/runtime/syscall_windows_test.go
+++ b/src/runtime/syscall_windows_test.go
@@ -1164,10 +1164,7 @@ uintptr_t cfunc(void) {
dll, err = syscall.LoadDLL(name)
if err == nil {
dll.Release()
- if wantLoadLibraryEx() {
- t.Fatalf("Bad: insecure load of DLL by base name %q before sysdll registration: %v", name, err)
- }
- t.Skip("insecure load of DLL, but expected")
+ t.Fatalf("Bad: insecure load of DLL by base name %q before sysdll registration: %v", name, err)
}
}
@@ -1213,24 +1210,6 @@ func TestBigStackCallbackSyscall(t *testing.T) {
}
}
-// wantLoadLibraryEx reports whether we expect LoadLibraryEx to work for tests.
-func wantLoadLibraryEx() bool {
- return testenv.Builder() != "" && (runtime.GOARCH == "amd64" || runtime.GOARCH == "386")
-}
-
-func TestLoadLibraryEx(t *testing.T) {
- use, have, flags := runtime.LoadLibraryExStatus()
- if use {
- return // success.
- }
- if wantLoadLibraryEx() {
- t.Fatalf("Expected LoadLibraryEx+flags to be available. (LoadLibraryEx=%v; flags=%v)",
- have, flags)
- }
- t.Skipf("LoadLibraryEx not usable, but not expected. (LoadLibraryEx=%v; flags=%v)",
- have, flags)
-}
-
var (
modwinmm = syscall.NewLazyDLL("winmm.dll")
modkernel32 = syscall.NewLazyDLL("kernel32.dll")