-
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.
Signed-off-by: Akihiro Suda <[email protected]>
- Loading branch information
1 parent
61b0dc5
commit 0f7cab6
Showing
4 changed files
with
70 additions
and
14 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
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
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,4 @@ | ||
/* go1.23.5 */ | ||
#define GOMODJAIL_OFFSET_M_IN_G 48 | ||
#define GOMODJAIL_OFFSET_LIBCALLPC_IN_M 832 | ||
#define GOMODJAIL_OFFSET_LIBCALLSP_IN_M 840 |
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,36 @@ | ||
#!/bin/sh | ||
set -eux -o pipefail | ||
|
||
: "${GOROOT:=$(go env GOROOT)}" | ||
|
||
cat <<EOF >"${GOROOT}"/src/runtime/gomodjail_offset.go | ||
package runtime | ||
import "unsafe" | ||
var ( | ||
GomodjailOffsetMinG = unsafe.Offsetof(g{}.m) | ||
GomodjailOffsetLibcallpcInM = unsafe.Offsetof(m{}.libcallpc) | ||
GomodjailOffsetLibcallspInM = unsafe.Offsetof(m{}.libcallsp) | ||
) | ||
EOF | ||
|
||
cat <<EOF >gomodjail_offset_print.go | ||
package main | ||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
func main() { | ||
fmt.Printf("/* %s */\n", runtime.Version()) | ||
fmt.Printf("#define GOMODJAIL_OFFSET_M_IN_G %d\n", runtime.GomodjailOffsetMinG) | ||
fmt.Printf("#define GOMODJAIL_OFFSET_LIBCALLPC_IN_M %d\n", runtime.GomodjailOffsetLibcallpcInM) | ||
fmt.Printf("#define GOMODJAIL_OFFSET_LIBCALLSP_IN_M %d\n", runtime.GomodjailOffsetLibcallspInM) | ||
} | ||
EOF | ||
|
||
go run ./gomodjail_offset_print.go | ||
|
||
rm -f "${GOROOT}"/src/runtime/gomodjail_offset.go gomodjail_offset_print.go |