Kenia Kuo
2012-Sep-25 13:22 UTC
[LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
Hi, I'm using clang to build my project as follows: $ clang++ -ccc-host-triple arm-none-linux-gnueabi --sysroot=/usr/local/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/ -o foo.o -emit-llvm -c foo.cpp $ clang++ -ccc-host-triple arm-none-linux-gnueabi --sysroot=/usr/local/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/ -o main.o -emit-llvm -c main.cpp $ llvm-link foo.o main.o -o *main.bc* $ llc main.bc -o main.ARM.s $ arm-none-linux-gnueabi-g++ main.ARM.s -o main.ARM 1. Can clang generate the same bitcode (*main.bc *in the above example) with the toolchains that have same version of libraries but different targets? 2. Is there any possibility that the generated bitcode with the ARM toolchain (*main.bc *in the above example) can be compiled to another platform, like PowerPC or mips? Currently, I tried the toolchains of ARM and PowerPC that have the different versions of libraries, obviously the generated bitcode are different. So I wonder whether the version of library is the only reason why the generated bitcode are different. Thanks, Kenia Kuo -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120925/f9587a4e/attachment.html>
Óscar Fuentes
2012-Sep-25 13:38 UTC
[LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
Kenia Kuo <kenkillerkuo at gmail.com> writes: [snip]> Currently, I tried the toolchains of ARM and PowerPC that have the > different versions of libraries, obviously the generated bitcode are > different. > So I wonder whether the version of library is the only reason why the > generated bitcode are different.http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode
Kenia Kuo
2012-Sep-25 14:49 UTC
[LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
Hi Óscar, Thank you for your reply. It looks like the limitations are the platform's API and ABI (included the size of variable). So, if there are two platforms that have the same API, ABI but different ISAs, the bitcode can be shared. Can I say that? Thanks, Kenia Kuo 2012/9/25 Óscar Fuentes <ofv at wanadoo.es>> Kenia Kuo <kenkillerkuo at gmail.com> writes: > > [snip] > > > Currently, I tried the toolchains of ARM and PowerPC that have the > > different versions of libraries, obviously the generated bitcode are > > different. > > So I wonder whether the version of library is the only reason why the > > generated bitcode are different. > > > http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120925/72fb6a1f/attachment.html>
Kenia Kuo
2012-Sep-25 17:08 UTC
[LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
Hi David, Thank you for your reply. In fact, my question originally came from the google native client. I thought that the bitcode can be shared among the different targets as it inherently is. Therefore, I used the clang to generate the bitcode to prove that my thought is right, and I supposed that the different bitcode caused from the different versions of libraries before. Thanks for the above answering, I know the limitations of sharing the bitcode now. Best regards, Kenia 2012/9/26 David Tweed <david.tweed at arm.com>> Hi Kenia,**** > > ** ** > > What you might be trying to end up with (rather than the question you're > directly asking J ) is a platform independent compiled representation.**** > > (Of course you might be aiming to do something else, like a cross-platform > compile farm, in which case I have no input...)**** > > If this is the goal, the google native client team are working on PNaCl, > which is (in addition to "safety properties") designed to be**** > > platform independent**** > > ** ** > > > http://www.chromium.org/nativeclient/pnacl/building-and-testing-portable-native-client > **** > > ** ** > > I've not kept up with this project, but I believe that this is only > achieved by considering all the possible ABIs of the targets and**** > > ensuring enough information is provided so that the final to-native > compilation stage can resolve everything, so it's more like "bitcode able > to accommodate**** > > all the listed targets" rather than "bitcode that's target independent".** > ** > > ** ** > > HTH,**** > > Dave**** > > ** ** > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *Kenia Kuo > *Sent:* 25 September 2012 15:49 > *To:* Óscar Fuentes > *Cc:* llvmdev at cs.uiuc.edu > *Subject:* Re: [LLVMdev] Can clang generate the same bitcode with the > toolchains that have same version of libraries but different targets**** > > ** ** > > Hi Óscar,**** > > Thank you for your reply.**** > > ** ** > > It looks like the limitations are the platform's API and ABI (included the > size of variable).**** > > So, if there are two platforms that have the same API, ABI but different > ISAs, the bitcode can be shared. Can I say that?**** > > ** ** > > Thanks,**** > > Kenia Kuo**** > > ** ** > > 2012/9/25 Óscar Fuentes <ofv at wanadoo.es>**** > > Kenia Kuo <kenkillerkuo at gmail.com> writes: > > [snip]**** > > > > Currently, I tried the toolchains of ARM and PowerPC that have the > > different versions of libraries, obviously the generated bitcode are > > different. > > So I wonder whether the version of library is the only reason why the > > generated bitcode are different.**** > > > http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode > **** > > ** ** >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120926/5cff628b/attachment.html>
Hi, I am interested in building some large projects to get single .bc files. Is there an easy way to do this? Or do I have to go through and understand the whole makefile script? Thank you very much. Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/109cb363/attachment.html>
On Thu, Nov 1, 2012 at 10:04 PM, Zhoujinguo <zhoujinguo1988 at yahoo.cn> wrote:> Hi, > > I am interested in building some large projects to get single .bc files. > Is there an easy way to do this? Or do I have to go through and understand > the whole makefile script? >This is what LLVM's "LTO" (Link Time Optimization) does, basically. This is triggered by building with -O4 and you'd need to use an LTO-aware linker (like gold) to handle the link step. I'm not sure how you'd actually dump out bitcode from the linker, rather than a final binary - but that's more-or-less where you'd get involved. I realize this is a bit vague (as I'm by no means an expert on the matter) but thought it might be at least a pointer to some ideas/approach. - David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121101/4582dd34/attachment.html>
Possibly Parallel Threads
- [LLVMdev] How can I build Mysql and Apache using LLVM
- [LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
- [LLVMdev] Problem on instrumentation
- [LLVMdev] Problem on instrumentation
- [LLVMdev] Instrumentation with liblto and gold