Use size_t for array index.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@192249 91177308-0d34-0410-b5e6-96231b3b80d8
Fix flaky elf/X86_64/dynlib-search.test.

Output to llvm::err() is not guaranteed to be thread-safe, so it needs
to be guarded with a lock.

Differential Revision: http://llvm-reviews.chandlerc.com/D1862

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