libunwind: guard unreachable() macro to avoid redefinition with stddef.h

The build fails due to a macro redefinition conflict for `unreachable()`.
GCC 15.2.0 defines `unreachable()` in `stddef.h`, and `libunwind_i.h` also
defines it based on the presence of `HAVE__BUILTIN_UNREACHABLE`. This causes
a redefinition error when building with `-Werror`.

Added a guard around the `unreachable()` macro definition in `libunwind_i.h`
to ensure it is only defined if not already present.

Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Sasi Kumar Maddineni 2025-10-29 11:11:19 +05:30 committed by Khem Raj
parent 838dbfc496
commit aa430364a2
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From e64495a109eefaf87235729f4dd79fc9121c16a6 Mon Sep 17 00:00:00 2001
From: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
Date: Mon, 27 Oct 2025 19:39:05 +0530
Subject: [PATCH] libunwind: guard unreachable() macro to avoid redefinition
with stddef.h
The build fails due to a macro redefinition conflict for `unreachable()`.
GCC 15.2.0 defines `unreachable()` in `stddef.h`, and `libunwind_i.h` also
defines it based on the presence of `HAVE__BUILTIN_UNREACHABLE`. This causes
a redefinition error when building with `-Werror`.
Added a guard around the `unreachable()` macro definition in `libunwind_i.h`
to ensure it is only defined if not already present.
Upstream-Status: Pending
Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
---
external/libunwind/include/libunwind_i.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/external/libunwind/include/libunwind_i.h b/external/libunwind/include/libunwind_i.h
index c06912a6..59a462df 100644
--- a/external/libunwind/include/libunwind_i.h
+++ b/external/libunwind/include/libunwind_i.h
@@ -88,11 +88,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# endif
#endif
+#if !defined(unreachable)
#if defined(HAVE__BUILTIN_UNREACHABLE)
# define unreachable() __builtin_unreachable()
#else
# define unreachable() do { } while (1)
#endif
+#endif
#ifdef DEBUG
# define UNW_DEBUG 1
--
2.34.1

View File

@ -21,6 +21,7 @@ SRC_URI += " \
file://debian/external/libunwind/user_pt_regs.patch \
file://debian/external/libunwind/legacy_built-in_sync_functions.patch \
file://debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch \
file://debian/external/libunwind/libunwind-guard-unreachable-macro-to-avoid-redefinit.patch \
\
file://debian/system/core/move-log-file-to-proper-dir.patch \
file://debian/system/core/Added-missing-headers.patch \