[libc-commits] [libc] [libc] Use `<assert.h>` in overlay mode for LIBC_ASSERT (PR #99875)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Jul 22 08:08:59 PDT 2024
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/99875
>From 5d2f15da46ae1ad40fa31f70801c1be124344954 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 22 Jul 2024 08:49:43 -0500
Subject: [PATCH] [libc] Use `<assert.h>` in overlay mode for LIBC_ASSERT
Summary:
This uses `internal::exit` which is not built in overlay mode, leading
to linker errors. Fix this to just use `assert.h`.
---
libc/src/__support/libc_assert.h | 2 +-
libc/src/__support/threads/linux/raw_mutex.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h
index e3235199780c2..e21a58a0c8aad 100644
--- a/libc/src/__support/libc_assert.h
+++ b/libc/src/__support/libc_assert.h
@@ -10,7 +10,7 @@
#define LLVM_LIBC_SRC___SUPPORT_LIBC_ASSERT_H
#include "src/__support/macros/config.h"
-#ifdef LIBC_COPT_USE_C_ASSERT
+#if defined(LIBC_COPT_USE_C_ASSERT) || !defined(LIBC_FULL_BUILD)
// The build is configured to just use the public <assert.h> API
// for libc's internal assertions.
diff --git a/libc/src/__support/threads/linux/raw_mutex.h b/libc/src/__support/threads/linux/raw_mutex.h
index dbf8b53b42f7e..47f0aa70f1c46 100644
--- a/libc/src/__support/threads/linux/raw_mutex.h
+++ b/libc/src/__support/threads/linux/raw_mutex.h
@@ -13,6 +13,7 @@
#include "src/__support/libc_assert.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
#include "src/__support/threads/linux/futex_utils.h"
#include "src/__support/threads/linux/futex_word.h"
#include "src/__support/threads/sleep.h"
More information about the libc-commits
mailing list