Skip to content

Commit

Permalink
[LLD] [MinGW] Reinstate the former spelling in the version message (l…
Browse files Browse the repository at this point in the history
…lvm#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.
  • Loading branch information
mstorsjo authored and kbluck committed Jul 6, 2024
1 parent e55a0d4 commit 42aba8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lld/MinGW/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion lld/test/MinGW/driver.test
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ 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
# 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
HELP: USAGE:
Expand Down

0 comments on commit 42aba8f

Please sign in to comment.