Manually port various fixes to the shlib analysis code to release-1.0.
Direct commit because too much else has changed in master to be able
to merge easily.