hanchenye-llvm-project/lld/lib
Rui Ueyama 140f6029ce [PECOFF] Fix section header.
The PE/COFF spec says that SizeOfRawData field in the section
header must be a multiple of FileAlignment from the optional
header. LLD emits 512 as FileAlignment, so it must have been
a multiple of 512.

LLD did not follow that. It emitted the actual section size
without the last padding as the SizeOfRawData. Although it's
not correct as per the spec, the Windows loader doesn't seem
to actually bother to check that. Executables created by LLD
worked fine.

However, tools dealing with executalbe files may expect it
to be the correct value, and one instance of it is mt.exe
tool distributed as a part of Windows SDK.

If CMake is invoked with "-E vs_link_exe" option, it silently
run mt.exe to embed a resource file to the resulting file.
And mt.exe sometimes breaks an input file if it's section
header does not follow the standard. That caused a misterous
error that CMake with Ninja occasionally produces a broken
executable.

This patch fixes the section header to make mt.exe and
other tools happy.

llvm-svn: 214453
2014-07-31 22:40:35 +00:00
..
Core Change the signature of insertElementAt and rename addInputElementFront 2014-07-24 00:08:22 +00:00
Driver [mach-o] wire up -t option 2014-07-31 18:19:03 +00:00
Passes Fix unsafe memory access 2014-07-25 19:46:31 +00:00
ReaderWriter [PECOFF] Fix section header. 2014-07-31 22:40:35 +00:00
CMakeLists.txt
Makefile Initial set of Makefiles 2014-06-04 09:54:07 +00:00