From 9aa8f4e0ae838f0bccbf9a43fdcd0fbb6be4bc2d Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Mon, 29 May 2023 09:09:24 +1000 Subject: [PATCH] platform: removes unnecessary code (#1492) Signed-off-by: Takeshi Yoneda --- internal/platform/mmap_unix.go | 4 +--- internal/platform/platform.go | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/internal/platform/mmap_unix.go b/internal/platform/mmap_unix.go index cd6f511277..03b6cc6018 100644 --- a/internal/platform/mmap_unix.go +++ b/internal/platform/mmap_unix.go @@ -32,13 +32,11 @@ func mmapCodeSegmentARM64(size int) ([]byte, error) { return mmapCodeSegment(size, mmapProtARM64) } -// MprotectRX is like syscall.Mprotect, defined locally so that freebsd compiles. +// MprotectRX is like syscall.Mprotect with RX permission, defined locally so that freebsd compiles. func MprotectRX(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) } const prot = syscall.PROT_READ | syscall.PROT_EXEC _, _, e1 := syscall.Syscall(syscall.SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) diff --git a/internal/platform/platform.go b/internal/platform/platform.go index 2a0b78de0c..267db88098 100644 --- a/internal/platform/platform.go +++ b/internal/platform/platform.go @@ -15,8 +15,6 @@ var IsGo120 = strings.Contains(runtime.Version(), "go1.20") // archRequirementsVerified is set by platform-specific init to true if the platform is supported var archRequirementsVerified bool -var _zero uintptr - // CompilerSupported is exported for tests and includes constraints here and also the assembler. func CompilerSupported() bool { switch runtime.GOOS {