<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi<div><br></div><div>I learn llvm/clang cfi from this repo and also the usenix '14 paper.</div><div><a href="https://github.com/trailofbits/clang-cfi-showcase/blob/master/cfi_icall.c">https://github.com/trailofbits/clang-cfi-showcase/blob/master/cfi_icall.c</a><br></div><div><br></div><div>As usenix '14 paper says, the type of functoin is determined only by number of argument.  </div><div><br></div><div>But I try in llvm/clang 7, I found that it is getting complicated.</div><div><br></div><div>For example,</div><div><br></div><div><div>#include<stdio.h></div><div><br></div><div>int func(int a,float b,char c){</div><div>  printf("hi %d,%f,%c\n",a,b,c);</div><div>  return a+1;</div><div>}</div><div><br></div><div>int main(){</div><div>  int (*fp)(int,float,char);</div><div>  fp = func;</div><div>  fp(1,1.0,'c');</div><div><br></div><div>  return 0;</div><div>}</div></div><div><br></div><div>clang -flto -fsanitize=cfi -fvisibility=hidden -O0 ./test.c<br></div><div><br></div><div>And the use objdump to see the executable : </div><div><div><br></div><div>00000000004005a0 <__typeid__ZTSFiifcE_global_addr>:</div><div>  4005a0:       e9 4b ff ff ff          jmpq   4004f0 <func.cfi></div><div>  4005a5:       cc                      int3</div><div>  4005a6:       cc                      int3</div><div>  4005a7:       cc                      int3</div><div>  4005a8:       0f 1f 84 00 00 00 00    nopl   0x0(%rax,%rax,1)</div><div>  4005af:       00</div></div><div><br></div><div>From the type id mangling "iifc", I can guess that the type of return value and the type of every argument are the factors to determine the type of a function. </div><div><br></div><div>I wonder that what's the definition of type of a function in llvm/clang 7.</div><div><br></div><div>Is there any document I can study?</div><div><br></div><div>Or I should study the code in compiler fronted (clang)? </div><div><br>Thank you.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div></div></div>