x86_64 assembly pack: make Windows build more robust [from master].

PR: 2963 and a number of others