[lld] [LLD] [MinGW] Reinstate the former spelling in the version message (PR #97698)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 14:04:04 PDT 2024
https://github.com/mstorsjo updated https://github.com/llvm/llvm-project/pull/97698
>From 0c6b29fda6859135afa3c2bd4668810812757215 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Thu, 4 Jul 2024 11:48:14 +0300
Subject: [PATCH 1/2] [LLD] [MinGW] Reinstate the former spelling in the
version message
0f9fbbb63cfcd2069441aa2ebef622c9716f8dbb changed the version
printouts. This broke linker detection in Meson, when disambiguating
between the ld.lld and lld-link interfaces, in
https://github.com/mesonbuild/meson/blob/1.4.1/mesonbuild/linkers/detect.py#L67,
which checks for the string "(compatible with GNU linkers)"
including the parentheses.
Reinstate the parentheses in the printout here, for compatibility
with Meson. The printout looks a little odd in this form,
"LLD 19.0.0 (https://github.com/llvm/llvm-project 173514d58ec4e6166670f1e37a038df3865c8b96) (compatible with GNU linkers)",
but works with Meson.
The Meson check should ideally be loosened. But even then, we
should only change LLD to the new form once older versions of
Meson aren't used for these targets any longer, i.e. earliest
within a few years.
---
lld/MinGW/Driver.cpp | 2 +-
lld/test/MinGW/driver.test | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 1fd120ad3601d..35fd478a21905 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -199,7 +199,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
// a GNU compatible linker. As long as an output for the -v option
// contains "GNU" or "with BFD", they recognize us as GNU-compatible.
if (args.hasArg(OPT_v) || args.hasArg(OPT_version))
- message(getLLDVersion() + ", compatible with GNU linkers");
+ message(getLLDVersion() + " (compatible with GNU linkers)");
// The behavior of -v or --version is a bit strange, but this is
// needed for compatibility with GNU linkers.
diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index 44ec58818e0bf..b723c0ad98749 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -268,7 +268,7 @@ APPCONTAINER: -appcontainer
RUN: ld.lld -m i386pep --version 2>&1 | FileCheck -check-prefix=VERSION %s
RUN: ld.lld -m i386pep -v 2>&1 | FileCheck -check-prefix=VERSION %s
RUN: not ld.lld -m i386pep -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
-VERSION: LLD {{.*}}, compatible with GNU linkers
+VERSION: LLD {{.*}} (compatible with GNU linkers)
RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
HELP: USAGE:
>From 3f4cd578a9529c8e27a3116b0a2b55dccb3a3aa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Fri, 5 Jul 2024 00:00:48 +0300
Subject: [PATCH 2/2] Add a reference to the Meson PR
---
lld/test/MinGW/driver.test | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index b723c0ad98749..cbccd09793c2f 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -268,6 +268,8 @@ APPCONTAINER: -appcontainer
RUN: ld.lld -m i386pep --version 2>&1 | FileCheck -check-prefix=VERSION %s
RUN: ld.lld -m i386pep -v 2>&1 | FileCheck -check-prefix=VERSION %s
RUN: not ld.lld -m i386pep -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
+# This literal string is required for compatibility with older Meson versions,
+# see https://github.com/mesonbuild/meson/pull/13383.
VERSION: LLD {{.*}} (compatible with GNU linkers)
RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
More information about the llvm-commits
mailing list