[llvm-dev] Port to other Operating Systems

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 11 15:24:39 PDT 2016


As part of our port of OpenVMS to x86-64, we are using LLVM with our own frontends on OpenVMS Itanium.  We are writing a converter between our old backend's IR and the LLVM IR.  We can cross-compile (hosted on OpenVMS Itanium) and link/execute on x86-64 CentOS.  At present, we pass over 88% of our C test suite. 

Porting starts with being able to compile the code.  Since we are stuck with a C++03 (sorta) compiler that uses an EDG frontend and the Intel Itanium backend, we had to start with an older LLVM release that did not use C++11 source code.  We went with 3.4.2.

I was able to build LLVM 3.4.2 with our old C++ compiler with little issues (I think I had to add about 5 or so "#ifdef __vms" to some modules in lib/Support).  There were a handful of missing RTL interfaces due to OpenVMS not having complete C99 header support (that is being worked on now).  I wrote a bunch of empty jackets to work around the missing symbols.  So far, I haven't had to come back and fill in ANY of them (I'm sure I will bump into them at some point).

And we'll build clang 3.4.2 using the same old C++ compiler and then hopefully once we have working OpenVMS x86 systems, I can use that clang to cross-compile a newer clang/LLVM pair (perhaps in several small step or all at once - we'll just wing it).  And we'll need a working cmake on OpenVMS by that time.  From peeking at the code, that might be the harder part.  We might have to just grab cmake generated Makefile's from a Linux box and hack our way to daylight.  Do you have cmake?  Do you have some sort of bash shell and gnu tools?  (OpenVMS has a "GNV" package with a bash shell, fileutils, diffutils, make, grep, awk, etc. which really reduces the effort)

Compiling the code is just a start however.  You'll eventually want to link those objects you create.  What OS are you using and what hardware platform?

> -----Original Message-----
> From: Robinson, Paul [mailto:paul.robinson at sony.com]
> Sent: Tuesday, October 11, 2016 4:43 PM
> To: Dee Sharpe
> Cc: llvm-dev at lists.llvm.org; John Reagan
> Subject: RE: [llvm-dev] Port to other Operating Systems
> 
> 
> 
> > -----Original Message-----
> > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of
> > Dee Sharpe via llvm-dev
> > Sent: Tuesday, October 11, 2016 8:23 AM
> > To: llvm-dev at lists.llvm.org
> > Subject: [llvm-dev] Port to other Operating Systems
> >
> > Hello all,
> >
> > Pardon me if this has already been covered elsewhere, however I have
> > not been able to find such documentation. Is there a consolidated set
> > of documentation that clearly explains what's necessary to port LLVM
> > to other OSes & how to add support for building executables (&
> > libraries) for those OSes? I'm searching through the source in an
> > attempt to understand what needs to be done, but this codebase isn't
> the most simple of codebases.
> > Thanks for any potential help!
> 
> I assume you are interested in hosts (not targets).  I'm not aware of
> any documentation per se.  If your host OS is not Unix-like or Windows-
> like, it will probably take some doing.  The first hurdle I can imagine
> is just getting the build system to work for you; we use CMake, which
> might or might not support your OS out of the box.  After that you'd
> likely need to do some work in the source itself; we try to isolate
> much of the platform-dependent stuff in llvm/lib/Support but I think
> there are some other places scattered around that are still under
> conditional compilation.
> 
> +John Reagan who is point man for a project to (ultimately) bootstrap
> Clang for OpenVMS.  He might have a better idea what's needed, although
> last I talked to him they were going to use cross-compilation for quite
> some time.
> 
> Hope this helps,
> --paulr
> 
> >
> > Regards,
> > Apollo D. Sharpe, Sr.
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev




More information about the llvm-dev mailing list