summaryrefslogtreecommitdiffstats
path: root/clang/tools/driver/cc1as_main.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-06-23 15:34:16 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-06-23 15:34:16 +0000
commitd064e91eceb97bdf1fc7b24af1b849f265828318 (patch)
tree86621526ecb487edf82af9e153005e82e3fedb0c /clang/tools/driver/cc1as_main.cpp
parent021f32fd0f85bab169c4f1983a5c1ad1bf4c665e (diff)
downloadbcm5719-llvm-d064e91eceb97bdf1fc7b24af1b849f265828318.tar.gz
bcm5719-llvm-d064e91eceb97bdf1fc7b24af1b849f265828318.zip
Revert "Revert r305164/5/7."
Restore the `-gz` option to the driver with some minor tweaks to handle the additional case for `-Wa,--compress-debug-sections`. This intends to make the compression of the debug information controllable from the driver. The following is the behaviour: -gz enable compression (ambiguous for format, will default to zlib-gnu) -gz=none disable compression -gz=zlib-gnu enable compression (deprecated GNU style zlib compression) -gz=zlib enable compression (zlib based compression) Although -Wa,-compress-debug-sections works, it should be discouraged when using the driver to invoke the assembler. However, we permit the assembler to accept the GNU as style argument --compress-debug-sections to maintain compatibility. Note, -gz/-gz= does *NOT* imply -g. That is, you need to additionally specific -g for debug information to be generated. llvm-svn: 306115
Diffstat (limited to 'clang/tools/driver/cc1as_main.cpp')
-rw-r--r--clang/tools/driver/cc1as_main.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index 37c14f4a26e..2fc2b508ef2 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -202,9 +202,22 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
Opts.SaveTemporaryLabels = Args.hasArg(OPT_msave_temp_labels);
// Any DebugInfoKind implies GenDwarfForAssembly.
Opts.GenDwarfForAssembly = Args.hasArg(OPT_debug_info_kind_EQ);
- // TODO: base this on -gz instead
- if (Args.hasArg(OPT_compress_debug_sections))
- Opts.CompressDebugSections = llvm::DebugCompressionType::GNU;
+
+ if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections,
+ OPT_compress_debug_sections_EQ)) {
+ if (A->getOption().getID() == OPT_compress_debug_sections) {
+ // TODO: be more clever about the compression type auto-detection
+ Opts.CompressDebugSections = llvm::DebugCompressionType::GNU;
+ } else {
+ Opts.CompressDebugSections =
+ llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
+ .Case("none", llvm::DebugCompressionType::None)
+ .Case("zlib", llvm::DebugCompressionType::Z)
+ .Case("zlib-gnu", llvm::DebugCompressionType::GNU)
+ .Default(llvm::DebugCompressionType::None);
+ }
+ }
+
Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
OpenPOWER on IntegriCloud