Skip to content

Commit

Permalink
platform: removes unnecessary code (#1492)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
  • Loading branch information
mathetake authored May 28, 2023
1 parent e987e69 commit 9aa8f4e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions internal/platform/mmap_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions internal/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9aa8f4e

Please sign in to comment.