Reputation: 13755
I have the following code and commands.
==> main.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>
void print();
int main() {
print();
return 0;
}
==> print.c <==
/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>
void print() {
puts("Hello World!");
}
$ clang -c -emit-llvm -o main.bc main.c
$ clang -c -emit-llvm -o print.bc print.c
$ llvm-link -o main1.bc main.bc print.bc
$ lli main1.bc
Hello World!
However, I am not sure what are the widely accepted file extensions should be.
I have main1.bc
and main.bc
, both have .bc
extension. However, main1.bc
can run with lli and was generated by llvm-link. So it is probably better to distingish it with main.bc
and print.bc
.
Could anybody let me know the generally accepted standard of file extensions and the recommended commandline workflow? Thanks.
Upvotes: 1
Views: 211
Reputation: 34411
The llvm-link
tool operates on LLVM bitcode and outputs the same bitcode, so there is no difference between main.bc
and print.bc
.
Canonical extensions for textual LLVM IR - .ll
, compiled one - .bc
.
Upvotes: 2