Makefile: Enable linker garbage collection

This patch enables -ffunction-sections, -fdata-sections and
-Wl,--gc-sections for host builds. These flags already get passed by
firmware builds anyway, so having host builds match that behavior should
be a good idea in general. They may also occasionally help save a bit of
code size (though not much since vboot is a library, but I still get
about half a KB out of futility), and they will prevent clang from
omitting relocations for function calls inside the same file, which
means we don't have to splatter test_mockable all over our codebase
anymore. (We still need it for vb2_get_gbb() since that is so small that
both GCC and clang want to inline it, even if they are outputting a
discrete copy anyway.)

(Also add a comment about why GenerateGuid() has nothing do to with this
even though it is also a weak function, and why it is like that.)

BRANCH=None
BUG=chromium:991812
TEST=make runtests with both GCC and clang

Change-Id: Iede9d29e20b99b75a0c86bc7ecb907d2a0e5e3a1
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1754969
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
5 files changed