Commit Graph

8 Commits

Author SHA1 Message Date
Fangrui Song 89fa653d72 [llvm-ranlib][test] Fix rwx- after a4f3847f3d 2020-02-14 19:41:55 -08:00
Alex Richardson 546c72a78b [llvm-ranlib] Update expected error message check for Windows
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:".
2020-01-02 18:00:04 +00:00
Alex Richardson a4f3847f3d [llvm-ranlib] Relax D-flag.test to allow it to pass on Windows hosts
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.
2020-01-02 14:59:48 +00:00
Dmitri Gribenko 0eea9ba730 Make the llvm-ranlib/help-message.test test pass in unusual configurations
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).
2020-01-02 15:24:18 +01:00
Alex Richardson 136f34fed6 Fix D-flag.test by running chmod before creating the archive
Not all systems create the .o file with mode 644 by default.
Adding an explicit chmod invocation should fix this test added in
535b3c6b2f
2020-01-02 14:27:57 +01:00
Alex Richardson 535b3c6b2f [llvm-ranlib] Handle -D and -U command line flag
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
2020-01-02 13:44:05 +01:00
Fangrui Song 4d53b99c5d [llvm-ar] Improve tool selection heuristic
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
2019-12-10 17:32:50 -08:00
Sam Clegg 6278fba9b1 llvm-ranlib/nm: Don't print usage message except for usage errors
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
2019-11-08 15:17:07 -08:00