Support AOT compiler with LLVM 17 (#2567)

Adapt API usage to new interfaces where applicable, including LLVM function
usage, obsoleted llvm::Optional type and removal of unavailable headers.

Know issues:
- AOT static PGO isn't enabled
- LLVM JIT may run failed due to llvm_orc_registerEHFrameSectionWrapper
  isn't linked into iwasm
This commit is contained in:
Alfred E. Neumayer
2023-09-25 13:00:46 +02:00
committed by GitHub
parent f474f3d668
commit 99b47fd334
5 changed files with 57 additions and 3 deletions

View File

@ -4,8 +4,10 @@
*/
#include <llvm-c/TargetMachine.h>
#if LLVM_VERSION_MAJOR < 17
#include <llvm/ADT/None.h>
#include <llvm/ADT/Optional.h>
#endif
#include <llvm/IR/Instructions.h>
#if LLVM_VERSION_MAJOR >= 14
#include <llvm/MC/TargetRegistry.h>
@ -18,6 +20,13 @@
#include "aot_llvm_extra2.h"
#if LLVM_VERSION_MAJOR >= 17
namespace llvm {
template<typename T>
using Optional = std::optional<T>;
}
#endif
static llvm::Optional<llvm::Reloc::Model>
convert(LLVMRelocMode reloc_mode)
{