一个大概能跑出程序段地址的c程序大概长这样
```c
#include <stdio.h>
typedef void (*myfunc)();
void getresult(myfunc function) {
__asm("mov %rdi, %rsi");
printf("%p");
}
int main() {
int result, input;
__asm__("movl %1,%0" : "=r" (result) : "m" (input));
getresult(getresult);
printf("111");
return 0;
}
```
对应getresult的IR长这样:
```cpp
define void @getresult(void (...)* %function) #0 {
entry:
%function.addr = alloca void (...)*, align 8
store void (...)* %function, void (...)** %function.addr, align 8
call void asm sideeffect "mov %rdi, %rsi", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !3
%call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
```
所以理论上在外面加上一个___GetFuncAddr函数,然后把上面的IR插进去,然后在main中调用即可,踩了一小时inline asm的坑,把asm插进去了,接下来把asm前后的代码放进去就行,增加IR的函数在gsfpi.cpp中的CreateFuncAddr中,在这里面加代码就行