Improve Windows dlfcn shims.

We can use GetLastError/FormatMessage to get a less useless error
message from dlerror.

Use LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR to search the loaded library's
directory to satisfy dependencies.

Test: toolchain/gcc/build.py --toolchain arm-linux-androideabi \
          --host windows64
Bug: https://github.com/android-ndk/ndk/issues/313

This change is forward-port of c/438069
  - https://android-review.googlesource.com/#/c/438069
to binutils-2_27-branch.

Change-Id: I66840280cdd7b4176a1ad02f022457bd0336d101
1 file changed