Skip to content

[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format #87149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions clang/lib/Driver/ToolChains/MSVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Misc/win32-elf.c
Original file line number Diff line number Diff line change
@@ -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={{.*}}