Fix potential test failures.
authorRui Ueyama <ruiu@google.com>
Fri, 2 Sep 2016 17:19:28 +0000 (17:19 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 2 Sep 2016 17:19:28 +0000 (17:19 +0000)
commit951cfb6aaea89d55d4155571378c1598fab1f987
tree66219cf65618c69f9b3acf31c298745903a8632f
parent75fbe01eeb198107ced522e10e8f9441c8fe3e19
Fix potential test failures.

Windows does not allow opened files to be removed. This patch
fixes two types of errors.

 - Output file being the same as input file. Because LLD itself
   holds a file descriptor of the input file, it cannot create an
   output file with the same name as a new file.

 - Removing files before releasing MemoryBuffer objects.

These tests are not failing no because MemoryBuffer happens to
decide not to use mmap on these files. But we shouldn't rely on
that behavior.

llvm-svn: 280507
lld/test/ELF/dynamic.s
lld/test/ELF/icf4.s
lld/test/ELF/icf5.s
lld/test/ELF/linkerscript/linkerscript-excludefile.s
lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp