fix linker_unload test _FILE_OFFSET_BITS redefined warning on Solaris/i386
fix linker_unload test for ghc configurations with --with-gmp-libraries

The issue is presented in Makefile logic where it attempts to start
linker_unload and pass it HSinteger-gmp library for unload,
but the library name is prefixed with two directories names. The first
is of ghc's integer-gmp/build itself and another is the directory name
passed to --with-gmp-libraries= configure parameter. The testcase then
fails on unloading integer-gmp/build directory thinking that this is
a library to unload. The issue is solved by cuting (head -1) the first
library name from the list and using this for unloading the HSinteger-gmp
library. I use head -1 instead of cut -d ' ' here since ghc may be
installed into the directory with space(s) in its name like in the case
when running validate.
fix T658b/T5776 to use POSIX grep -c instead of GNU's --count