diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | cgpt/cgpt_common.c | 10 | ||||
-rw-r--r-- | firmware/include/vboot_api.h | 7 | ||||
-rw-r--r-- | firmware/lib20/packed_key.c | 1 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub_init.c | 2 |
5 files changed, 16 insertions, 12 deletions
@@ -141,7 +141,8 @@ FIRMWARE_FLAGS := -nostdinc -ffreestanding -fno-builtin -fno-stack-protector COMMON_FLAGS := -pipe ${WERROR} -Wall -Wstrict-prototypes -Wtype-limits \ -Wundef -Wmissing-prototypes -Wno-trigraphs -Wredundant-decls \ -Wwrite-strings -Wstrict-aliasing -Wshadow -Wdate-time \ - -Wno-address-of-packed-member ${DEBUG_FLAGS} + -Wno-address-of-packed-member -ffunction-sections -fdata-sections \ + ${DEBUG_FLAGS} # Note: FIRMWARE_ARCH is defined by the Chromium OS ebuild. ifeq (${FIRMWARE_ARCH}, arm) @@ -151,7 +152,7 @@ CFLAGS ?= -march=armv5 -fno-common -ffixed-r8 -mfloat-abi=hard -marm else ifeq (${FIRMWARE_ARCH}, x86) CC ?= i686-pc-linux-gnu-gcc # Drop -march=i386 to permit use of SSE instructions -CFLAGS ?= -ffunction-sections -fvisibility=hidden -fomit-frame-pointer \ +CFLAGS ?= -fvisibility=hidden -fomit-frame-pointer \ -fno-toplevel-reorder -fno-dwarf2-cfi-asm -mpreferred-stack-boundary=2 \ ${FIRMWARE_FLAGS} ${COMMON_FLAGS} else ifeq (${FIRMWARE_ARCH}, x86_64) @@ -164,6 +165,9 @@ CFLAGS += -DCHROMEOS_ENVIRONMENT ${COMMON_FLAGS} CHROMEOS_ENVIRONMENT = 1 endif +# Needs -Wl because LD is actually set to CC by default. +LDFLAGS ?= -Wl,--gc-sections + ifneq (${DEBUG},) CFLAGS += -DVBOOT_DEBUG endif diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c index db180bef..e98a4533 100644 --- a/cgpt/cgpt_common.c +++ b/cgpt/cgpt_common.c @@ -1086,7 +1086,15 @@ void PMBRToStr(struct pmbr *pmbr, char *str, unsigned int buflen) { } } -/* Optional */ +/* + * This is here because some CGPT functionality is provided in libvboot_host.a + * for other host utilities. GenerateGuid() is implemented (in cgpt.c which is + * *not* linked into libvboot_host.a) by calling into libuuid. We don't want to + * mandate libuuid as a dependency for every utilitity that wants to link + * libvboot_host.a, since they usually don't use the functionality that needs + * to generate new UUIDs anyway (just other functionality implemented in the + * same files). + */ #ifndef HAVE_MACOS __attribute__((weak)) int GenerateGuid(Guid *newguid) { return CGPT_FAILED; }; #endif 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; } |