Fix search in ld script, fix error match for FreeBSD

Referencing issue 16, failure to handle different library format errors and ld script beginning with comment line on FreeBSD 10.