Make populate_libs() more generic.

It can handle "path to path" output of ldd, such as
    /a/b/c.so => /x/y/z.so (0x123456789)