On Windows hosts, the error message will be something like
`c:\src\llvm-project\out\gn\bin\llvm-ranlib.exe: error: Invalid option: '--D'`.
Due to the .exe after llvm-ranlib the existing CHECK lines do not match.
Fix this by ignoring the program name and starting the check line at "error:".
It appears that Windows hosts always report rwxrwxrwx even with the
chmod 644 invocation. As this test only cares about the timestamps
and not the permissions, use a regex wildcard instead.
The version string can be customized by CMake options, so the 'LLVM
version' substring is not guaranteed to appear (see
VersionPrinter::print in llvm/lib/Support/CommandLine.cpp).
I have been trying to build CheriBSD (a fork for FreeBSD for the CHERI
CPU) with LLVM binutils instead of the default elftoolchain utilities.
I noticed that building static archives was failing because ranlib is
invoked with the -D flag. This failed with llvm-ranlib since it parses
the -D flag as the archive path and reports an error that more than one
archive has been passed.
This fixes https://llvm.org/PR41707
Reviewed By: rupprecht
Differential Revision: https://reviews.llvm.org/D71554
If llvm-ar is installed at arm-pokymllib32-linux-gnueabi-llvm-ar, it may
think it is llvm-lib due to the "lib" substring.
Improve the heuristic to make all the following work as intended:
llvm-ar-9 (llvm-9 package on Debian)
llvm-ranlib.exe
Lib.exe (reported by D44808)
arm-pokymllib32-linux-gnueabi-llvm-ar (reported by D71030)
Reviewed By: raj.khem, rupprecht
Differential Revision: https://reviews.llvm.org/D71302
Also, fix a bug in ranlib where it didn't correctly detect being run
without any argument and would try to operate on the empty string.
Differential Revision: https://reviews.llvm.org/D70021