This can be reproduced easily on 32bit configuration with using testcase from D27712.
I believe there are other ways to achieve the same effect. Like having corrupted huge
sections sizes which we do not handle too.
But at last this is what we can fix easily as at the moment of issue ErrorCount > 0 already.
Issue is next:
FileSize is 0xfffffffffffff210 because of address/offsets calculation overflow.
And we trigger "unable to move location counter backward for: .text" in that case.
It works with a remark. FileSize it then passed as size_t and under win32 configuration truncates to 4gb,
that results in a creating temp 4gb files named "locationcountererr.s.tmp1.tmpXXXX" or alike,
that is a SSD space eater on each testcase run:
ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr = FileOutputBuffer::create(Config->OutputFile, FileSize, FileOutputBuffer::F_executable);
I suggest to add a simple check not only after openFile, but also before.