build: stop using whole-archive for our final binary

This nasty hack has been around for ages. By changing, we get the following
benefits:

- We don't link in _every_ object in _every_ archive!
- Builds will no longer fail if a source file has been removed but its object
  still exists in the archive
- Filesize reduction
- Ability to use lto, garbage collection, dead-code stripping, etc in a
  useful manner

This is achieved by specifying a main object on the link line, and using
start-group/end-group to search through the archives multiple times until each
symbol is found.
Merge pull request #2712 from theuni/no-whole-archive

build: stop using whole-archive for our final binary