Do not add DWARF version before LLVM 3.5

This commit is contained in:
Dmitry Babokin
2016-07-04 16:37:46 +03:00
parent 528f6cef1c
commit c6ae79cbc8
3 changed files with 13 additions and 1 deletions

View File

@@ -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;

2
ispc.h
View File

@@ -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. */

View File

@@ -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;