summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2019-08-14 16:40:01 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-08-16 17:39:55 -0700
commit83b4473899bf00a0b5a241b96ebf9de913fd50e4 (patch)
tree9c4829dbbbe85fed26ad9373330bef0fe69a0a6d /firmware
parenteb10ebf76d78a7ac7cb6b66c6f1bba747d4e10ca (diff)
downloadvboot-83b4473899bf00a0b5a241b96ebf9de913fd50e4.tar.gz
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>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/vboot_api.h7
-rw-r--r--firmware/lib20/packed_key.c1
-rw-r--r--firmware/stub/vboot_api_stub_init.c2
3 files changed, 1 insertions, 9 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 01106c0e..7f00ddc6 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -34,13 +34,6 @@ extern "C" {
struct vb2_context;
typedef struct VbSharedDataHeader VbSharedDataHeader;
-/*
- * Define test_mockable for mocking functions.
- */
-#ifndef test_mockable
-#define test_mockable __attribute__((weak))
-#endif
-
/*****************************************************************************/
/* Main entry points from firmware into vboot_reference */
diff --git a/firmware/lib20/packed_key.c b/firmware/lib20/packed_key.c
index af888e6e..42c66223 100644
--- a/firmware/lib20/packed_key.c
+++ b/firmware/lib20/packed_key.c
@@ -10,7 +10,6 @@
#include "2rsa.h"
#include "vb2_common.h"
-test_mockable
vb2_error_t vb2_unpack_key_buffer(struct vb2_public_key *key,
const uint8_t *buf, uint32_t size)
{
diff --git a/firmware/stub/vboot_api_stub_init.c b/firmware/stub/vboot_api_stub_init.c
index 8fbc31df..7dc4c01c 100644
--- a/firmware/stub/vboot_api_stub_init.c
+++ b/firmware/stub/vboot_api_stub_init.c
@@ -23,7 +23,7 @@ uint64_t VbExGetTimer(void)
return (uint64_t)tv.tv_sec * VB_USEC_PER_SEC + (uint64_t)tv.tv_usec;
}
-vb2_error_t test_mockable VbExNvStorageRead(uint8_t *buf)
+vb2_error_t VbExNvStorageRead(uint8_t *buf)
{
return VB2_SUCCESS;
}