I am writing LLVM IR code, can I call a function in another .ll file?
For example: In a.ll file, there is a function foo(); Can I use this function in b.ll, like just call foo? If so, how can I include a.ll
Thanks
I am writing LLVM IR code, can I call a function in another .ll file?
For example: In a.ll file, there is a function foo(); Can I use this function in b.ll, like just call foo? If so, how can I include a.ll
Thanks
I tried the above procedure but the
a.out
file produced is not an executable. It initially gives aPermission denied
error and after adding the appropriate permissions says:-bash: ./a.out: cannot execute binary file
Taking the same two llvm files i.e
a.ll
andb.ll
what works for me is:The following 3 commands creates an executable which executes fine. The first command creates an LLVM bitcode file called
hello.ll
which linksa.ll
andb.ll
. After that it is simply a process of creating an executable binary from an llvm bitcode file. which the next 2 steps do. (Note that I am using LLVM 8)You need to add declaration of function foo in the ll file in which you are calling it, then as usual convert link ll files to generate executable
example a.ll
b.ll