Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanEngelen committed Jul 11, 2023
1 parent e452d59 commit f756c1c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gen/modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,20 @@ void registerModuleInfo(Module *m) {
}

void addModuleFlags(llvm::Module &m) {
#if LDC_LLVM_VER >= 1500
const auto ModuleMinFlag = llvm::Module::Min;
#else
const auto ModuleMinFlag = llvm::Module::Warning; // Fallback value
#endif

if (opts::fCFProtection == opts::CFProtectionType::Return ||
opts::fCFProtection == opts::CFProtectionType::Full) {
m.addModuleFlag(llvm::Module::Min, "cf-protection-return", 1);
m.addModuleFlag(ModuleMinFlag, "cf-protection-return", 1);
}

if (opts::fCFProtection == opts::CFProtectionType::Branch ||
opts::fCFProtection == opts::CFProtectionType::Full) {
m.addModuleFlag(llvm::Module::Min, "cf-protection-branch", 1);
m.addModuleFlag(ModuleMinFlag, "cf-protection-branch", 1);
}
}

Expand Down

0 comments on commit f756c1c

Please sign in to comment.