Prefer ranlib mode over ar mode.
authorEd Schouten <ed@nuxi.nl>
Tue, 27 Oct 2015 16:37:49 +0000 (16:37 +0000)
committerEd Schouten <ed@nuxi.nl>
Tue, 27 Oct 2015 16:37:49 +0000 (16:37 +0000)
For CloudABI's toolchain I have a symlink that goes from <target>-ar and
<target>-ranlib to LLVM's ar binary, to mimick GNU Binutils' naming
scheme. The problem is that if we're targetting ARM64, the name of the
ranlib executable is aarch64-unknown-cloudabi-ranlib. This already
contains the string "ar".

Let's move the "ranlib" test above the "ar" test. It's not that likely
that we're going to see operating systems or harwdare architectures that
are called "ranlib".

Reviewed by: rafael
Differential Revision: http://reviews.llvm.org/D14123

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251413 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-ar/llvm-ar.cpp

index ec3cfcb5cad014ed265afbd24eb9d76de9a170d4..c8ff53b58b26456628c41d1d172c33fd092c4c24 100644 (file)
@@ -797,9 +797,9 @@ int main(int argc, char **argv) {
     "  This program archives bitcode files into single libraries\n"
   );
 
-  if (Stem.find("ar") != StringRef::npos)
-    return ar_main();
   if (Stem.find("ranlib") != StringRef::npos)
     return ranlib_main();
+  if (Stem.find("ar") != StringRef::npos)
+    return ar_main();
   fail("Not ranlib, ar or lib!");
 }