diff --git a/ispc.cpp b/ispc.cpp index aab79310..8e34c180 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -1102,10 +1102,13 @@ Target::Target(const char *arch, const char *cpu, const char *isa, bool pic, boo #else /* LLVM 3.7+ */ m_targetMachine->Options.MCOptions.AsmVerbose = true; #endif + +#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 // Change default version of generated DWARF. if (g->generateDWARFVersion != 0) { m_targetMachine->Options.MCOptions.DwarfVersion = g->generateDWARFVersion; } +#endif // Initialize TargetData/DataLayout in 3 steps. // 1. Get default data layout first @@ -1522,7 +1525,9 @@ Globals::Globals() { emitPerfWarnings = true; emitInstrumentation = false; generateDebuggingSymbols = false; +#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 generateDWARFVersion = 0; +#endif enableFuzzTest = false; fuzzTestSeed = -1; mangleFunctionsWithTarget = false; diff --git a/ispc.h b/ispc.h index 773476f1..b4d0e22c 100644 --- a/ispc.h +++ b/ispc.h @@ -612,7 +612,9 @@ struct Globals { // readelf --debug-dump=info object.o | grep -A 2 'Compilation Unit @' // on Mac: // xcrun dwarfdump -r0 object.o +#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 int generateDWARFVersion; +#endif /** If true, function names are mangled by appending the target ISA and vector width to them. */ diff --git a/main.cpp b/main.cpp index 3ede7e43..f59e042f 100644 --- a/main.cpp +++ b/main.cpp @@ -104,7 +104,9 @@ usage(int ret) { #ifdef ISPC_IS_WINDOWS printf(" [--dllexport]\t\t\tMake non-static functions DLL exported. Windows only.\n"); #endif +#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 printf(" [--dwarf-version={2,3,4}]\t\tGenerate source-level debug information with given DWARF version (triggers -g)\n"); +#endif printf(" [--emit-asm]\t\t\tGenerate assembly language file as output\n"); printf(" [--emit-c++]\t\t\tEmit a C++ source file as output\n"); printf(" [--emit-llvm]\t\t\tEmit LLVM bitode file as output\n"); @@ -388,6 +390,7 @@ int main(int Argc, char *Argv[]) { else if (!strcmp(argv[i], "--dllexport")) g->dllExport = true; #endif +#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 else if (!strncmp(argv[i], "--dwarf-version=", 16)) { int val = atoi(argv[i] + 16); if (2 <= val && val <=4) { @@ -398,7 +401,9 @@ int main(int Argc, char *Argv[]) { "only 2, 3 and 4 are allowed.\n", argv[i]+16); usage(1); } - } else if (!strcmp(argv[i], "--print-target")) + } +#endif + else if (!strcmp(argv[i], "--print-target")) g->printTarget = true; else if (!strcmp(argv[i], "--no-omit-frame-pointer")) g->NoOmitFramePointer = true;