improve error handling in map_library and support long phdrs