summaryrefslogtreecommitdiffstats
path: root/utils/plymouth/patches/101-main-build-crash-handler-without-execinfo.patch
blob: 52e3c405b131dde1e320ad16e4eacc0ca3a470dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 29124ae4d8307bc8332b4678eb8cd4434b4bb872 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Thu, 24 Sep 2026 21:08:57 +0100
Subject: [PATCH] main: keep the crash handler building without execinfo

backtrace() and execinfo.h are glibc extensions, so the crash handler
fails to build against musl. Guard both the include and the body of
write_backtrace, and record that the backtrace is unavailable, leaving
the maps dump and the rest of the crash report intact.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 src/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/src/main.c
+++ b/src/main.c
@@ -2202,7 +2202,9 @@ dump_debug_buffer_to_file (void)
 
 #include <termios.h>
 #include <unistd.h>
+#ifdef __GLIBC__
 #include <execinfo.h>
+#endif
 
 #define BACKTRACE_SIZE 1024
 #define MAPS_SIZE 8192
@@ -2252,6 +2254,7 @@ write_maps (int output_fd)
 static void
 write_backtrace (int output_fd)
 {
+#ifdef __GLIBC__
         void *addresses[BACKTRACE_SIZE];
         int number_of_addresses;
 
@@ -2264,6 +2267,10 @@ write_backtrace (int output_fd)
         backtrace_symbols_fd (addresses + BACKTRACE_FRAMES_TO_SKIP,
                               number_of_addresses - BACKTRACE_FRAMES_TO_SKIP,
                               output_fd);
+#else
+        write (output_fd, "backtrace: unavailable\n",
+               strlen ("backtrace: unavailable\n"));
+#endif
 }
 
 static void