summaryrefslogtreecommitdiff
path: root/dev-libs/elfutils/files/elfutils-0.164-musl-combined.patch
blob: ca8f475667779c931f17c0aebb30b4b5ad48b25d (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
--- src/strip.c	2015-10-12 12:22:58.000000000 +0200
+++ src/strip.c	2015-11-20 07:44:13.626287111 +0100
@@ -44,6 +44,10 @@
 #include <libebl.h>
 #include <system.h>
 
+#if !defined(ACCESSPERMS)
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
+#endif
+
 typedef uint8_t GElf_Byte;
 
 /* Name and version of program.  */
--- libdwfl/dwfl_build_id_find_elf.c	2015-10-12 12:22:58.000000000 +0200
+++ libdwfl/dwfl_build_id_find_elf.c	2015-11-20 05:13:10.972994172 +0100
@@ -94,7 +94,7 @@
 	{
 	  if (*file_name != NULL)
 	    free (*file_name);
-	  *file_name = canonicalize_file_name (name);
+	  *file_name = realpath (name, NULL);
 	  if (*file_name == NULL)
 	    {
 	      *file_name = name;
--- libdwfl/find-debuginfo.c	2015-10-12 12:22:58.000000000 +0200
+++ libdwfl/find-debuginfo.c	2015-11-20 05:18:56.990967176 +0100
@@ -372,7 +372,7 @@
       /* If FILE_NAME is a symlink, the debug file might be associated
 	 with the symlink target name instead.  */
 
-      char *canon = canonicalize_file_name (file_name);
+      char *canon = realpath (file_name, NULL);
       if (canon != NULL && strcmp (file_name, canon))
 	fd = find_debuginfo_in_path (mod, canon,
 				     debuglink_file, debuglink_crc,
--- libelf/elf.h	2015-08-21 14:22:37.000000000 +0200
+++ libelf/elf.h	2015-11-20 04:54:33.948081321 +0100
@@ -21,6 +21,17 @@
 
 #include <features.h>
 
+#if !defined(__GLIBC__)
+/* C++ needs to know that types and declarations are C, not C++.  */
+#ifdef  __cplusplus
+# define __BEGIN_DECLS  extern "C" {
+# define __END_DECLS    }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+#endif
+
 __BEGIN_DECLS
 
 /* Standard ELF types.  */
--- lib/fixedsizehash.h	2015-08-21 14:22:37.000000000 +0200
+++ lib/fixedsizehash.h	2015-11-20 05:05:45.648028916 +0100
@@ -30,12 +30,12 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/cdefs.h>
 #include <sys/param.h>
 
 #include <system.h>
 
-#define CONCAT(t1,t2) __CONCAT (t1,t2)
+#define CONCAT1(x,y) x##y
+#define CONCAT(x,y) CONCAT1(x,y)
 
 /* Before including this file the following macros must be defined:
 
--- configure.ac	2015-10-15 15:16:57.000000000 +0200
+++ configure.ac	2015-11-20 05:32:57.723901582 +0100
@@ -305,6 +305,62 @@
 fi
 AC_SUBST([argp_LDADD])
 
+dnl Check if we have fts available from our libc
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+		[#if !defined(__x86_64__)
+		#undef  _FILE_OFFSET_BITS
+		#define _FILE_OFFSET_BITS 32
+		#endif
+		#include <fts.h>],
+		[FTS* fts = 0; return fts_close(fts); return 0;]
+		)],
+	[libc_has_fts="true"],
+	[libc_has_fts="false"]
+)
+
+dnl If our libc doesn't provide fts, then test for libfts
+if test "$libc_has_fts" = "false" ; then
+	AC_MSG_WARN("libc does not have fts")
+	AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
+
+	if test "$have_fts" = "false"; then
+		AC_MSG_ERROR("no libfts found")
+	else
+		fts_LDADD="-lfts"
+	fi
+else
+	fts_LDADD=""
+fi
+AC_SUBST([fts_LDADD])
+
+dnl Check if we have obstack available from our libc
+AC_LINK_IFELSE(
+	[AC_LANG_PROGRAM(
+		[#include <obstack.h>],
+		[_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
+		)],
+	[libc_has_obstack="true"],
+	[libc_has_obstack="false"]
+)
+
+dnl If our libc doesn't provide obstack, then test for libobstack
+if test "$libc_has_obstack" = "false" ; then
+	AC_MSG_WARN("libc does not have obstack")
+	AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
+
+	if test "$have_obstack" = "false"; then
+		AC_MSG_ERROR("no libobstack found")
+	else
+		obstack_LDADD="-lobstack"
+	fi
+else
+	obstack_LDADD=""
+fi
+AC_SUBST([obstack_LDADD])
+
+dnl The directories with content.
+
 dnl The directories with content.
 
 dnl Documentation.
--- libdw/Makefile.am.orig	2016-04-02 12:20:57.174729538 +0200
+++ libdw/Makefile.am	2016-04-02 12:23:05.422736154 +0200
@@ -112,7 +112,7 @@
 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
 		-Wl,--version-script,$<,--no-undefined \
 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
-		-ldl -lz $(argp_LDADD) $(zip_LIBS)
+		-ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS)
 	@$(textrel_check)
 	$(AM_V_at)ln -fs $@ $@.$(VERSION)
 
--- libdw/libdw.h	2015-08-21 14:22:37.000000000 +0200
+++ libdw/libdw.h	2015-11-20 08:31:14.160067056 +0100
@@ -33,7 +33,27 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <unistd.h>
+#include <alloca.h>
+#include <string.h>
 
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+#endif
+
+#ifndef strndupa
+#define strndupa(s, n) \
+       (__extension__ ({const char *__in = (s); \
+                        size_t __len = strnlen (__in, (n)) + 1; \
+                        char *__out = (char *) alloca (__len); \
+                        __out[__len-1] = '\0'; \
+                        (char *) memcpy (__out, __in, __len-1);}))
+#endif
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
--- src/arlib.h	2015-08-21 14:22:37.000000000 +0200
+++ src/arlib.h	2015-11-20 08:02:55.153199611 +0100
@@ -29,6 +29,16 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+#if !defined(DEFFILEMODE)
+# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
+#endif
+
 
 /* State of -D/-U flags.  */
 extern bool arlib_deterministic_output;
--- src/elfcompress.c.orig	2016-04-02 12:51:26.903848894 +0200
+++ src/elfcompress.c	2016-04-02 12:55:15.076996338 +0200
@@ -35,6 +35,14 @@
 #include <gelf.h>
 #include "system.h"
 
+#if !defined(FNM_EXTMATCH)
+# define FNM_EXTMATCH 0
+#endif
+
+#if !defined(ALLPERMS)
+# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
+#endif
+
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
 ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
--- src/nm.c	2015-08-21 14:22:37.000000000 +0200
+++ src/nm.c	2015-11-20 07:31:20.508347429 +0100
@@ -46,6 +46,21 @@
 #include <system.h>
 #include "../libebl/libeblP.h"
 
+#if !defined(__GLIBC__)
+static int obstack_printf(struct obstack *obst, const char *fmt, ...)
+{
+	char buf[1024];
+	va_list ap;
+	int len;
+
+	va_start(ap, fmt);
+	len = vsnprintf(buf, sizeof(buf), fmt, ap);
+	obstack_grow(obst, buf, len);
+	va_end(ap);
+
+	return len;
+}
+#endif
 
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
--- src/readelf.c	2015-10-12 12:22:58.000000000 +0200
+++ src/readelf.c	2015-11-20 08:11:32.945159213 +0100
@@ -4366,10 +4366,11 @@
   return base;
 }
 
+static const char *listptr_name;
+
 static int
-compare_listptr (const void *a, const void *b, void *arg)
+compare_listptr (const void *a, const void *b)
 {
-  const char *name = arg;
   struct listptr *p1 = (void *) a;
   struct listptr *p2 = (void *) b;
 
@@ -4385,21 +4386,21 @@
 	  p1->warned = p2->warned = true;
 	  error (0, 0,
 		 gettext ("%s %#" PRIx64 " used with different address sizes"),
-		 name, (uint64_t) p1->offset);
+		 listptr_name, (uint64_t) p1->offset);
 	}
       if (p1->dwarf64 != p2->dwarf64)
 	{
 	  p1->warned = p2->warned = true;
 	  error (0, 0,
 		 gettext ("%s %#" PRIx64 " used with different offset sizes"),
-		 name, (uint64_t) p1->offset);
+		 listptr_name, (uint64_t) p1->offset);
 	}
       if (listptr_base (p1) != listptr_base (p2))
 	{
 	  p1->warned = p2->warned = true;
 	  error (0, 0,
 		 gettext ("%s %#" PRIx64 " used with different base addresses"),
-		 name, (uint64_t) p1->offset);
+		 listptr_name, (uint64_t) p1->offset);
 	}
     }
 
