vboot-utils: fix musl

This commit is contained in:
Enno Boland 2015-07-21 19:39:40 +02:00
parent 378ce6bdde
commit d43f18166b
2 changed files with 53 additions and 4 deletions

View file

@ -0,0 +1,49 @@
--- firmware/stub/vboot_api_stub_sf.c.orig
+++ firmware/stub/vboot_api_stub_sf.c
@@ -5,7 +5,9 @@
* Stub implementations of firmware-provided API functions.
*/
+#if defined(__GLIBC__)
#include <execinfo.h>
+#endif
#include <stdint.h>
#define _STUB_IMPLEMENTATION_
@@ -34,11 +36,13 @@ static struct alloc_node *alloc_head;
static void print_stacktrace(void)
{
+#if defined(__GLIBC__)
void *buffer[MAX_STACK_LEVELS];
int levels = backtrace(buffer, MAX_STACK_LEVELS);
// print to stderr (fd = 2), and remove this function from the trace
backtrace_symbols_fd(buffer + 1, levels - 1, 2);
+#endif
}
void *VbExMalloc(size_t size)
@@ -57,7 +61,11 @@ void *VbExMalloc(size_t size)
node->next = alloc_head;
node->ptr = p;
node->size = size;
+#if defined(__GLIBC__)
node->bt_levels = backtrace(node->bt_buffer, MAX_STACK_LEVELS);
+#else
+ node->bt_levels = 0;
+#endif
alloc_head = node;
return p;
@@ -118,8 +126,10 @@ int vboot_api_stub_check_memory(void)
next = node->next;
fprintf(stderr, "\nptr=%p, size=%zd\n", node->ptr, node->size);
fflush(stderr);
+#if defined(__GLIBC__)
backtrace_symbols_fd(node->bt_buffer + 1, node->bt_levels - 1,
2);
+#endif
free(node);
}

View file

@ -1,8 +1,8 @@
# Template file for 'vboot-utils'
pkgname=vboot-utils
version=45.7262
revision=3
_githash=0e8c964915fffb58032bb59bdb31949de718ca90
revision=2
hostmakedepends="pkg-config git"
makedepends="libressl-devel libuuid-devel liblzma-devel libyaml-devel"
short_desc="Verified boot kernel utilities"
@ -12,9 +12,9 @@ homepage="https://chromium.googlesource.com/chromiumos/platform/vboot_reference.
CFLAGS='-D_GNU_SOURCE -Wno-error'
do_fetch() {
git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git $pkgname-$version || true
cd $pkgname-$version
git checkout $_githash
git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git $pkgname-$version || true
cd $pkgname-$version
git checkout $_githash
}
do_build() {