[clang] 4b25053 - [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (#87149)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 3 00:21:38 PDT 2024
Author: Phoebe Wang
Date: 2024-04-03T15:21:34+08:00
New Revision: 4b25053ae47f50095371a663391baadfd2694eb0
URL: https://github.com/llvm/llvm-project/commit/4b25053ae47f50095371a663391baadfd2694eb0
DIFF: https://github.com/llvm/llvm-project/commit/4b25053ae47f50095371a663391baadfd2694eb0.diff
LOG: [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (#87149)
We have many problems to use CodeView for a win32-elf target, e.g.,
#87140 and `error: .seh_* directives are not supported on this target`.
Fixes: #87140
Added:
clang/test/Misc/win32-elf.c
Modified:
clang/lib/Driver/ToolChains/MSVC.h
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h
index 48369e030aade2..3950a8ed38e8b4 100644
--- a/clang/lib/Driver/ToolChains/MSVC.h
+++ b/clang/lib/Driver/ToolChains/MSVC.h
@@ -61,9 +61,8 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain {
/// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to
/// override the default.
llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
- return getTriple().isOSBinFormatMachO()
- ? llvm::codegenoptions::DIF_DWARF
- : llvm::codegenoptions::DIF_CodeView;
+ return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView
+ : llvm::codegenoptions::DIF_DWARF;
}
/// Set the debugger tuning to "default", since we're definitely not tuning
diff --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c
new file mode 100644
index 00000000000000..f75281dc418727
--- /dev/null
+++ b/clang/test/Misc/win32-elf.c
@@ -0,0 +1,5 @@
+// Check that basic use of win32-elf targets works.
+// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s
+
+// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | FileCheck %s -check-prefix=DEBUG-INFO
+// DEBUG-INFO: -dwarf-version={{.*}}
More information about the cfe-commits
mailing list