@@ -4464,9 +4465,11 @@
 static void
 sort_listptr (struct listptr_table *table, const char *name)
 {
-  if (table->n > 0)
-    qsort_r (table->table, table->n, sizeof table->table[0],
-	     &compare_listptr, (void *) name);
+  if (table->n > 0) {
+    listptr_name = name;
+    qsort (table->table, table->n, sizeof table->table[0],
+	     &compare_listptr);
+  }
 }
 
 static bool
--- libdwfl/dwfl_error.c	2015-09-29 17:18:51.000000000 +0200
+++ libdwfl/dwfl_error.c	2015-11-20 05:11:29.889002058 +0100
@@ -154,7 +154,16 @@
   switch (error &~ 0xffff)
     {
     case OTHER_ERROR (ERRNO):
+#if defined(__GLIBC__)
       return strerror_r (error & 0xffff, "bad", 0);
+#else
+      {
+        static __thread char buf[128] = "";
+        if (0 == strerror_r(error & 0xffff, buf, sizeof(buf)))
+          return buf;
+      }
+      return "strerror_r() failed";
+#endif
     case OTHER_ERROR (LIBELF):
       return elf_errmsg (error & 0xffff);
     case OTHER_ERROR (LIBDW):
--- lib/system.h	2015-08-21 14:22:37.000000000 +0200
+++ lib/system.h	2015-11-20 04:36:49.563164363 +0100
@@ -35,6 +35,7 @@
 #include <endian.h>
 #include <byteswap.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 # define LE32(n)	(n)
@@ -50,6 +50,20 @@
 # error "Unknown byte order"
 #endif
 
+#if !defined(__GLIBC__)
+
+/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
+   set to EINTR.  */
+
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+
+#endif
+
 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
 extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));
