Previously we incorrectly interpreted PE section numbers as signed values. However, this isn't the case; rather, it's an unsigned 16-bit number with a few special bit-patterns (0xffff and 0xfffe). This resulted in #22941 (closed) as the linker would conclude that the sections were invalid.
Fixing this required quite a bit of refactoring.
Closes #22941 (closed).