abi0test
v1.82.14
modernc.org/libc/internal/abi0test
Documentation
pkg.go.dev ↗Package abi0test provides ABI0 functions, written in assembler, for testing how libc's Y functions handle C function pointers coming from ABI0 code, like C compiled at run time. The variables hold their ABI0 entry addresses. Got and N record what the functions were called with.
The functions exist on linux/amd64, linux/arm64 and darwin/arm64, the targets with Y functions.
Variables
Exit42 (11 declarations)
var ( Exit42 = exit42Addr() // void f(void): exits the process with status 42. StoreI = storeIAddr() // void f(int sig): Got = sig. StoreIPP = storeIPPAddr() // void f(int sig, void *info, void *ctx): Got = sig, N = info. StoreP = storePAddr() // void f(void *arg): Got = arg. Entry = entryAddr() // void *f(void *arg): return arg+1. Write = writeAddr() // ssize_t f(void *cookie, char *buf, size_t n): N += n, return n. Seek = seekAddr() // int f(void *cookie, off_t *off, int whence): return -1. Close = closeAddr() // int f(void *cookie): Got = cookie, return 0. Cmp = cmpAddr() // int f(const void *a, const void *b): compares the int64s *a and *b. Got int64 N int64 )
Functions
CallXalloca
func CallXalloca(tls, n uintptr) uintptr
CallXalloca calls libc's Xalloca(tls, n) the way ABI0 code does, through its ABI0 entry. It fails to link if libc gives Xalloca no ABI0 wrapper.
CallYqsort
func CallYqsort(tls, base, nel, width, cmp uintptr)
CallYstrlen
func CallYstrlen(tls, s uintptr) uint64
CallYstrlen and CallYqsort call the Y wrappers of strlen and qsort, which qbecc --abi0wrap generates, the way ABI0 code does.