blob: efaedad70b8f5e8477899ef62227c630aeb3f031 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
From 52db447c94974cd946de8d9d7031b91d41ad1280 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Wed, 26 Feb 2025 18:24:00 +0000
Subject: [PATCH 3/4] ubifs-utils: link libmissing.a in case execinfo.h isn't
present
On musl execinfo.h doesn't exist, but ubifs-utils uses backtrace() when
reporting errors. This results in build failures under musl.
Handily, libmissing.a already exists with a stub implementation of
backtrace().
Guard the execinfo.h include and if it isn't available instead include
libmissing.h, and link to libmissing.a to provide backtrace() if needed.
Upstream-Status: Backport [https://github.com/sigma-star/mtd-utils/commit/8a83b306db64d6f60186d4396b0b770163b85b6e]
Signed-off-by: Ross Burton <ross.burton@arm.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
ubifs-utils/Makemodule.am | 4 ++--
ubifs-utils/common/defs.h | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am
index 21ba0597d84a..f84569a6da44 100644
--- a/ubifs-utils/Makemodule.am
+++ b/ubifs-utils/Makemodule.am
@@ -72,7 +72,7 @@ mkfs_ubifs_SOURCES = \
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
mkfs_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
- $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
+ $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
mkfs_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs
@@ -90,7 +90,7 @@ fsck_ubifs_SOURCES = \
ubifs-utils/fsck.ubifs/handle_disconnected.c
fsck_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
- $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
+ $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
fsck_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs \
-I$(top_srcdir)/ubifs-utils/fsck.ubifs
diff --git a/ubifs-utils/common/defs.h b/ubifs-utils/common/defs.h
index 7ff1771674d9..d5edbf67439a 100644
--- a/ubifs-utils/common/defs.h
+++ b/ubifs-utils/common/defs.h
@@ -13,8 +13,11 @@
#include <errno.h>
#include <time.h>
#include <assert.h>
+#if HAVE_EXECINFO_H
#include <execinfo.h>
-
+#else
+#include "libmissing.h"
+#endif
#include "ubifs.h"
/* common.h requires the PROGRAM_NAME macro */
--
2.34.1
|