--- libelf/elf_getarsym.c	2015-10-12 12:22:58.000000000 +0200
+++ libelf/elf_getarsym.c	2015-11-20 05:01:57.762046695 +0100
@@ -297,7 +297,7 @@
 		arsym[cnt].as_off = (*u32)[cnt];
 
 	      arsym[cnt].as_hash = _dl_elf_hash (str_data);
-	      str_data = rawmemchr (str_data, '\0') + 1;
+	      str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
 	    }
 
 	  /* At the end a special entry.  */
--- lib/eu-config.h.old	2016-03-31 09:59:09.000000000 +0100
+++ lib/eu-config.h	2016-11-01 13:36:53.505447313 +0100
@@ -34,7 +34,7 @@
 # include <assert.h>
 # define rwlock_define(class,name)	class pthread_rwlock_t name
 # define RWLOCK_CALL(call)		\
-  ({ int _err = pthread_rwlock_ ## call; assert_perror (_err); })
+  ({ int _err = pthread_rwlock_ ## call; assert (_err == 0); })
 # define rwlock_init(lock)		RWLOCK_CALL (init (&lock, NULL))
 # define rwlock_fini(lock)		RWLOCK_CALL (destroy (&lock))
 # define rwlock_rdlock(lock)		RWLOCK_CALL (rdlock (&lock))