[LLVMdev] llvm 32bit with 64bit output?

NAKAMURA Takumi geek4civic at gmail.com
Wed Dec 26 00:10:50 PST 2012


2012/12/21 Flexicat01 <nekroze.lives at gmail.com>:
> I am looking at starting a project to make a toy language that is targeted
> purely at 64bit windows. I have never used llvm or anything like it i am
> just trying to learn new things.
>
> However there are several problems, as far as i have seen, with compiling
> llvm in 64bit on windows. So i was wondering if i compile a 32bit version of
> llvm and use that can my resulting compiler output 64bit binaries?

It would be possible with targetting x86_64-w64-mingw32, if you live
on cygwin or mingw-w64.
Note, JIT would not work with i686 binary. You shall build llvm with
x64 compilers (msvc x64, x86_64-w64-mingw32-g++) if you would use x64
JIT.

Currently, you will need x86_64-w64-mingw32's binutils, esp, ld.exe.
"LLVM" does not have linker driver or such. You will need to invoke
ld.exe in your application.

Depends on which host your application is built, cygwin, i686-mingw,
x86-64-mingw;

  - Seek "mingw-w64"
  - Install mingw-w64 binutils on cygwin. You may find
x86_64-w64-mingw32-ld.exe then.

> Secondary question, should i use mingw or msvc to build llvm and my
> compiler? i would like to use cygwin mingw but i think that still makes the
> resulting binaries require cygwin1.dll but not sure if there is a way to get
> out of that.

Theologically, llvm can be built for i686-mingw32 (free from
cygwin1.dll) on cygwin, like cross build.
I have not tried on cygwin.

/path/to/configure --host=i686-pc-mingw32 --build=i686-pc-cygwin

You may also try "MSYS", targetting for i686-mingw32, like subset of cygwin.

> EDIT: To clarify i dont mind if i have to use cygwin (normal cygwin gcc or
> mingw) solong as the binary my compiler outputs does not require cygwin1.dll
> then i am happy. The compiler requiring cygwin1.dll is not so much of a
> problem for me i just want my toy language/compiler to be win64 binaries
> that do not require the cygwin1.dll.

As I mentioned above, you would need x64 JIT (built with x64) or
x64-aware linker.
In most cases, generated binaries would not need cygwin1.dll, but some
runtime libraries.

I suggest you to play with x86_64-w64-mingw32-gcc.exe on cygwin, at first.


ps. personally, I have not tested x86_64-mingw32 for one year. I am
afraid if it might be broken.


...Takumi



More information about the llvm-dev mailing list