Fix link error by exposing __throw_bad_alloc and add ldl when using nodefaultlib

Change-Id: If44a1b5b240549c4946641f09369d128e3e1251b