summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-11-28 12:28:04 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-30 03:20:39 +0000
commit91852e7f58d50a031bcb5c02e68473cefb10ebb0 (patch)
treef47013fed9af215dc84546449aa9245e3554edb6
parentc644a8c0f2df024798ac0e60c6028261ed389a16 (diff)
downloadvboot-91852e7f58d50a031bcb5c02e68473cefb10ebb0.tar.gz
futility: workaround for broken toolchain in static builds
The cros-compiler doesn't support backtrace(3) when linked statically. Until that's fixed, just don't use it. BUG=chromium:437107 BRANCH=ToT, samus TEST=manual FEATURES=test emerge-link vboot_reference /build/link/usr/bin/futility_s gbb_utility -c 100,100,100,100 test.bin /build/link/usr/bin/futility_s gbb_utility -s --hwid=HEY test.bin Change-Id: I66b76fc8c0aa92f95976c5d5015f62730bb12064 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232234 Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rw-r--r--Makefile4
-rw-r--r--firmware/stub/vboot_api_stub_static_sf.c39
2 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e18679f5..dbd89253 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 00000000..c266177d
--- /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 <stdio.h>
+#include <stdlib.h>
+
+#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;
+}