www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can LDC compile to supported legacy LLVM versions?

reply Dukc <ajieskola gmail.com> writes:
I have recenty updated my LDC to the most recent version (1.14). 
The problem is that it compiles to LLVM code version 7.0.1, but I 
need it to compile to LLVM 6.x.x or LLVM 5.x.x. The last release 
note said that LLVM versions from 3.something.something are 
supported, but does this mean only linking to them, or also 
compiling to them?

If it can be done, how? Thanks.
Jan 28
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Monday, 28 January 2019 at 11:37:56 UTC, Dukc wrote:
 I have recenty updated my LDC to the most recent version 
 (1.14). The problem is that it compiles to LLVM code version 
 7.0.1, but I need it to compile to LLVM 6.x.x or LLVM 5.x.x. 
 The last release note said that LLVM versions from 
 3.something.something are supported, but does this mean only 
 linking to them, or also compiling to them?

 If it can be done, how? Thanks.
Do you mean bitcode, LLVM IR or something different? The LDC built against a given version of LLVM can link to bitcode/compile LLMV IR, of that version. Lowest LLVM it can be compiled against is 3.9. LDC's releases are compiled against 7.0.1, but that doesn't stop you downloading a release of the desired LLVM version and compiling LDC against that. All you need is a semi-recent CMake. Just git clone from our github and run cmake, you'll need to provide the location of the llvm-config binary as LLVM_CONFIG but thats it.
Jan 28
parent Dukc <ajieskola gmail.com> writes:
On Monday, 28 January 2019 at 13:04:08 UTC, Nicholas Wilson wrote:
 Do you mean bitcode, LLVM IR or something different? The LDC 
 built against a given version of LLVM can link to 
 bitcode/compile LLMV IR, of that version.
Bitcode in this case, but I think your following answer applies to IR/assembly/binary too.
 Lowest LLVM it can be compiled against is 3.9. LDC's releases 
 are compiled against 7.0.1, but that doesn't stop you 
 downloading a release of the desired LLVM version and compiling 
 LDC against that.

 All you need is a semi-recent CMake. Just git clone from our 
 github and run cmake, you'll need to provide the location of 
 the llvm-config binary as LLVM_CONFIG but thats it.
Okay, that answers it. Thank you.
Jan 28