diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index deffdb6467cf5a43021a0a45dd29250e9db3eef7..01dc0b1d6eed2b6cf8789b3ceea1c23b65557c87 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -683,7 +683,7 @@ const long cmELF::TagMipsRldMapRel = 0;
 cmELF::cmELF(const char* fname)
 {
   // Try to open the file.
-  auto fin = cm::make_unique<cmsys::ifstream>(fname);
+  auto fin = cm::make_unique<cmsys::ifstream>(fname, std::ios::binary);
 
   // Quit now if the file could not be opened.
   if (!fin || !*fin) {