Newer gcc versions have become more picky on their argument order, due
to the --as-needed default, and require the libraries to be linked to,
to be passed after the code/objects that use them, otherwise they will
get dropped as unused.
Change-Id: I8ace79186b0c8709ccb9cb93f51a9890ce6e1043