diff --git a/Makefile b/Makefile index e18679f526..dbd89253c3 100644 --- a/Makefile +++ b/Makefile @@ -566,7 +566,11 @@ endif FUTIL_STATIC_CMD_LIST = ${BUILD}/gen/futility_static_cmds.c FUTIL_CMD_LIST = ${BUILD}/gen/futility_cmds.c +# Workaround for TODO(crbug.com/437107). +FUTIL_STATIC_WORKAROUND_SRCS = firmware/stub/vboot_api_stub_static_sf.c + FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} \ + ${FUTIL_STATIC_WORKAROUND_SRCS:%.c=${BUILD}/%.o} \ ${FUTIL_STATIC_CMD_LIST:%.c=%.o} FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} ${FUTIL_CMD_LIST:%.c=%.o} diff --git a/firmware/stub/vboot_api_stub_static_sf.c b/firmware/stub/vboot_api_stub_static_sf.c new file mode 100644 index 0000000000..c266177db5 --- /dev/null +++ b/firmware/stub/vboot_api_stub_static_sf.c @@ -0,0 +1,39 @@ +/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Workaround for TODO(crbug.com/437107). Remove this file when it's fixed. + */ + +#define _STUB_IMPLEMENTATION_ + +#include +#include + +#include "vboot_api.h" + +void *VbExMalloc(size_t size) +{ + void *p = malloc(size); + + if (!p) { + /* Fatal Error. We must abort. */ + abort(); + } + + return p; +} +void VbExFree(void *ptr) +{ + free(ptr); +} + + +/* + * This file should be used only when building the static version of futility, + * so let's intentionally break any tests that link with it by accident. + */ +int vboot_api_stub_check_memory(void) +{ + return -1; +}