aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-08-03 15:11:28 -0700
committerFangrui Song <i@maskray.me>2020-08-03 15:12:01 -0700
commit7cf4603faee366a6e5860b6fdbedadd91872e231 (patch)
tree91ab7af228fb3afffa8769d47550e9374d78131b /clang/lib/Frontend/CompilerInvocation.cpp
parent089adc339e7dd6924d7e107fa362d9d12642f6e0 (diff)
downloadllvm-7cf4603faee366a6e5860b6fdbedadd91872e231.zip
llvm-7cf4603faee366a6e5860b6fdbedadd91872e231.tar.gz
llvm-7cf4603faee366a6e5860b6fdbedadd91872e231.tar.bz2
Reland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED) with integrated assembler
This fixes an inconsistency: clang -c -gz -fno-integrated-as means SHF_COMPRESSED while clang -c -gz -fintegrated-as means zlib-gnu. --- Since July 15, 2015 (binutils-gdb commit 19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas --compress-debug-sections=zlib (gcc -gz) means zlib-gabi: SHF_COMPRESSED. Before that GCC/binutils used zlib-gnu (.zdebug). clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It is 2020 now and it is not unreasonable to assume users of the new feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661). Change clang's default accordingly to improve standard conformance. zlib-gnu becomes out of fashion and gets poorer toolchain support. Its mangled names confuse tools and are more likely to cause problems. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D61689
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 0b5f335..8e8bf9d 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1155,8 +1155,7 @@ 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) {
- // TODO: be more clever about the compression type auto-detection
- Opts.setCompressDebugSections(llvm::DebugCompressionType::GNU);
+ Opts.setCompressDebugSections(llvm::DebugCompressionType::Z);
} else {
auto DCT = llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
.Case("none", llvm::DebugCompressionType::None)