[clang] d3b26de - Clang: Change the default DWARF version to 5

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 24 10:00:57 PST 2022


For me, this broke some tests of the profiling runtime:

$ ninja check-profile
...
Failed Tests (2):
  Profile-i386 :: Linux/instrprof-debug-info-correlate.c
  Profile-x86_64 :: Linux/instrprof-debug-info-correlate.c

Annoyingly, I can't find any buildbots where this fails, but I'm not
really sure which ones test this runtime.

It also reproduces on Chromium's builders, e.g.
https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8824141369391584977/+/u/package_clang/stdout

Filed https://github.com/llvm/llvm-project/issues/53387


On Mon, Jan 24, 2022 at 5:50 AM David Blaikie via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
>
> Author: David Blaikie
> Date: 2022-01-23T20:49:57-08:00
> New Revision: d3b26dea16108c427b19b5480c9edc76edf8f5b4
>
> URL: https://github.com/llvm/llvm-project/commit/d3b26dea16108c427b19b5480c9edc76edf8f5b4
> DIFF: https://github.com/llvm/llvm-project/commit/d3b26dea16108c427b19b5480c9edc76edf8f5b4.diff
>
> LOG: Clang: Change the default DWARF version to 5
>
> (except on platforms that already opt in to specific versions - SCE,
> Android, and Darwin using DWARFv4 explicitly, for instance)
>
> Added:
>
>
> Modified:
>     clang/docs/ReleaseNotes.rst
>     clang/include/clang/Driver/ToolChain.h
>     clang/lib/Driver/ToolChains/Linux.h
>     clang/test/CodeGen/debug-info-extern-call.c
>     clang/test/CodeGen/dwarf-version.c
>     clang/test/Driver/cl-options.c
>     clang/test/Driver/clang-g-opts.c
>     clang/test/Driver/ve-toolchain.c
>     clang/test/Driver/ve-toolchain.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
> index 2eec63901932e..4fe037741256f 100644
> --- a/clang/docs/ReleaseNotes.rst
> +++ b/clang/docs/ReleaseNotes.rst
> @@ -252,6 +252,14 @@ X86 Support in Clang
>
>  - Support for ``AVX512-FP16`` instructions has been added.
>
> +DWARF Support in Clang
> +----------------------
> +
> +- The default DWARF version has increased from DWARFv4 to DWARFv5.  You can opt
> +  back in to the old behavior with -gdwarf-4. Some platforms (Darwin, Android,
> +  and SCE for instance) already opt out of this version bump as is suitable for
> +  the platform
> +
>  Arm and AArch64 Support in Clang
>  --------------------------------
>
>
> diff  --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
> index eb95806a2f75d..37011de6bd6d7 100644
> --- a/clang/include/clang/Driver/ToolChain.h
> +++ b/clang/include/clang/Driver/ToolChain.h
> @@ -510,7 +510,7 @@ class ToolChain {
>
>    // Return the DWARF version to emit, in the absence of arguments
>    // to the contrary.
> -  virtual unsigned GetDefaultDwarfVersion() const { return 4; }
> +  virtual unsigned GetDefaultDwarfVersion() const { return 5; }
>
>    // Some toolchains may have
> diff erent restrictions on the DWARF version and
>    // may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
>
> diff  --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
> index a5ec33bd44f10..a5648d79d655f 100644
> --- a/clang/lib/Driver/ToolChains/Linux.h
> +++ b/clang/lib/Driver/ToolChains/Linux.h
> @@ -40,6 +40,7 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
>    void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
>                             llvm::opt::ArgStringList &CC1Args) const override;
>    RuntimeLibType GetDefaultRuntimeLibType() const override;
> +  unsigned GetDefaultDwarfVersion() const override;
>    CXXStdlibType GetDefaultCXXStdlibType() const override;
>    bool
>    IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override;
>
> diff  --git a/clang/test/CodeGen/debug-info-extern-call.c b/clang/test/CodeGen/debug-info-extern-call.c
> index 7cf90550ac00a..fad52d0df0b3f 100644
> --- a/clang/test/CodeGen/debug-info-extern-call.c
> +++ b/clang/test/CodeGen/debug-info-extern-call.c
> @@ -12,13 +12,13 @@
>  // decls so that the dwarf generator can describe information needed for tail
>  // call frame reconstrution.
>  //
> -// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -ggdb -S -emit-llvm %s -o - \
> +// RUN: %clang -gdwarf-4 -O2 -target x86_64-none-linux-gnu -ggdb -S -emit-llvm %s -o - \
>  // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
>  //
>  // Do not emit a subprogram for extern decls when entry values are disabled and
>  // the tuning is not set to gdb.
>  //
> -// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
> +// RUN: %clang -gdwarf-4 -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
>  // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
>
>  // DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: !{{[0-9]+}}
>
> diff  --git a/clang/test/CodeGen/dwarf-version.c b/clang/test/CodeGen/dwarf-version.c
> index 6d131c470d5b3..b329556ae0d9d 100644
> --- a/clang/test/CodeGen/dwarf-version.c
> +++ b/clang/test/CodeGen/dwarf-version.c
> @@ -2,8 +2,8 @@
>  // RUN: %clang -target x86_64-linux-gnu -gdwarf-3 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER3
>  // RUN: %clang -target x86_64-linux-gnu -gdwarf-4 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
>  // RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
> -// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
> -// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER4
> +// RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
> +// RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | FileCheck %s --check-prefix=VER5
>
>  // The -isysroot is used as a hack to avoid LIT messing with the SDKROOT
>  // environment variable which indirecty overrides the version in the target
> @@ -28,10 +28,10 @@
>  // RUN:     | FileCheck %s --check-prefixes=NODWARF,CODEVIEW
>  //     Explicitly request DWARF.
>  // RUN: %clang -target i686-pc-windows-msvc -gdwarf -S -emit-llvm -o - %s \
> -// RUN:     | FileCheck %s --check-prefixes=VER4,NOCODEVIEW
> +// RUN:     | FileCheck %s --check-prefixes=VER5,NOCODEVIEW
>  //     Explicitly request both.
>  // RUN: %clang -target i686-pc-windows-msvc -gdwarf -gcodeview -S -emit-llvm -o - %s \
> -// RUN:     | FileCheck %s --check-prefixes=VER4,CODEVIEW
> +// RUN:     | FileCheck %s --check-prefixes=VER5,CODEVIEW
>  // RUN: %clang -target powerpc-ibm-aix-xcoff -g -S -emit-llvm -o - %s | \
>  // RUN:   FileCheck %s --check-prefix=VER3
>  // RUN: %clang -target powerpc-ibm-aix-xcoff -gdwarf-2 -S -emit-llvm -o - %s | \
>
> diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
> index f39db87660125..733e733de738e 100644
> --- a/clang/test/Driver/cl-options.c
> +++ b/clang/test/Driver/cl-options.c
> @@ -596,7 +596,7 @@
>  // RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
>  // Z7_gdwarf: "-gcodeview"
>  // Z7_gdwarf: "-debug-info-kind=constructor"
> -// Z7_gdwarf: "-dwarf-version=4"
> +// Z7_gdwarf: "-dwarf-version=
>
>  // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
>  // CXX11: -std=c++11
>
> diff  --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
> index bb129e75769c9..d982b1070cae1 100644
> --- a/clang/test/Driver/clang-g-opts.c
> +++ b/clang/test/Driver/clang-g-opts.c
> @@ -32,7 +32,7 @@
>
>  // CHECK-WITHOUT-G-NOT: -debug-info-kind
>  // CHECK-WITH-G: "-debug-info-kind=constructor"
> -// CHECK-WITH-G: "-dwarf-version=4"
> +// CHECK-WITH-G: "-dwarf-version=5"
>  // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
>
>  // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
>
> diff  --git a/clang/test/Driver/ve-toolchain.c b/clang/test/Driver/ve-toolchain.c
> index 8878bd8f83cc0..35af3c81c4c6f 100644
> --- a/clang/test/Driver/ve-toolchain.c
> +++ b/clang/test/Driver/ve-toolchain.c
> @@ -6,7 +6,7 @@
>  /// Checking dwarf-version
>
>  // RUN: %clang -### -g -target ve %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
> -// DWARF_VER: "-dwarf-version=4"
> +// DWARF_VER: "-dwarf-version=5"
>
>  ///-----------------------------------------------------------------------------
>  /// Checking include-path
>
> diff  --git a/clang/test/Driver/ve-toolchain.cpp b/clang/test/Driver/ve-toolchain.cpp
> index 7666cfbfe8b27..7447f34b70e0c 100644
> --- a/clang/test/Driver/ve-toolchain.cpp
> +++ b/clang/test/Driver/ve-toolchain.cpp
> @@ -7,7 +7,7 @@
>
>  // RUN: %clangxx -### -g -target ve-unknown-linux-gnu \
>  // RUN:     %s 2>&1 | FileCheck -check-prefix=DWARF_VER %s
> -// DWARF_VER: "-dwarf-version=4"
> +// DWARF_VER: "-dwarf-version=5"
>
>  ///-----------------------------------------------------------------------------
>  /// Checking include-path
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list