Skip to content

Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format" #87987

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 2 commits into from
Apr 10, 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
1 change: 1 addition & 0 deletions clang/test/Driver/gcodeview-command-line.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Note: %s must be preceded by --, otherwise it may be interpreted as a
// command-line option, e.g. on Mac where %s is commonly under /Users.
// REQUIRES: aarch64-registered-target,arm-registered-target,x86-registered-target

// ON-NOT: "-gno-codview-commandline"
// OFF: "-gno-codeview-command-line"
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={{.*}}