From ae2a82d389e00742797aff214e346ee142526b48 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 8 Jul 2020 14:14:01 +0200 Subject: [PATCH] patches/remove-trailing-space-version.diff: cherry-pick an upstream patch to address https://bugs.llvm.org/show_bug.cgi?id=38998#c15 trailing whitespace of clang full version causing a display issue when building the linux kernel with clang --- debian/changelog | 4 ++ .../remove-trailing-space-version.diff | 47 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 52 insertions(+) create mode 100644 debian/patches/remove-trailing-space-version.diff diff --git a/debian/changelog b/debian/changelog index 1ab34aa6..b12c17bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,10 @@ llvm-toolchain-10 (1:10.0.1~+rc4-1) unstable; urgency=medium And make sure that the test is only executed when installed correctly Otherwise, fails with "./foo.bc: cannot execute binary file: Exec format error" + * patches/remove-trailing-space-version.diff: cherry-pick an upstream patch + to address https://bugs.llvm.org/show_bug.cgi?id=38998#c15 + trailing whitespace of clang full version causing a display issue + when building the linux kernel with clang -- Sylvestre Ledru Wed, 08 Jul 2020 10:49:26 +0200 diff --git a/debian/patches/remove-trailing-space-version.diff b/debian/patches/remove-trailing-space-version.diff new file mode 100644 index 00000000..bb6b244d --- /dev/null +++ b/debian/patches/remove-trailing-space-version.diff @@ -0,0 +1,47 @@ +commit bbea4d5e6b82a683dccaa8f4916e2a44f5dd3490 +Author: Sylvestre Ledru +Date: Wed Jul 8 13:33:34 2020 +0200 + + clang: Don't show a trailing space with --version when not built from the repo + + Reported here: + https://bugs.llvm.org/show_bug.cgi?id=38998#c15 + + Reviewers: hans + + Differential Revision: https://reviews.llvm.org/D83386 + +diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp +index c4b7d34ed16..286107cab9d 100644 +--- a/clang/lib/Basic/Version.cpp ++++ b/clang/lib/Basic/Version.cpp +@@ -97,8 +97,12 @@ std::string getClangToolFullVersion(StringRef ToolName) { + #ifdef CLANG_VENDOR + OS << CLANG_VENDOR; + #endif +- OS << ToolName << " version " CLANG_VERSION_STRING " " +- << getClangFullRepositoryVersion(); ++ OS << ToolName << " version " CLANG_VERSION_STRING; ++ ++ std::string repo = getClangFullRepositoryVersion(); ++ if (!repo.empty()) { ++ OS << " " << repo; ++ } + + return OS.str(); + } +@@ -111,7 +115,13 @@ std::string getClangFullCPPVersion() { + #ifdef CLANG_VENDOR + OS << CLANG_VENDOR; + #endif +- OS << "Clang " CLANG_VERSION_STRING " " << getClangFullRepositoryVersion(); ++ OS << "Clang " CLANG_VERSION_STRING; ++ ++ std::string repo = getClangFullRepositoryVersion(); ++ if (!repo.empty()) { ++ OS << " " << repo; ++ } ++ + return OS.str(); + } + diff --git a/debian/patches/series b/debian/patches/series index bc6a8030..e652879d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -145,3 +145,4 @@ no-cgi.patch ubuntu-groovy.diff clang_vendor_pass_stage2.diff +remove-trailing-space-version.diff