1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added Android support, and generalized target triple support

Added PICLevel, RelocKind
DarwinCommon/LinuxCommon/AndroidCommon merged into PosixCommon
Mangling changed to avoid '@'
This commit is contained in:
Brian Fiete 2019-10-23 07:12:36 -07:00
parent 7a27ab75bf
commit 3883a3674d
39 changed files with 3457 additions and 5636 deletions

View file

@ -4009,9 +4009,44 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
llvm::Optional<llvm::Reloc::Model> relocModel;
llvm::CodeModel::Model cmModel = llvm::CodeModel::Small;
switch (codeGenOptions.mRelocType)
{
case BfRelocType_Static:
relocModel = llvm::Reloc::Model::DynamicNoPIC;
break;
case BfRelocType_PIC:
relocModel = llvm::Reloc::Model::PIC_;
break;
case BfRelocType_DynamicNoPIC:
relocModel = llvm::Reloc::Model::DynamicNoPIC;
break;
case BfRelocType_ROPI:
relocModel = llvm::Reloc::Model::ROPI;
break;
case BfRelocType_RWPI:
relocModel = llvm::Reloc::Model::RWPI;
break;
case BfRelocType_ROPI_RWPI:
relocModel = llvm::Reloc::Model::ROPI_RWPI;
break;
}
switch (codeGenOptions.mPICLevel)
{
case BfPICLevel_Not:
mLLVMModule->setPICLevel(llvm::PICLevel::Level::NotPIC);
break;
case BfPICLevel_Small:
mLLVMModule->setPICLevel(llvm::PICLevel::Level::SmallPIC);
break;
case BfPICLevel_Big:
mLLVMModule->setPICLevel(llvm::PICLevel::Level::BigPIC);
break;
}
std::unique_ptr<llvm::TargetMachine> target(
theTarget->createTargetMachine(theTriple.getTriple(), cpuName.c_str(), featuresStr.c_str(),
Options, relocModel, cmModel, optLvl));
Options, relocModel, cmModel, optLvl));
std::error_code EC;
llvm::sys::fs::OpenFlags OpenFlags = llvm::sys::fs::F_None;
@ -4188,6 +4223,11 @@ void BfIRCodeGen::StaticInit()
LLVMInitializeX86AsmParser();
LLVMInitializeX86Disassembler();
LLVMInitializeARMTargetInfo();
LLVMInitializeARMTarget();
LLVMInitializeARMTargetMC();
LLVMInitializeARMAsmPrinter();
LLVMInitializeAArch64TargetInfo();
LLVMInitializeAArch64Target();
LLVMInitializeAArch64TargetMC();