forked from OSchip/llvm-project
140f6029ce
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 |
||
---|---|---|
.. | ||
Core | ||
Driver | ||
Passes | ||
ReaderWriter | ||
CMakeLists.txt | ||
Makefile |