github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/libc/lookup_libc_darwin_arm64.s (about) 1 #include "textflag.h" 2 3 TEXT ·libc_dlopen_trampoline(SB),NOSPLIT,$0 4 MOVD R0, R19 5 MOVD 0(R19), R0 // arg 1 soPath 6 MOVD 8(R19), R1 // arg 2 flags 7 BL libc_dlopen(SB) 8 MOVD $0, R1 9 MOVD $-1, R2 10 CMP R0, R2 11 BNE ok 12 BL libc_error(SB) 13 MOVW (R0), R1 14 MOVD $0, R0 15 ok: 16 MOVD R0, 16(R19) // ret 1 p 17 MOVD R1, 24(R19) // ret 2 err 18 RET 19 20 TEXT ·libc_dlsym_trampoline(SB),NOSPLIT,$0 21 MOVD R0, R19 22 MOVD 0(R19), R0 // arg 1 handle 23 MOVD 8(R19), R1 // arg 2 symName 24 BL libc_dlsym(SB) 25 MOVD $0, R1 26 MOVD $-1, R2 27 CMP R0, R2 28 BNE ok 29 BL libc_error(SB) 30 MOVW (R0), R1 31 MOVD $0, R0 32 ok: 33 MOVD R0, 16(R19) // ret 1 p 34 RET 35 36 TEXT ·libc_dlopen_noframe_trampoline(SB),NOSPLIT,$0 37 B ·libc_dlopen_trampoline(SB) 38 39 TEXT ·libc_dlsym_noframe_trampoline(SB),NOSPLIT,$0 40 B ·libc_dlsym_trampoline(SB)