Author: Tomohiro Kashiwada
Date: 2026-09-03T11:54:27+03:00
New Revision: 9020c7f7ab220626710b6ab844213a7f7756a72e

URL: 
https://github.com/llvm/llvm-project/commit/9020c7f7ab220626710b6ab844213a7f7756a72e
DIFF: 
https://github.com/llvm/llvm-project/commit/9020c7f7ab220626710b6ab844213a7f7756a72e.diff

LOG: [Clang][Cygwin] Set default DWARF version to 4 (#220738)

Cygwin distribution's GDB doesn't work with DWARF 5.
Do the same as MinGW (6cf64b2d2858dc93c3ec93438bdaca2807847e9b).

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Cygwin.h
    clang/test/CodeGen/dwarf-version.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Cygwin.h 
b/clang/lib/Driver/ToolChains/Cygwin.h
index 4371fee81d07c..934110c1dd4c3 100644
--- a/clang/lib/Driver/ToolChains/Cygwin.h
+++ b/clang/lib/Driver/ToolChains/Cygwin.h
@@ -33,6 +33,8 @@ class LLVM_LIBRARY_VISIBILITY Cygwin : public Generic_GCC {
                         llvm::opt::ArgStringList &CC1Args, BoundArch BA,
                         Action::OffloadKind DeviceOffloadKind) const override;
 
+  unsigned GetDefaultDwarfVersion() const override { return 4; }
+
 protected:
   Tool *buildLinker() const override;
 };

diff  --git a/clang/test/CodeGen/dwarf-version.c 
b/clang/test/CodeGen/dwarf-version.c
index 500f66c2656b5..2f5d23e0b7c3b 100644
--- a/clang/test/CodeGen/dwarf-version.c
+++ b/clang/test/CodeGen/dwarf-version.c
@@ -35,9 +35,11 @@
 // RUN: %clang -target i686-pc-windows-msvc -gdwarf -gcodeview -S -emit-llvm 
-o - %s \
 // RUN:     | FileCheck %s --check-prefixes=VER4,CODEVIEW
 
-// Check what version of dwarf is used for MinGW targets.
+// Check what version of dwarf is used for MinGW/Cygwin targets.
 // RUN: %clang -target i686-pc-windows-gnu -g -S -emit-llvm -o - %s | \
 // RUN:   FileCheck %s --check-prefixes=VER4
+// RUN: %clang -target i686-pc-windows-cygnus -g -S -emit-llvm -o - %s | \
+// RUN:   FileCheck %s --check-prefixes=VER4
 
 // RUN: %clang -target powerpc-ibm-aix-xcoff -g -S -emit-llvm -o - %s | \
 // RUN:   FileCheck %s --check-prefix=VER3


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to