[llvm-dev] What's definition to type of function in -fsanitize=cfi-icall in llvm/clang 7?

PenYiWang via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 17:30:20 PST 2019


I learn llvm/clang cfi from this repo and also the usenix '14 paper.

As usenix '14 paper says, the type of functoin is determined only by number
of argument.

But I try in llvm/clang 7, I found that it is getting complicated.

For example,


int func(int a,float b,char c){
  printf("hi %d,%f,%c\n",a,b,c);
  return a+1;

int main(){
  int (*fp)(int,float,char);
  fp = func;

  return 0;

clang -flto -fsanitize=cfi -fvisibility=hidden -O0 ./test.c

And the use objdump to see the executable :

00000000004005a0 <__typeid__ZTSFiifcE_global_addr>:
  4005a0:       e9 4b ff ff ff          jmpq   4004f0 <func.cfi>
  4005a5:       cc                      int3
  4005a6:       cc                      int3
  4005a7:       cc                      int3
  4005a8:       0f 1f 84 00 00 00 00    nopl   0x0(%rax,%rax,1)
  4005af:       00

>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

I wonder that what's the definition of type of a function in llvm/clang 7.

Is there any document I can study?

Or I should study the code in compiler fronted (clang)?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190125/44bcd019/attachment.html>

More information about the llvm-dev mailing list