From f756c1cfd57a0d83afb5f3eb03171f617e5a2894 Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Tue, 11 Jul 2023 23:39:45 +0200 Subject: [PATCH] fixup --- gen/modules.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gen/modules.cpp b/gen/modules.cpp index 5893b586926..54412fd1dee 100644 --- a/gen/modules.cpp +++ b/gen/modules.cpp @@ -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); } }