r204959 - Support for -Wa,-compress-debug-sections.
David Blaikie
dblaikie at gmail.com
Thu Mar 27 13:47:31 PDT 2014
Author: dblaikie
Date: Thu Mar 27 15:47:30 2014
New Revision: 204959
URL: http://llvm.org/viewvc/llvm-project?rev=204959&view=rev
Log:
Support for -Wa,-compress-debug-sections.
Also, while I'm here, support -nocompress-debug-sections too.
Modified:
cfe/trunk/include/clang/Driver/CC1AsOptions.td
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/integrated-as.s
cfe/trunk/tools/driver/cc1as_main.cpp
Modified: cfe/trunk/include/clang/Driver/CC1AsOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.td?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1AsOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CC1AsOptions.td Thu Mar 27 15:47:30 2014
@@ -83,6 +83,9 @@ def mrelax_all : Flag<["-"], "mrelax-all
def mno_exec_stack : Flag<["-"], "mnoexecstack">,
HelpText<"Mark the file as not needing an executable stack">;
+def compress_debug_sections : Flag<["-"], "compress-debug-sections">,
+ HelpText<"Compress DWARF debug sections using zlib">;
+
def g : Flag<["-"], "g">, HelpText<"Generate source level debug information">;
def fdebug_compilation_dir : Separate<["-"], "fdebug-compilation-dir">,
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Mar 27 15:47:30 2014
@@ -190,6 +190,8 @@ def mlimit_float_precision : Separate<["
HelpText<"Limit float precision to the given value">;
def mno_exec_stack : Flag<["-"], "mnoexecstack">,
HelpText<"Mark the file as not needing an executable stack">;
+def compress_debug_sections : Flag<["-"], "compress-debug-sections">,
+ HelpText<"Compress DWARF debug sections using zlib">;
def split_stacks : Flag<["-"], "split-stacks">,
HelpText<"Try to use a split stack if possible.">;
def mno_zero_initialized_in_bss : Flag<["-"], "mno-zero-initialized-in-bss">,
Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Thu Mar 27 15:47:30 2014
@@ -29,6 +29,7 @@ CODEGENOPT(Name, Bits, Default)
#endif
CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
+CODEGENOPT(CompressDebugSections, 1, 0) //< -Wa,-compress-debug-sections
CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink
CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm.
CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe.
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Mar 27 15:47:30 2014
@@ -443,6 +443,9 @@ TargetMachine *EmitAssemblyHelper::Creat
if (CodeGenOpts.DisableIntegratedAS)
Options.DisableIntegratedAS = true;
+ if (CodeGenOpts.CompressDebugSections)
+ Options.CompressDebugSections = true;
+
// Set frame pointer elimination mode.
if (!CodeGenOpts.DisableFPElim) {
Options.NoFramePointerElim = false;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 27 15:47:30 2014
@@ -1724,6 +1724,7 @@ static void CollectArgsForIntegratedAsse
// When using an integrated assembler, translate -Wa, and -Xassembler
// options.
+ bool CompressDebugSections = false;
for (arg_iterator it = Args.filtered_begin(options::OPT_Wa_COMMA,
options::OPT_Xassembler),
ie = Args.filtered_end(); it != ie; ++it) {
@@ -1749,7 +1750,10 @@ static void CollectArgsForIntegratedAsse
CmdArgs.push_back("-mnoexecstack");
} else if (Value == "-compress-debug-sections" ||
Value == "--compress-debug-sections") {
- D.Diag(diag::warn_missing_debug_compression);
+ CompressDebugSections = true;
+ } else if (Value == "-nocompress-debug-sections" ||
+ Value == "--nocompress-debug-sections") {
+ CompressDebugSections = false;
} else if (Value.startswith("-I")) {
CmdArgs.push_back(Value.data());
// We need to consume the next argument if the current arg is a plain
@@ -1762,6 +1766,8 @@ static void CollectArgsForIntegratedAsse
}
}
}
+ if (CompressDebugSections)
+ CmdArgs.push_back("-compress-debug-sections");
}
// Until ARM libraries are build separately, we have them all in one library
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Mar 27 15:47:30 2014
@@ -447,6 +447,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
Opts.InstrumentForProfiling = Args.hasArg(OPT_pg);
Opts.EmitOpenCLArgMetadata = Args.hasArg(OPT_cl_kernel_arg_info);
+ Opts.CompressDebugSections = Args.hasArg(OPT_compress_debug_sections);
Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
Opts.LinkBitcodeFile = Args.getLastArgValue(OPT_mlink_bitcode_file);
Opts.SanitizerBlacklistFile = Args.getLastArgValue(OPT_fsanitize_blacklist);
Modified: cfe/trunk/test/Driver/integrated-as.s
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/integrated-as.s?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/test/Driver/integrated-as.s (original)
+++ cfe/trunk/test/Driver/integrated-as.s Thu Mar 27 15:47:30 2014
@@ -31,10 +31,7 @@
// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG %s
// RUN: %clang -### -c -integrated-as -Wa,--compress-debug-sections %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG %s
-// COMPRESS_DEBUG: warning: DWARF compression is not implemented
-// COMPRESS_DEBUG: -cc1as
+// COMPRESS_DEBUG: "-compress-debug-sections"
-// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections -Wno-missing-debug-compression %s 2>&1 | FileCheck --check-prefix=COMPRESS_DEBUG_QUIET %s
-// COMPRESS_DEBUG_QUIET-NOT: warning: DWARF compression is not implemented
-// COMPRESS_DEBUG_QUIET-NOT: warning: argument unused during compilation
-// COMPRESS_DEBUG_QUIET: -cc1as
+// RUN: %clang -### -c -integrated-as -Wa,-compress-debug-sections -Wa,-nocompress-debug-sections %s 2>&1 | FileCheck --check-prefix=NOCOMPRESS_DEBUG %s
+// NOCOMPRESS_DEBUG-NOT: "-compress-debug-sections"
Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=204959&r1=204958&r2=204959&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Mar 27 15:47:30 2014
@@ -85,6 +85,7 @@ struct AssemblerInvocation {
unsigned NoInitialTextSection : 1;
unsigned SaveTemporaryLabels : 1;
unsigned GenDwarfForAssembly : 1;
+ unsigned CompressDebugSections : 1;
std::string DwarfDebugFlags;
std::string DwarfDebugProducer;
std::string DebugCompilationDir;
@@ -186,6 +187,7 @@ bool AssemblerInvocation::CreateFromArgs
Opts.NoInitialTextSection = Args->hasArg(OPT_n);
Opts.SaveTemporaryLabels = Args->hasArg(OPT_msave_temp_labels);
Opts.GenDwarfForAssembly = Args->hasArg(OPT_g);
+ Opts.CompressDebugSections = Args->hasArg(OPT_compress_debug_sections);
Opts.DwarfDebugFlags = Args->getLastArgValue(OPT_dwarf_debug_flags);
Opts.DwarfDebugProducer = Args->getLastArgValue(OPT_dwarf_debug_producer);
Opts.DebugCompilationDir = Args->getLastArgValue(OPT_fdebug_compilation_dir);
@@ -318,6 +320,8 @@ static bool ExecuteAssembler(AssemblerIn
Ctx.setCompilationDir(Opts.DebugCompilationDir);
if (!Opts.MainFileName.empty())
Ctx.setMainFileName(StringRef(Opts.MainFileName));
+ if (Opts.CompressDebugSections)
+ MAI->setCompressDebugSections(true);
// Build up the feature string from the target feature list.
std::string FS;
More information about the cfe-commits
mailing list