Check if the linker plugin support minimal library set

On some versions (typically GCC <= 4.6.2) there is a bug in the
interaction between the -flto (which by default activates a linker
plugin to get better feedback about usage scope) and --as-needed.

If this is the case, then we should simply drop the --as-needed flag.