Debug build of Clang built with MinGW on Windows 10 cannot be run

不想你离开。 提交于 2019-12-05 06:15:12

Yes, file size is a pretty good hint of having this problem. The IMAGE_OPTIONAL_HEADER64.SizeOfImage field is a DWORD, suggesting a 4 GB maximum size. But there is another limit that kicks in first, the OS loader maps the entire .exe or .dll file into memory with a memory-mapped file. The view on the MMF can never be larger than 2 GB. This is a hard technical limitation, it even applies to x64. More about this problem in this post.

Debug info is no doubt the reason why the image file blows up so badly. For comparison, the clang build that is included with VS2017 needs 27MB for the front end and 32MB for the x64 back end. Why -gsplit-dwarf cannot solve your problem is visible from this project page:

Fission is implemented in GCC 4.7, and requires support from recent versions of objcopy and the gold linker.

MinGW cannot provide you with the gold linker. They made no attempt at porting it since it can only generate ELF images. Cold hard facts, as long as you depend on MinGW then you're up a creek without a good paddle.

Something drastic is needed. I'll hesitantly mention Cygwin. Do consider another compiler, like using Clang to build Clang :) Or MSVC++. The community edition is a free download. Also be sure to take a look at the Clang port, they did a lot of work to make it ABI compatible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!