diff options
author | Fangrui Song <i@maskray.me> | 2020-10-19 23:05:26 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-10-19 23:06:33 -0700 |
commit | 2484e9159c54def19aac69c4a217a55329da54d2 (patch) | |
tree | 015cdb94f36619585099605538bef3eba9027c42 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | f97ca48b1cbbf5da065e94271cb3af4f1c907dd4 (diff) | |
download | llvm-2484e9159c54def19aac69c4a217a55329da54d2.zip llvm-2484e9159c54def19aac69c4a217a55329da54d2.tar.gz llvm-2484e9159c54def19aac69c4a217a55329da54d2.tar.bz2 |
[Driver] Clean up -gz & --compress-debug-sections
* Make cc1 and cc1as --compress-debug-sections an alias for --compress-debug-sections=zlib
* Make -gz an alias for -gz=zlib
The new behavior is consistent with GCC when binutils>=2.26 is detected:
-gz is translated to --compress-debug-sections=zlib instead of --compress-debug-sections.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index c3b5edc..f61a393 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1170,18 +1170,13 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, } } - if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections, - OPT_compress_debug_sections_EQ)) { - if (A->getOption().getID() == OPT_compress_debug_sections) { - Opts.setCompressDebugSections(llvm::DebugCompressionType::Z); - } else { - auto DCT = 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.setCompressDebugSections(DCT); - } + if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections_EQ)) { + auto DCT = 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.setCompressDebugSections(DCT); } Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations); |