std: improve non-libc dynamic library loading

this is a cherry-pick of
5076f2d4f6918946616504d22907c9f80601caf8
from the llvm10 branch
e1f4f44dffAndrew Kelley committed on 2/5/2020, 11:10:26 PMparent80ae434
2 files changedLine totals unavailable