Sunday 15 March 2015

LLVM/Clang use opt to show linked ll file -



LLVM/Clang use opt to show linked ll file -

i had 2 c files , want show ir linked bit code

link1.c

#include "link2.h" int main() { int a; int b; foo(a,b); homecoming 0; }

link2.h

#include<stdio.h>

link2.c

#include "link2.h" void foo(int a, int b) { printf("%d\n", a); printf("%d\n", b); }

i did next command bc file.

clang -o0 -emit-llvm file1.c -c -o file1.bc clang -o0 -emit-llvm file2.c -c -o file2.bc llvm-link -o link.bc link1.bc link2.bc

when tried lli link.bc , llvm-dis link.bc run correctly , showed linked ll file, when utilize opt link.bc -s -o link.ll ll file reported segmentation error. can allow me know opt?

it seems because version compatible issue of opt. should utilize 3.5 version turns out using 3.4.2.

clang llvm

No comments:

Post a Comment