<div dir="ltr"><a class="gmail_plusreply" id="plusReplyChip-14" href="mailto:pcc@google.com" tabindex="-1">+Peter Collingbourne</a> <br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 24, 2019 at 5:30 PM PenYiWang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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" target="_blank">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>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>