Tweak link order slightly to prefer user shared libs before system ones.

Authored by Phyx on Jan 15 2018, 11:38 AM.

Description

Tweak link order slightly to prefer user shared libs before system ones.

We currently always prefer shared libraries before import libraries and
static libraries. This is because they're faster to load. The problem is
when shared library are installed in the Windows directory. These would
supersede any user specified ones.

This is bad because e.g. Windows now ships icuuc, but an old version.
If you try to use -licuuc then it would pick the Windows one instead of
your user specified one.

This patch slighly tweaks the ordering so user paths get prefered.

Test Plan: ./validate

Reviewers: RyanGlScott, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: Trac #14456

Differential Revision: https://phabricator.haskell.org/D4274