summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2025-11-10 20:29:55 -0800
committerKhem Raj <raj.khem@gmail.com>2025-11-10 20:31:55 -0800
commit844f1213d2d93b9c24d1d178ff93c68b9aa88d01 (patch)
tree2cf013dd8be00399ab3fb9229260a79ea34964e7
parentf2fa2dc3cfc1f55cb99f5603157f1af81fa4f0a9 (diff)
downloadmeta-openembedded-844f1213d2d93b9c24d1d178ff93c68b9aa88d01.tar.gz
libldb: Fix build with glibc 2.43
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-networking/recipes-support/libldb/libldb/c23_memset_explicit.patch248
-rw-r--r--meta-networking/recipes-support/libldb/libldb_2.8.2.bb1
2 files changed, 249 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/libldb/libldb/c23_memset_explicit.patch b/meta-networking/recipes-support/libldb/libldb/c23_memset_explicit.patch
new file mode 100644
index 0000000000..bd817d8cf5
--- /dev/null
+++ b/meta-networking/recipes-support/libldb/libldb/c23_memset_explicit.patch
@@ -0,0 +1,248 @@
1C23 introduced memset_explicit with the same parameters as
2memset (3 args). New glibc implements it, so the symbol now
3exists in the global namespace with that prototype, causing
4“too many arguments” when your code passes 4 args.
5
6Provide a compatibility macro to address the problem
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10--- a/lib/replace/replace.c
11+++ b/lib/replace/replace.c
12@@ -1,4 +1,4 @@
13-/*
14+/*
15 Unix SMB/CIFS implementation.
16 replacement routines for broken systems
17 Copyright (C) Andrew Tridgell 1992-1998
18@@ -8,7 +8,7 @@
19 ** NOTE! The following LGPL license applies to the replace
20 ** library. This does NOT imply that all of Samba is released
21 ** under the LGPL
22-
23+
24 This library is free software; you can redistribute it and/or
25 modify it under the terms of the GNU Lesser General Public
26 License as published by the Free Software Foundation; either
27@@ -44,6 +44,18 @@
28 void replace_dummy(void);
29 void replace_dummy(void) {}
30
31+#if defined(HAVE_MEMSET_EXPLICIT)
32+# define LDB_MEMSET_EXPLICIT(dest, destsz, ch, n) memset_explicit((dest),(ch),(n))
33+#elif defined(HAVE_MEMSET_S)
34+# define LDB_MEMSET_EXPLICIT(dest, destsz, ch, n) memset_s((dest),(destsz),(ch),(n))
35+#else
36+# define LDB_MEMSET_EXPLICIT(dest, destsz, ch, n) do { \
37+ volatile unsigned char *p = (volatile unsigned char*)(dest); \
38+ size_t _N = (n); unsigned char _CH = (unsigned char)(ch); \
39+ for (size_t _i = 0; _i < _N; ++_i) p[_i] = _CH; \
40+ } while (0)
41+#endif
42+
43 #ifndef HAVE_FTRUNCATE
44 /*******************************************************************
45 ftruncate for operating systems that don't have it
46@@ -91,7 +103,7 @@ size_t rep_strlcpy(char *d, const char *
47 #endif
48
49 #ifndef HAVE_STRLCAT
50-/* like strncat but does not 0 fill the buffer and always null
51+/* like strncat but does not 0 fill the buffer and always null
52 terminates. bufsize is the length of the buffer, which should
53 be one more than the maximum resulting string length */
54 size_t rep_strlcat(char *d, const char *s, size_t bufsize)
55@@ -116,7 +128,7 @@ size_t rep_strlcat(char *d, const char *
56
57 #ifndef HAVE_MKTIME
58 /*******************************************************************
59-a mktime() replacement for those who don't have it - contributed by
60+a mktime() replacement for those who don't have it - contributed by
61 C.A. Lademann <cal@zls.com>
62 Corrections by richard.kettlewell@kewill.com
63 ********************************************************************/
64@@ -137,7 +149,7 @@ time_t rep_mktime(struct tm *t)
65 return((time_t)-1);
66
67 n = t->tm_year + 1900 - 1;
68- epoch = (t->tm_year - 70) * YEAR +
69+ epoch = (t->tm_year - 70) * YEAR +
70 ((n / 4 - n / 100 + n / 400) - (1969 / 4 - 1969 / 100 + 1969 / 400)) * DAY;
71
72 y = t->tm_year + 1900;
73@@ -147,7 +159,7 @@ time_t rep_mktime(struct tm *t)
74 epoch += mon [m] * DAY;
75 if(m == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
76 epoch += DAY;
77-
78+
79 if(++m > 11) {
80 m = 0;
81 y++;
82@@ -156,7 +168,7 @@ time_t rep_mktime(struct tm *t)
83
84 epoch += (t->tm_mday - 1) * DAY;
85 epoch += t->tm_hour * HOUR + t->tm_min * MINUTE + t->tm_sec;
86-
87+
88 if((u = localtime(&epoch)) != NULL) {
89 t->tm_sec = u->tm_sec;
90 t->tm_min = u->tm_min;
91@@ -176,7 +188,7 @@ time_t rep_mktime(struct tm *t)
92
93 #ifndef HAVE_INITGROUPS
94 /****************************************************************************
95- some systems don't have an initgroups call
96+ some systems don't have an initgroups call
97 ****************************************************************************/
98 int rep_initgroups(char *name, gid_t id)
99 {
100@@ -194,7 +206,7 @@ int rep_initgroups(char *name, gid_t id)
101 int i,j;
102 struct group *g;
103 char *gr;
104-
105+
106 if((grouplst = malloc(sizeof(gid_t) * max_gr)) == NULL) {
107 errno = ENOMEM;
108 return -1;
109@@ -250,9 +262,9 @@ void *rep_memmove(void *dest,const void
110
111 if (d < s) {
112 /* we can forward copy */
113- if (s-d >= sizeof(int) &&
114- !(s%sizeof(int)) &&
115- !(d%sizeof(int)) &&
116+ if (s-d >= sizeof(int) &&
117+ !(s%sizeof(int)) &&
118+ !(d%sizeof(int)) &&
119 !(size%sizeof(int))) {
120 /* do it all as words */
121 int *idest = (int *)dest;
122@@ -267,9 +279,9 @@ void *rep_memmove(void *dest,const void
123 }
124 } else {
125 /* must backward copy */
126- if (d-s >= sizeof(int) &&
127- !(s%sizeof(int)) &&
128- !(d%sizeof(int)) &&
129+ if (d-s >= sizeof(int) &&
130+ !(s%sizeof(int)) &&
131+ !(d%sizeof(int)) &&
132 !(size%sizeof(int))) {
133 /* do it all as words */
134 int *idest = (int *)dest;
135@@ -281,7 +293,7 @@ void *rep_memmove(void *dest,const void
136 char *cdest = (char *)dest;
137 char *csrc = (char *)src;
138 for (i=size-1;i>=0;i--) cdest[i] = csrc[i];
139- }
140+ }
141 }
142 return(dest);
143 }
144@@ -334,16 +346,16 @@ void rep_vsyslog (int facility_priority,
145 size_t rep_strnlen(const char *s, size_t max)
146 {
147 size_t len;
148-
149+
150 for (len = 0; len < max; len++) {
151 if (s[len] == '\0') {
152 break;
153 }
154 }
155- return len;
156+ return len;
157 }
158 #endif
159-
160+
161 #ifndef HAVE_STRNDUP
162 /**
163 Some platforms don't have strndup.
164@@ -351,7 +363,7 @@ void rep_vsyslog (int facility_priority,
165 char *rep_strndup(const char *s, size_t n)
166 {
167 char *ret;
168-
169+
170 n = strnlen(s, n);
171 ret = malloc(n+1);
172 if (!ret)
173@@ -407,7 +419,7 @@ int rep_chroot(const char *dname)
174
175 /*****************************************************************
176 Possibly replace mkstemp if it is broken.
177-*****************************************************************/
178+*****************************************************************/
179
180 #ifndef HAVE_SECURE_MKSTEMP
181 int rep_mkstemp(char *template)
182@@ -425,7 +437,7 @@ int rep_mkstemp(char *template)
183 char *rep_mkdtemp(char *template)
184 {
185 char *dname;
186-
187+
188 if ((dname = mktemp(template))) {
189 if (mkdir(dname, 0700) >= 0) {
190 return dname;
191@@ -532,7 +544,7 @@ long long int rep_strtoll(const char *st
192 {
193 #ifdef HAVE_STRTOQ
194 return strtoq(str, endptr, base);
195-#elif defined(HAVE___STRTOLL)
196+#elif defined(HAVE___STRTOLL)
197 return __strtoll(str, endptr, base);
198 #elif SIZEOF_LONG == SIZEOF_LONG_LONG
199 return (long long int) strtol(str, endptr, base);
200@@ -568,7 +580,7 @@ unsigned long long int rep_strtoull(cons
201 {
202 #ifdef HAVE_STRTOUQ
203 return strtouq(str, endptr, base);
204-#elif defined(HAVE___STRTOULL)
205+#elif defined(HAVE___STRTOULL)
206 return __strtoull(str, endptr, base);
207 #elif SIZEOF_LONG == SIZEOF_LONG_LONG
208 return (unsigned long long int) strtoul(str, endptr, base);
209@@ -599,7 +611,7 @@ unsigned long long int rep_strtoull(cons
210 #endif /* HAVE_STRTOULL */
211
212 #ifndef HAVE_SETENV
213-int rep_setenv(const char *name, const char *value, int overwrite)
214+int rep_setenv(const char *name, const char *value, int overwrite)
215 {
216 char *p;
217 size_t l1, l2;
218@@ -644,10 +656,10 @@ int rep_unsetenv(const char *name)
219 for (i=0;environ[i];i++) /* noop */ ;
220
221 count=i;
222-
223+
224 for (i=0;i<count;) {
225 if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') {
226- /* note: we do _not_ free the old variable here. It is unsafe to
227+ /* note: we do _not_ free the old variable here. It is unsafe to
228 do so, as the pointer may not have come from malloc */
229 memmove(&environ[i], &environ[i+1], (count-i)*sizeof(char *));
230 count--;
231@@ -688,7 +700,7 @@ int rep_utimes(const char *filename, con
232 #endif
233
234 #ifndef HAVE_DUP2
235-int rep_dup2(int oldfd, int newfd)
236+int rep_dup2(int oldfd, int newfd)
237 {
238 errno = ENOSYS;
239 return -1;
240@@ -970,7 +982,7 @@ int rep_memset_s(void *dest, size_t dest
241 }
242
243 #if defined(HAVE_MEMSET_EXPLICIT)
244- memset_explicit(dest, destsz, ch, count);
245+ LDB_MEMSET_EXPLICIT(dest, destsz, ch, count);
246 #else /* HAVE_MEMSET_EXPLICIT */
247 memset(dest, ch, count);
248 # if defined(HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
diff --git a/meta-networking/recipes-support/libldb/libldb_2.8.2.bb b/meta-networking/recipes-support/libldb/libldb_2.8.2.bb
index 6038066169..016b649cd9 100644
--- a/meta-networking/recipes-support/libldb/libldb_2.8.2.bb
+++ b/meta-networking/recipes-support/libldb/libldb_2.8.2.bb
@@ -13,6 +13,7 @@ SRC_URI = "https://samba.org/ftp/ldb/ldb-${PV}.tar.gz \
13 file://0001-do-not-import-target-module-while-cross-compile.patch \ 13 file://0001-do-not-import-target-module-while-cross-compile.patch \
14 file://0002-ldb-Add-configure-options-for-packages.patch \ 14 file://0002-ldb-Add-configure-options-for-packages.patch \
15 file://0003-Fix-pyext_PATTERN-for-cross-compilation.patch \ 15 file://0003-Fix-pyext_PATTERN-for-cross-compilation.patch \
16 file://c23_memset_explicit.patch \
16 file://run-ptest \ 17 file://run-ptest \
17 " 18 "
18 19