mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Merge remote-tracking branch 'origin/master' into merge-2.104
This commit is contained in:
commit
b97ae0340d
23 changed files with 606 additions and 55 deletions
|
@ -393,8 +393,27 @@ void registerModuleInfo(Module *m) {
|
|||
emitModuleRefToSection(mangle, moduleInfoSym);
|
||||
}
|
||||
}
|
||||
|
||||
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(ModuleMinFlag, "cf-protection-return", 1);
|
||||
}
|
||||
|
||||
if (opts::fCFProtection == opts::CFProtectionType::Branch ||
|
||||
opts::fCFProtection == opts::CFProtectionType::Full) {
|
||||
m.addModuleFlag(ModuleMinFlag, "cf-protection-branch", 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void codegenModule(IRState *irs, Module *m) {
|
||||
TimeTraceScope timeScope("Generate IR", m->toChars(), m->loc);
|
||||
|
||||
|
@ -446,6 +465,8 @@ void codegenModule(IRState *irs, Module *m) {
|
|||
addCoverageAnalysisInitializer(m);
|
||||
}
|
||||
|
||||
addModuleFlags(irs->module);
|
||||
|
||||
gIR = nullptr;
|
||||
irs->dmodule = nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue