Index: llvm/test/tools/llvm-ar/case-detection.test =================================================================== --- llvm/test/tools/llvm-ar/case-detection.test +++ llvm/test/tools/llvm-ar/case-detection.test @@ -0,0 +1,7 @@ +-- Test CamelCase Lib.exe to ensure detection works properly + +RUN: yaml2obj %S/Inputs/coff.yaml -o %t.obj +RUN: rm -rf %t1 +RUN: mkdir %t1 +RUN: cp llvm-ar %t1/Lib +RUN: %t1/Lib /OUT:%t.lib %t.obj Index: llvm/tools/llvm-ar/llvm-ar.cpp =================================================================== --- llvm/tools/llvm-ar/llvm-ar.cpp +++ llvm/tools/llvm-ar/llvm-ar.cpp @@ -863,11 +863,11 @@ llvm::InitializeAllAsmParsers(); StringRef Stem = sys::path::stem(ToolName); - if (Stem.find("dlltool") != StringRef::npos) + if (Stem.find_lower("dlltool") != StringRef::npos) return dlltoolDriverMain(makeArrayRef(argv, argc)); - if (Stem.find("ranlib") == StringRef::npos && - Stem.find("lib") != StringRef::npos) + if (Stem.find_lower("ranlib") == StringRef::npos && + Stem.find_lower("lib") != StringRef::npos) return libDriverMain(makeArrayRef(argv, argc)); SmallVector Argv; @@ -900,9 +900,9 @@ " This program archives bitcode files into single libraries\n" ); - if (Stem.find("ranlib") != StringRef::npos) + if (Stem.find_lower("ranlib") != StringRef::npos) return ranlib_main(); - if (Stem.find("ar") != StringRef::npos) + if (Stem.find_lower("ar") != StringRef::npos) return ar_main(); fail("Not ranlib, ar, lib or dlltool!"); }