From 132faaf178d99315efd9034f9c6670a635736f3b Mon Sep 17 00:00:00 2001 From: jlinenkohl Date: Sun, 3 May 2026 11:11:07 -0400 Subject: [PATCH] guest: fix freestanding GCC malloc/free declarations --- guest/src/crc32c.cpp | 3 +++ guest/src/guest.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/guest/src/crc32c.cpp b/guest/src/crc32c.cpp index 2515f498..edf02582 100644 --- a/guest/src/crc32c.cpp +++ b/guest/src/crc32c.cpp @@ -1,5 +1,8 @@ #include "api.hpp" +#include +extern "C" void* malloc(size_t); +extern "C" void free(void*); #include inline bool ____is__aligned(const void* buffer, const int align) noexcept { diff --git a/guest/src/guest.cpp b/guest/src/guest.cpp index a6331fb7..11316988 100644 --- a/guest/src/guest.cpp +++ b/guest/src/guest.cpp @@ -32,6 +32,9 @@ struct Data { size_t len; }; +#include +extern "C" void* malloc(size_t); +extern "C" void free(void*); #include PUBLIC(uint32_t empty(const Data& data)) {