summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2015-01-06 07:45:54 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-06 22:55:26 +0000
commitda102c25d508e7dfe385bfe9e62ff8363a885632 (patch)
tree9bc03a72ebb75c1f37715de69cfeed0c0bdd0a42
parent728d879960637e753978f309025833ddd8b44137 (diff)
downloadvboot-da102c25d508e7dfe385bfe9e62ff8363a885632.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 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232234 Reviewed-by: Mike Frysinger <vapier@chromium.org> (cherry picked from commit 91852e7f58d50a031bcb5c02e68473cefb10ebb0) Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Change-Id: I66b76fc8c0aa92f95976c5d5015f62730bb12064 Reviewed-on: https://chromium-review.googlesource.com/238529 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org> Trybot-Ready: Duncan Laurie <dlaurie@chromium.org> Tested-by: Duncan Laurie <dlaurie@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 fc96dd84..cc564086 100644
--- a/Makefile
+++ b/Makefile
@@ -563,7 +563,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;
+}