I have built a whole-program bitcode file for openldap-2.19

Hi,all

I have written a wrapper which includes gcc/g++,ld and llvm counterparts, it invokes native or llvm compiler and linker according to the options it receives,after I replace the native tools with my wrapper in libtool script, I just typed like this

make CC=wrapper AC_CFLAGS=-emit-llvm

then I got a bc file of slapd and other tools in clients directory

The accessory is the whole-program bitcode file of slapd

(My platform is Fedora11 x86_64+E6300)

the method can also be applied to many GNU projects but there may be some other problems when I treat to BIND,I’m checking it…

Thank you

slapd.bc (2.54 MB)

I have written a wrapper which includes gcc/g++,ld and llvm counterparts,
it invokes native or llvm compiler and linker according to the options it
receives,after I replace the native tools with my wrapper in libtool
script, I just typed like this

make CC=wrapper AC_CFLAGS=-emit-llvm

then I got a bc file of slapd and other tools in clients directory

The accessory is the whole-program bitcode file of slapd

(My platform is Fedora11 x86_64+E6300)

the method can also be applied to many GNU projects but there may be some
other problems when I treat to BIND,I'm checking it..

Thank you

Are you able to post the wrapper some place? I'm interested in comparing this against the gold-plugin method.

I haven't test it completely for Apache , when I finish that I will post it ASAP.

BTW, Have you archieved the same goal with gold-plugin???I once tried it but just got a failure for llvm tools is not completely compatible with GNU ones.

BTW, Have you archieved the same goal with gold-plugin???I once tried it but just got a failure for llvm tools is not completely compatible with GNU ones.

Do you remember what was the failure?

Cheers,

I’m not completely sure but something like the build system will still call the native linker when it meets a LLVM object file which causes an error.

I once tried to modify the codes of gold-plugin, but the trouble is still there,I think we should hack collect2 of llvm-gcc to make it invoke llvm-ld automatically when it receive the -emit-llvm option(I once tried this, but I found that even llvm-gcc has received such a option it will not pass it to -emit-llvm, I attempted to do something on llvm-gcc,but I’m not familiar with GCC’s src)

2009/10/31 Rafael Espindola <espindola@google.com>

I'm not completely sure but something like the build system will still call
the native linker when it meets a LLVM object file which causes an error.

That is what the gold plugin is for. It makes gold able to handle .o files
with LLVM IL.

I once tried to modify the codes of gold-plugin, but the trouble is still
there,I think we should hack collect2 of llvm-gcc to make it invoke llvm-ld
automatically when it receive the -emit-llvm option(I once tried this, but I
found that even llvm-gcc has received such a option it will not pass it to
-emit-llvm, I attempted to do something on llvm-gcc,but I'm not familiar
with GCC's src)

Do you remember if the problem was wen using static libraries (.a)?
For that to work ar also has to understand LLVM IL. That is possible
in recent binutils by building with --enable-plugins and coping
the llvm plugin to the install directory.

Cheers,