summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/Clang.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-03-28 08:24:00 +0000
committerFangrui Song <maskray@google.com>2019-03-28 08:24:00 +0000
commitee957e045f526ce45d24b0f081f277262c3da43d (patch)
tree384ced5c309e22d9d30d38e67f02952190962171 /clang/lib/Driver/ToolChains/Clang.cpp
parentf896785cb72a1bc991e81386aa0ccc6c338b75e0 (diff)
downloadbcm5719-llvm-ee957e045f526ce45d24b0f081f277262c3da43d.tar.gz
bcm5719-llvm-ee957e045f526ce45d24b0f081f277262c3da43d.zip
[Driver] Allow -gsplit-dwarf on ELF OSes other than Linux and Fuchsia
In gcc, -gsplit-dwarf is handled in gcc/gcc.c as a spec (ASM_FINAL_SPEC): objcopy --extract-dwo + objcopy --strip-dwo. In gcc/opts.c, -gsplit_dwarf has the same semantic of a -g. Except for the availability of the external command 'objcopy', nothing precludes the feature working on other ELF OSes. llvm doesn't use objcopy, so it doesn't have to exclude other OSes. llvm-svn: 357150
Diffstat (limited to 'clang/lib/Driver/ToolChains/Clang.cpp')
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 00b9a7868a0..78f186c019b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3260,8 +3260,7 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// -gsplit-dwarf should turn on -g and enable the backend dwarf
// splitting and extraction.
- // FIXME: Currently only works on Linux and Fuchsia.
- if (T.isOSLinux() || T.isOSFuchsia()) {
+ if (T.isOSBinFormatELF()) {
if (!SplitDWARFInlining)
CmdArgs.push_back("-fno-split-dwarf-inlining");
@@ -4077,7 +4076,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Add the split debug info name to the command lines here so we
// can propagate it to the backend.
bool SplitDWARF = (DwarfFission != DwarfFissionKind::None) &&
- (RawTriple.isOSLinux() || RawTriple.isOSFuchsia()) &&
+ TC.getTriple().isOSBinFormatELF() &&
(isa<AssembleJobAction>(JA) || isa<CompileJobAction>(JA) ||
isa<BackendJobAction>(JA));
const char *SplitDWARFOut;
@@ -6134,8 +6133,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
const llvm::Triple &T = getToolChain().getTriple();
Arg *A;
- if ((getDebugFissionKind(D, Args, A) == DwarfFissionKind::Split) &&
- (T.isOSLinux() || T.isOSFuchsia())) {
+ if (getDebugFissionKind(D, Args, A) == DwarfFissionKind::Split &&
+ T.isOSBinFormatELF()) {
CmdArgs.push_back("-split-dwarf-file");
CmdArgs.push_back(SplitDebugName(Args, Input, Output));
}
OpenPOWER on IntegriCloud