-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1968cfd
commit 6aff118
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build darwin | ||
// +build darwin | ||
|
||
package launchd | ||
|
||
import "unsafe" | ||
|
||
// free is defined in libxpc.dylib | ||
var libc_free_trampoline_addr uintptr | ||
|
||
//go:cgo_import_dynamic libc_free free "/usr/lib/libSystem.B.dylib" | ||
|
||
//go:nosplit | ||
func free(ptr unsafe.Pointer) { | ||
syscall_syscall(libc_free_trampoline_addr, uintptr(ptr), 0, 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build darwin | ||
// +build darwin | ||
|
||
#include "textflag.h" | ||
|
||
// The trampolines are ABIInternal as they are address-taken in | ||
// Go code. | ||
|
||
TEXT libc_free_trampoline<>(SB),NOSPLIT,$0-0 | ||
JMP libc_free(SB) | ||
|
||
GLOBL ·libc_free_trampoline_addr(SB), RODATA, $8 | ||
DATA ·libc_free_trampoline_addr(SB)/8, $libc_free_trampoline<>(SB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters