Author: dblaikie Date: Fri Apr 28 15:50:25 2017 New Revision: 301684 URL: http://llvm.org/viewvc/llvm-project?rev=301684&view=rev Log: Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
Since -gsplit-dwarf is specified on a backend compile (in ThinLTO parlance) it isn't passed during the frontend compile (because no ELF object/dwo file is produced then), yet the -fno-split-dwarf-inlining value needs to be encoded in the LLVM DebugInfo metadata to have effect... So let it be specified & it'll be silently ignored if -gsplit-dwarf isn't used in the end, otherwise it'll be used on a per-cu basis depending on where it's specified in the frontend compile actions. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/split-debug.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=301684&r1=301683&r2=301684&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Apr 28 15:50:25 2017 @@ -2773,12 +2773,14 @@ void Clang::ConstructJob(Compilation &C, // -gsplit-dwarf should turn on -g and enable the backend dwarf // splitting and extraction. // FIXME: Currently only works on Linux. - if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) { + if (getToolChain().getTriple().isOSLinux()) { if (!splitDwarfInlining) CmdArgs.push_back("-fno-split-dwarf-inlining"); - if (DebugInfoKind == codegenoptions::NoDebugInfo) - DebugInfoKind = codegenoptions::LimitedDebugInfo; - CmdArgs.push_back("-enable-split-dwarf"); + if (SplitDwarfArg) { + if (DebugInfoKind == codegenoptions::NoDebugInfo) + DebugInfoKind = codegenoptions::LimitedDebugInfo; + CmdArgs.push_back("-enable-split-dwarf"); + } } // After we've dealt with all combinations of things that could Modified: cfe/trunk/test/Driver/split-debug.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.c?rev=301684&r1=301683&r2=301684&view=diff ============================================================================== --- cfe/trunk/test/Driver/split-debug.c (original) +++ cfe/trunk/test/Driver/split-debug.c Fri Apr 28 15:50:25 2017 @@ -40,6 +40,13 @@ // CHECK-GMLT-WITH-SPLIT: "-debug-info-kind=line-tables-only" // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file" +// RUN: %clang -target x86_64-unknown-linux-gnu -g -fno-split-dwarf-inlining -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s +// +// CHECK-NOINLINE-WITHOUT-SPLIT-NOT: "-enable-split-dwarf" +// CHECK-NOINLINE-WITHOUT-SPLIT: "-fno-split-dwarf-inlining" +// CHECK-NOINLINE-WITHOUT-SPLIT: "-debug-info-kind=limited" + // RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-GMLT < %t %s // _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits