Create archives with the same permissions are ar.

Patch by Mikael Lepistö.

llvm-svn: 51540
diff --git a/llvm/lib/Archive/ArchiveWriter.cpp b/llvm/lib/Archive/ArchiveWriter.cpp
index c5d54fb..2269464 100644
--- a/llvm/lib/Archive/ArchiveWriter.cpp
+++ b/llvm/lib/Archive/ArchiveWriter.cpp
@@ -467,5 +467,12 @@
   if (TmpArchive.renamePathOnDisk(archPath, ErrMsg))
     return true;
 
+  // Set correct read and write permissions after temporary file is moved
+  // to final destination path.
+  if (archPath.makeReadableOnDisk(ErrMsg))
+    return true;
+  if (archPath.makeWriteableOnDisk(ErrMsg))
+    return true;
+
   return false;
 }