Leftover fixes from !1689 for compiling source files of `stdlib`
Each commit is independent from others so feel free to cherry-pick and continue.
Other than f3fedfce all commits are to be cherry-picked and merged into master
.
Edited by Gagandeep Singh