[lld] 649cdfc - [ELF] Reinstate the former spelling in the version message

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 7 10:30:36 PDT 2024


Author: Fangrui Song
Date: 2024-07-07T10:30:33-07:00
New Revision: 649cdfc4b6781a350dfc87d9b2a4b5a4c3395909

URL: https://github.com/llvm/llvm-project/commit/649cdfc4b6781a350dfc87d9b2a4b5a4c3395909
DIFF: https://github.com/llvm/llvm-project/commit/649cdfc4b6781a350dfc87d9b2a4b5a4c3395909.diff

LOG: [ELF] Reinstate the former spelling in the version message

With `LLVM_APPEND_VC_REV=off`, the new version message after #97323
looks like:
```
% /tmp/out/custom2/bin/ld.lld --version
LLD 19.0.0, compatible with GNU linkers
```

A trailing comma after the version string might cause issues with
version detection tools that don't strip it, as seen in the Linux
kernel's scripts/ld-version.sh script.

Pull Request: https://github.com/llvm/llvm-project/pull/97942

Added: 
    

Modified: 
    lld/ELF/Driver.cpp
    lld/test/ELF/version.test

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 7800c2919a2bd0..a4863d6717efb4 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -631,7 +631,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
   // of Libtool. We cannot convince every software developer to migrate to
   // the latest version and re-generate scripts. So we have this hack.
   if (args.hasArg(OPT_v) || args.hasArg(OPT_version))
-    message(getLLDVersion() + ", compatible with GNU linkers");
+    message(getLLDVersion() + " (compatible with GNU linkers)");
 
   if (const char *path = getReproduceOption(args)) {
     // Note that --reproduce is a debug option so you can ignore it

diff  --git a/lld/test/ELF/version.test b/lld/test/ELF/version.test
index 383c1ac976d962..72bd2ab56a126f 100644
--- a/lld/test/ELF/version.test
+++ b/lld/test/ELF/version.test
@@ -7,4 +7,4 @@
 # RUN: ld.lld -V 2>&1 | FileCheck %s
 # RUN: not ld.lld -V %t/not-exist 2>&1 | FileCheck %s
 
-# CHECK: LLD {{.*}}, compatible with GNU linkers
+# CHECK: LLD {{.+}} (compatible with GNU linkers)


        


More information about the llvm-commits mailing list