I have faced a problem compiling LLVM code on a different architecture. And the main issue I can't solve so far is a different pointer size.
我遇到了在不同架构上编译LLVM代码的问题。到目前为止我无法解决的主要问题是指针大小不同。
clang have always optimize sizeof(void*)
to an actual pointer size on target machine.
clang总是将sizeof(void *)优化为目标机器上的实际指针大小。
Is it really possible to compile C++ to a portable LLVM code or it is only a marketing trick.
是否真的可以将C ++编译为可移植的LLVM代码,或者它只是一种营销手段。
2 个解决方案
#1
5
LLVM bitcode isn't meant to be portable across architectures. It can be in theory but mostly isn't. IIRC this misunderstanding is why LLVM no longer stands for 'Low Level Virtual Machine'.
LLVM bitcode并不意味着可以跨架构移植。它可以在理论上,但主要不是。 IIRC这种误解是LLVM不再代表“低级虚拟机”的原因。
Google's Native Client achieves portability by having the same target ABI for all platforms and then translating that ABI to the underlying platform ABI.
Google的Native Client通过为所有平台提供相同的目标ABI,然后将该ABI转换为底层平台ABI,实现了可移植性。
#2
1
This is a FAQ: http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode . Beyond that, Magnus Hoff's pointers to PNaCl and emscripten are on point.
这是一个FAQ:http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode。除此之外,马格努斯霍夫指向PNaCl和emscripten的指针也很重要。
#1
5
LLVM bitcode isn't meant to be portable across architectures. It can be in theory but mostly isn't. IIRC this misunderstanding is why LLVM no longer stands for 'Low Level Virtual Machine'.
LLVM bitcode并不意味着可以跨架构移植。它可以在理论上,但主要不是。 IIRC这种误解是LLVM不再代表“低级虚拟机”的原因。
Google's Native Client achieves portability by having the same target ABI for all platforms and then translating that ABI to the underlying platform ABI.
Google的Native Client通过为所有平台提供相同的目标ABI,然后将该ABI转换为底层平台ABI,实现了可移植性。
#2
1
This is a FAQ: http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode . Beyond that, Magnus Hoff's pointers to PNaCl and emscripten are on point.
这是一个FAQ:http://llvm.org/docs/FAQ.html#can-i-compile-c-or-c-code-to-platform-independent-llvm-bitcode。除此之外,马格努斯霍夫指向PNaCl和emscripten的指针也很重要。