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>
This commit is contained in:
Bill Richardson
2014-11-28 12:28:04 -08:00
committed by chrome-internal-fetch
parent c644a8c0f2
commit 91852e7f58
2 changed files with 43 additions and 0 deletions

View File

@@ -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}

View File

@@ -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;
}