This is D29129 with the Windows debug build problems fixed.
The MSVC debug implementation of std::merge enforces the preconditions required by the C++ standard. This includes checking that both ranges are sortable by the predicate and that if (A < B) then !(B > A). D29129 the comparison routine did not conform to the requirements of the standard. This change fixes the predicate.
The changes made are all related to the comparison routine:
SyntheticSections:
- add getTargetInputSection to ThunkSection
- correct section flags in constructor. ThunkSections was missing SHF_EXECINSTR
Relocations:
- Set the OutSecOff of the per-OutputSection ThunkSection to be the limit of the executable sections, previously we set the OutSecOff to size, and checked in the predicate whether the Thunk and InputSection were executable.
- Rewrite the MergeComp predicate to use only OutSecOff and as a tie-breaker for Mips LA25 whether the next section is our Thunks Target.
I've checked that this builds and runs the tests on MSVC 2015. Sending for review as it is more than just a simple syntax fix.