arm64 汇编调用C函数
main.s
.section .text
.globl main
main:stp x29, x30, [sp, -16]! //store fp x29 lr x30mov x0, #0mov x1, #1bl addmov x1, x0 // x0 return ldp x29, x30, [sp], 16 //restore fp lrret
add.c
#include <stdio.h>
int add(int a, int b)
{printf("a=%d,b=%d\n",a,b);return a+b;
}
编译
gcc -g main.s add.c
调试
gdb a.out
b main