On AMD there is a processor bug where the stack segment descriptor is corrupted after a mode switch from 64-bit to 32-bit which coincides with a thread context switch. We fix that by re-loading the descriptor from the selector, using the value observed at initialization time.
Duplicate symbol errors which are somehow raised in VS2017 with the new drlibc call from the core are resolved by moving d_r_internal_error and d_r_ignore_assert to their own source files.
Tested the code path on an Intel processor. Will ask those with AMD processors to test it out before committing.
Fixes #4091 (closed)