Author: Fangrui Song Date: 2022-09-08T16:31:45-07:00 New Revision: 1f6a86b3097855d321438718daa8b98c58db8137
URL: https://github.com/llvm/llvm-project/commit/1f6a86b3097855d321438718daa8b98c58db8137 DIFF: https://github.com/llvm/llvm-project/commit/1f6a86b3097855d321438718daa8b98c58db8137.diff LOG: [cc1as] Support --compress-debug-sections=zstd `clang -gz=zstd -c a.s` generates ELFCOMPRESS_ZSTD compressed debug info sections if compression decreases size. Added: Modified: clang/test/Misc/cc1as-compress.s clang/tools/driver/cc1as_main.cpp Removed: ################################################################################ diff --git a/clang/test/Misc/cc1as-compress.s b/clang/test/Misc/cc1as-compress.s index 8937e5d1b275c..54563c33bd165 100644 --- a/clang/test/Misc/cc1as-compress.s +++ b/clang/test/Misc/cc1as-compress.s @@ -3,4 +3,13 @@ // RUN: %clang -cc1as -triple i686 --compress-debug-sections %s -o /dev/null // RUN: %clang -cc1as -triple i686 -compress-debug-sections=zlib %s -o /dev/null -// RUN: %if zstd %{ %clang -cc1as -triple x86_64 -compress-debug-sections=zstd %s -o /dev/null %} + +// RUN: %if zstd %{ %clang -cc1as -triple x86_64 -filetype obj -compress-debug-sections=zstd %s -o %t %} +// RUN: %if zstd %{ llvm-readelf -S -x .debug_str %t | FileCheck %s --check-prefix=ZSTD %} + +// ZSTD: .debug_str PROGBITS [[#%x,]] [[#%x,]] [[#%x,]] 01 MSC 0 0 8 +// ZSTD: Hex dump of section '.debug_str': +// ZSTD: 0000 02000000 00000000 + +.section .debug_str,"MS",@progbits,1 +.asciz "perfectly compressable data sample *****************************************" diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index 4dcbc4fe77ccf..f4ae351794e64 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -240,6 +240,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue()) .Case("none", llvm::DebugCompressionType::None) .Case("zlib", llvm::DebugCompressionType::Zlib) + .Case("zstd", llvm::DebugCompressionType::Zstd) .Default(llvm::DebugCompressionType::None); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits