[LLVMdev] strace for whole-program bitcodes
Timo Juhani Lindfors
timo.lindfors at iki.fi
Thu Oct 15 07:14:35 PDT 2009
Tianwei <tianwei.sheng at gmail.com> writes:
> someone suggested me to use gold-plugin, I know nothing about it yet, I will
> have a try later. Does anyone have a good solution for this problem?
Afaik gold does not help here. I tried it and managed to only generate
native code.
I'm currently investigating an alternative approach to produce
whole-program bitcodes:
1) add /tmp/wrap to PATH
2) create /tmp/wrap/gcc with the following contents
#!/bin/sh
exec llvm-gcc -specs /tmp/wrap/gcc.specs "$@"
3) llvm-gcc -dumpspecs > /tmp/wrap/gcc.specs
4) modify /tmp/wrap/gcc.specs so that it always passes -emit-llvm to cc1
5) modify /tmp/wrap/gcc.specs so that it calls llvm-ld* instead of real
ld and does not pass any unknown flags to it.
With this approach I was able to compile and run airstrike (a 2d
dogfighting game) in bitcode form very transparently with:
$ make-bitcode fakeroot apt-get --build source airstrike
$ sudo dpkg -i airstrike*.deb
$ airstrike
If you are interested I can try to rework my scripts to a shape where
they could be used by somebody else.
(*) I am not actually calling llvm-ld directly. Instead I have an
"llvm-ld-exe" wrapper that calls llvm-ld and then uses "anytoexe" to
pack the resulting bitcode to a shell script that can execute itself with
lli and use the correct -load options.
More information about the llvm-dev
mailing list