[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
phoebewang wrote: > I am curious what a `win32-elf` triple is. Does MSVC support generating ELF > object files? No idea, but https://github.com/llvm/llvm-project/issues/87140 doesn't look like from fuzzing. Consider Windows has WSL now, I'd not surprise it's supported or will be supported someday, see https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2?view=msvc-170 https://github.com/llvm/llvm-project/pull/87149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
MaskRay wrote: I am curious what a `win32-elf` triple is. Does MSVC support generating ELF object files? https://github.com/llvm/llvm-project/pull/87149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
https://github.com/phoebewang updated https://github.com/llvm/llvm-project/pull/87149 >From 16fea4659909423319f0107b2a4d5bcc31185299 Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sat, 30 Mar 2024 17:29:06 +0800 Subject: [PATCH] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format 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 --- clang/lib/Driver/ToolChains/MSVC.h | 5 ++--- clang/test/Misc/win32-elf.c| 5 + 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c 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 00..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={{.*}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 070d7af0c56b993806fa47f77b607b1849a2172f 745b2acb9dafbb54b00353f71dee464b3617c13a -- clang/test/Misc/win32-elf.c clang/lib/Driver/ToolChains/MSVC.h `` View the diff from clang-format here. ``diff diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 3a5975272c..3950a8ed38 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,8 @@ public: /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to /// override the default. llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override { -return getTriple().isOSBinFormatCOFF() - ? llvm::codegenoptions::DIF_CodeView - : llvm::codegenoptions::DIF_DWARF; +return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView + : llvm::codegenoptions::DIF_DWARF; } /// Set the debugger tuning to "default", since we're definitely not tuning `` https://github.com/llvm/llvm-project/pull/87149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
llvmbot wrote: @llvm/pr-subscribers-clang-driver Author: Phoebe Wang (phoebewang) Changes 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 --- Full diff: https://github.com/llvm/llvm-project/pull/87149.diff 2 Files Affected: - (modified) clang/lib/Driver/ToolChains/MSVC.h (+3-3) - (added) clang/test/Misc/win32-elf.c (+5) ``diff diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3a5975272c570f 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,9 @@ 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 00..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={{.*}} `` https://github.com/llvm/llvm-project/pull/87149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format (PR #87149)
https://github.com/phoebewang created https://github.com/llvm/llvm-project/pull/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 >From 745b2acb9dafbb54b00353f71dee464b3617c13a Mon Sep 17 00:00:00 2001 From: Phoebe Wang Date: Sat, 30 Mar 2024 17:29:06 +0800 Subject: [PATCH] [Win32][ELF] Make CodeView a DebugInfoFormat only for COFF format 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 --- clang/lib/Driver/ToolChains/MSVC.h | 6 +++--- clang/test/Misc/win32-elf.c| 5 + 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 clang/test/Misc/win32-elf.c diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h index 48369e030aade2..3a5975272c570f 100644 --- a/clang/lib/Driver/ToolChains/MSVC.h +++ b/clang/lib/Driver/ToolChains/MSVC.h @@ -61,9 +61,9 @@ 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 00..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={{.*}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits