[LLVMdev] Migrate Project Build system to LLVM BitCode

Duncan Sands baldrick at free.fr
Thu Jan 17 06:57:16 PST 2013


Hi Ahmad,

On 17/01/13 14:56, Hassan, Ahmad wrote:
> Hi All,
>
> I am migrating a build system of an existing project from ‘Object files’ based
> executable generation to ‘LLVM Bitcode’ files based exe generation and applying
> OPT pass to LLVM Bitcode. I found out the following 4 step procedure. Please let
> me know if this is the right procedure or is there any other easy way of doing
> it. I need to modify ‘Makefile’ accordingly. I read on some forums about
> GoldPlugin but I don’t know exactly if it would be useful here:
>
> *Original Makefile- Object Files based Build/Link Steps: *
>
> clang -g -O2   –o  .libs/mergedexe  file1.o    file2.o   file3.o   -pthread
> -Wl,--export-dynamic   .libs/lib1.a   -lssl –ldl –pthread .libs/lib2.so
>
> *Proposed Makefile- LLVM Bitcode based Build/Link Steps:*
>
> 1.llvm-link -o .libs/mergedbc.bc   file1.bc    file2.bc   file3.bc
>
> 2.opt  –o  optmerged.bc  -load /path/to/Mypass.so  -mypass <  mergedbc.bc
>
> 3.llc  -o .libs/mergedbc.s    .libs/mergedbc.bc
>
> 4.gcc -g -O2 -o .libs/mergedexe  .libs/mergedbc.s  -pthread
> -Wl,--export-dynamic   .libs/lib1.a   -lssl -lcrypto –ldl –pthread .libs/lib2.so

if you pass -O4 rather than -O2 to clang I think it will in essence do this all
for you already.  It might even do the link time optimization for you at -O2
even, I'm not sure.

Ciao, Duncan.

>
> Thanks.
>
> Ahmad
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list