Reputation: 403
I have a C code(called a.c for example) that calls function such us printf
, textcolor
and gotoxy
from stdio.h/curses.h. LLVM-IR for a.c will only declare these functions and show these functions have been called meaning it wont have detailed IR for implementing these functions in a.ll. Is there any way I can get access to those IR or put all the implementations(IR of a.c+ IR of those function calls) together into one .ll file? I'm not knowing LLVM very well, so please let me know if I've made some conceptual mistakes.
Upvotes: 1
Views: 1826
Reputation: 273366
You can not get this from your program, because it doesn't contain those functions. Even if statically linked, the executable most likely will not, because libc (where printf
and other C library functions come from) exists on your machine as an object file, not LLVM IR.
What you can do is compile one of the C libraries (try something small and simple like ulibc
or newlib
) with LLVM. Then you can emit LLVM IR from that. FWIW, the Chrome Portable Native Client project does this (with newlib
) - you can use the directions on this page to build it and replicate the steps yourself.
Upvotes: 7