Skip to content

Commit b298e2d

Browse files
authored
[LLD] [MinGW] Reinstate the former spelling in the version message (#97698)
0f9fbbb 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 173514d) (compatible with GNU linkers)", but works with Meson. The Meson check is loosened in mesonbuild/meson#13383, but existing versions of Meson with the too strict check will be around for quite some time, so 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.
1 parent c1a5f1e commit b298e2d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lld/MinGW/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
199199
// a GNU compatible linker. As long as an output for the -v option
200200
// contains "GNU" or "with BFD", they recognize us as GNU-compatible.
201201
if (args.hasArg(OPT_v) || args.hasArg(OPT_version))
202-
message(getLLDVersion() + ", compatible with GNU linkers");
202+
message(getLLDVersion() + " (compatible with GNU linkers)");
203203

204204
// The behavior of -v or --version is a bit strange, but this is
205205
// needed for compatibility with GNU linkers.

lld/test/MinGW/driver.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ APPCONTAINER: -appcontainer
268268
RUN: ld.lld -m i386pep --version 2>&1 | FileCheck -check-prefix=VERSION %s
269269
RUN: ld.lld -m i386pep -v 2>&1 | FileCheck -check-prefix=VERSION %s
270270
RUN: not ld.lld -m i386pep -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
271-
VERSION: LLD {{.*}}, compatible with GNU linkers
271+
# This literal string is required for compatibility with older Meson versions,
272+
# see https://github.com/mesonbuild/meson/pull/13383.
273+
VERSION: LLD {{.*}} (compatible with GNU linkers)
272274

273275
RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
274276
HELP: USAGE:

0 commit comments

Comments
 (0)