| Message ID | 20251201170529.3237986-30-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608976; bh=/Uq/h3ABGJ43VhrKvYE5rYx2zIEZEfGGlEF42C7Ia6o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Izaj8JuII6fBY6CmFMi4HjnVj1SQxwSKv498LO1IsYKlymgadGCCJuARJ1FFN4+a2 1bck0ZgvzQtECtIMXA1nCqsYUGqRXRBqeiuMG6mY1UzBkCZfdnkWORDxXrsbHt7eHi iTGXNO8u2G/qtiB26YcZ7E5MMbfZeA/X3G4P1OJGHzePHpKyFYfBXI/Xgl//7Kl4YB 7g96D99mL7mBUTWCpV1sZHHul7Urf0JfNFLkepAoxDo0RbW448S0GTkHEzPPWvPBFY udljzHJj/UlB1bM4v9sO0P/5EtoRRwWyYeOoTaphsHaTChvBeWm0MWM6gkTPXooH0L 0SbqDuV7BPHtg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DED95688CD for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:36 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 5a_-ZJEqbh0t for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608976; bh=/Uq/h3ABGJ43VhrKvYE5rYx2zIEZEfGGlEF42C7Ia6o=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Izaj8JuII6fBY6CmFMi4HjnVj1SQxwSKv498LO1IsYKlymgadGCCJuARJ1FFN4+a2 1bck0ZgvzQtECtIMXA1nCqsYUGqRXRBqeiuMG6mY1UzBkCZfdnkWORDxXrsbHt7eHi iTGXNO8u2G/qtiB26YcZ7E5MMbfZeA/X3G4P1OJGHzePHpKyFYfBXI/Xgl//7Kl4YB 7g96D99mL7mBUTWCpV1sZHHul7Urf0JfNFLkepAoxDo0RbW448S0GTkHEzPPWvPBFY udljzHJj/UlB1bM4v9sO0P/5EtoRRwWyYeOoTaphsHaTChvBeWm0MWM6gkTPXooH0L 0SbqDuV7BPHtg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF1AF688B6 for <u-boot-concept@u-boot.org>; Mon, 1 Dec 2025 10:09:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608974; bh=dBv8CAMn2/hNejBEz43uz2BjFWfzjMaLBZ5Jbd2xyXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWE9LXBP9LD6DMlQWeOjqZn/gh6YXAE2Bdtc5Nw3u6KAyJr371KPgCoEinSVsFuHS i1dB+95D2iq8HGAuV9QDM790ztm7OYQ534s5fNwv3ewzuwJzm511PQt4jTyAIAWWYc PATNFeItCGH6EejMjfTTOYdSpMRsgEawhqKd1SR0eEzwOIUFpcvF4XbxNpUQ84xlKs 61tpvMs5b0aT1b9a0rlMDnWJROquATVrRI2OxZc8jsTOfXeEhNky+aWVoaqI79H4LO yryzsj9PwUQm7u0ajo/9ef02LPURkzcszb4LIVwlRQ0V3WGpzDiDyx9HVKxo4cAJhs hDT4iXR0nludQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D56AF687F3; Mon, 1 Dec 2025 10:09:34 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id yaE2fvzuw8My; Mon, 1 Dec 2025 10:09:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1764608968; bh=s8u+TjIG0pP2bnjGtkvuC4rvtxd74j40UsdlT9vtyQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIIJOsiAMFppvL7olaQ7nOiqqQHWnZX+3S9qcIdAaYdQVVeTXfKSpd3jDZfXV96Qx VfeYZJ6zg5s0xrASxMZWlKO6fGH2OgW7c5/k23FxFeNq21lgCrKBF8fI5yJ5AztA9w vR4Wo93WWMep8DImXItx7Ja49NSG09f2HwR/fJFivEhW5o/5q1+UGSYObDjOQ5sx5z 3EjuTlCQwKtHpbJlksFgsSaTV8o4MvGSOgMTly9Nt7u8IYib1TYNvckXgx6JZzYvET qFtLNvtRo/HVZwc8HEOtz9AetgWszuNMv4QazIj6MLBbzZdNDJXm5wuAl0A1IVThYW s88rH4ny5uFow== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8959F6888B; Mon, 1 Dec 2025 10:09:28 -0700 (MST) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Mon, 1 Dec 2025 10:05:08 -0700 Message-ID: <20251201170529.3237986-30-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251201170529.3237986-1-sjg@u-boot.org> References: <20251201170529.3237986-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BMUJHUHMPFXBGLO3E6G63MOSGEIPNRPC X-Message-ID-Hash: BMUJHUHMPFXBGLO3E6G63MOSGEIPNRPC X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <simon.glass@canonical.com>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 29/37] malloc: Allow building dlmalloc with SPL_SYS_MALLOC_SIMPLE List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/BMUJHUHMPFXBGLO3E6G63MOSGEIPNRPC/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
malloc: Import dlmalloc 2.8.6
|
|
Commit Message
Simon Glass
Dec. 1, 2025, 5:05 p.m. UTC
From: Simon Glass <simon.glass@canonical.com> When building boards that use CONFIG_SPL_SYS_MALLOC_SIMPLE (like qemu-x86_64), we need to avoid a conflict between the stub free() function defined by malloc and the real free() defined by dlmalloc.c Fix this by define COMPILING_DLMALLOC in dlmalloc.c before including malloc.h and adding a guard to the latter. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- common/dlmalloc.c | 2 ++ include/malloc.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 9330848d059..869473b2bd1 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -603,6 +603,8 @@ static inline void MALLOC_COPY(void *dest, const void *src, size_t sz) { memcpy( #define MALLOC_FAILURE_ACTION #define ABORT do {} while (1) +#define COMPILING_DLMALLOC + #include <log.h> #include <malloc.h> #include <mapmem.h> diff --git a/include/malloc.h b/include/malloc.h index f8f0dbb9b70..997651e5c9c 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -72,7 +72,7 @@ extern "C" { * When using simple malloc (SPL/TPL), redirect to simple implementations. * Skip this when compiling dlmalloc.c itself to avoid conflicts. */ -#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) +#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) && !defined(COMPILING_DLMALLOC) #define malloc malloc_simple #define realloc realloc_simple #define calloc calloc_simple