|
1 | 1 | #include "codegen.h" |
2 | | -#include <llvm/ExecutionEngine/ExecutionEngine.h> |
3 | | -#include <llvm/ExecutionEngine/JITEventListener.h> |
4 | | -#include <llvm/ExecutionEngine/MCJIT.h> |
5 | | -#include <llvm/IR/DiagnosticInfo.h> |
6 | | -#include <llvm/IR/DiagnosticPrinter.h> |
7 | | -#include <llvm/IR/LegacyPassManager.h> |
8 | | -#include <llvm/IR/LLVMContext.h> |
9 | | -#include <llvm/IR/Module.h> |
10 | | -#include <llvm/IR/Verifier.h> |
11 | | -#include <llvm/IRReader/IRReader.h> |
12 | | -#include <llvm/Linker/Linker.h> |
13 | | -#include <llvm-c/Disassembler.h> |
14 | | -#include <llvm/Support/Host.h> |
15 | | -#include <llvm/Support/ManagedStatic.h> |
16 | | -#include <llvm/Support/SourceMgr.h> |
17 | | -#include <llvm/Support/TargetSelect.h> |
18 | | -#include <llvm/Support/Timer.h> |
19 | | -#include <llvm/Support/ErrorHandling.h> |
20 | | -#include <llvm/Transforms/IPO.h> |
21 | | -#include <llvm/Transforms/IPO/PassManagerBuilder.h> |
22 | | -#include <llvm/Transforms/Instrumentation.h> |
23 | | -#include <llvm/Transforms/Instrumentation/AddressSanitizer.h> |
24 | | -#include <llvm/Transforms/Instrumentation/MemorySanitizer.h> |
25 | | -#include <llvm/Transforms/Instrumentation/ThreadSanitizer.h> |
26 | | -#include <llvm/LinkAllPasses.h> |
27 | | - |
| 2 | +#include "codegen_llvm_deps.h" // Y_IGNORE |
28 | 3 | #include <contrib/libs/re2/re2/re2.h> |
29 | 4 |
|
30 | 5 | #include <util/generic/maybe.h> |
@@ -211,10 +186,16 @@ namespace NCodegen { |
211 | 186 |
|
212 | 187 | namespace { |
213 | 188 |
|
214 | | - void FatalErrorHandler(void* user_data, const std::string& reason, bool gen_crash_diag) { |
| 189 | + void FatalErrorHandler(void* user_data, |
| 190 | +#if LLVM_VERSION_MAJOR == 12 |
| 191 | + const std::string& reason |
| 192 | +#else |
| 193 | + const char* reason |
| 194 | +#endif |
| 195 | + , bool gen_crash_diag) { |
215 | 196 | Y_UNUSED(user_data); |
216 | 197 | Y_UNUSED(gen_crash_diag); |
217 | | - ythrow yexception() << "LLVM fatal error: " << reason.c_str(); |
| 198 | + ythrow yexception() << "LLVM fatal error: " << reason; |
218 | 199 | } |
219 | 200 |
|
220 | 201 | void AddAddressSanitizerPasses(const llvm::PassManagerBuilder& builder, llvm::legacy::PassManagerBase& pm) { |
@@ -313,7 +294,9 @@ class TCodegen : public ICodegen, private llvm::JITEventListener { |
313 | 294 | targetOptions.EnableFastISel = true; |
314 | 295 | // init manually, this field was lost in llvm::TargetOptions ctor :/ |
315 | 296 | // make coverity happy |
| 297 | +#if LLVM_VERSION_MAJOR == 12 |
316 | 298 | targetOptions.StackProtectorGuardOffset = 0; |
| 299 | +#endif |
317 | 300 |
|
318 | 301 | std::string what; |
319 | 302 | auto&& engineBuilder = llvm::EngineBuilder(std::move(module)); |
|
0 commit comments