Chris Lattner
2006-Nov-21 16:58 UTC
[LLVMdev] libstdc++ as bytecode, and compiling C++ to C
On Tue, 21 Nov 2006, Emil Mikulic wrote:> LLVMers, given the same endianness and pointersize, can one mix and > match LLVM bytecode files produced on different platforms?No, not in general. For example, on the mac, printf it often #defined to printf$ldbl, which doesn't exist on linux. System headers generally foil the ability to move stuff around like that. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Pertti Kellomäki
2006-Nov-22 08:20 UTC
[LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
Chris Lattner wrote:> On Tue, 21 Nov 2006, Emil Mikulic wrote: >> LLVMers, given the same endianness and pointersize, can one mix and >> match LLVM bytecode files produced on different platforms? > > No, not in general. For example, on the mac, printf it often #defined to > printf$ldbl, which doesn't exist on linux. System headers generally foil > the ability to move stuff around like that.Aside from stuff that depends on system headers, are there any other dependencies on the host system? In other words, will llvm-gcc produce exactly the same byte code for a given set of source files regardless of where compilation takes place? This has obvious implications on using LLVM as a cross compiler and on how libraries can be distributed. -- Pertti
Chris Lattner
2006-Nov-23 08:46 UTC
[LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
On Wed, 22 Nov 2006, [ISO-8859-1] Pertti Kellom�ki wrote:> Aside from stuff that depends on system headers, are there any other > dependencies on the host system? In other words, will llvm-gcc produce > exactly the same byte code for a given set of source files regardless of > where compilation takes place? This has obvious implications onYes. Many aspects of the target compiler can leak through. One trivial example is: int X = sizeof(long); gcc evaluates 'sizeof' before LLVM gets control, therefore the var will get initialized with 8 or 4 depending on the target. Another example is code like: #ifdef __POWERPC__ int X = 1; #else int X = 0; #endif There are many other examples. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Maybe Matching Threads
- [LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
- [LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
- [LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
- [LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)
- [LLVMdev] Byte code portability (was Re: libstdc++ as bytecode, and compiling C++ to C)