1 |
commit: 606fc6607c242f1fe91b655f4525b6b5c3cbf794 |
2 |
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Apr 12 04:12:30 2019 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 12 04:12:30 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=606fc660 |
7 |
|
8 |
dev-libs/elfutils: 0.176 with portability fixes from voidlinux |
9 |
|
10 |
Package-Manager: Portage-2.3.62, Repoman-2.3.12 |
11 |
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> |
12 |
|
13 |
dev-libs/elfutils/Manifest | 1 + |
14 |
dev-libs/elfutils/elfutils-0.176.ebuild | 78 ++++ |
15 |
.../files/elfutils-0.176-portability-fixes.patch | 414 +++++++++++++++++++++ |
16 |
3 files changed, 493 insertions(+) |
17 |
|
18 |
diff --git a/dev-libs/elfutils/Manifest b/dev-libs/elfutils/Manifest |
19 |
index 3fdccde..37dfc30 100644 |
20 |
--- a/dev-libs/elfutils/Manifest |
21 |
+++ b/dev-libs/elfutils/Manifest |
22 |
@@ -1,3 +1,4 @@ |
23 |
DIST elfutils-0.170.tar.bz2 8358001 BLAKE2B 03ea3ba7d3feaac43065312c475f4a3cd9083a6c56c9982fa00c0ed02b28440f6a37bbeca4be18db13749647ea1c8a6f00dae7efcb1c70235110e60ad7d56d06 SHA512 aca0b5e271138eaf86e36505ffb101181207b151e833e6cd7c18986ac50678542a5ecd2250f8dd6923ca497142f197c8b08fd225e4130b16b6203c24013d6d28 |
24 |
DIST elfutils-0.172.tar.bz2 8601066 BLAKE2B 7d4cb9944bfc258ba46312e8a4dde491f9d8fb4fa27837f6df0993107256f76e79ce02ea5872475a70ff9ebe9093e39bddf1c807be2af4bf0f6f5429f446a1ce SHA512 b2f491e976ef3067fe33ad22b3ef1952c47557571747899e94aee601bfeb95e8e1a91daad80a7950bee7feb42192769663db32eb65734ea5ffbc0b87cdad76b2 |
25 |
DIST elfutils-0.173.tar.bz2 8684782 BLAKE2B c5905bb864059bdfb2699a0681a0ec576b6b8da444b0641e8184f58735084588910930bcca14583db6be75b24a0e374413911ded5ba2ca893798404fbe7374eb SHA512 7f38e4ce2098b685f15030bf01f0a66a74aa32fbfcead0304c1d0e0a929b348a72f99e685cd4605465f4337393382112f64b8847e6c2f7cc1a57a4fd03d03eb3 |
26 |
+DIST elfutils-0.176.tar.bz2 8646075 BLAKE2B 7f23d59b7f5d74946fea928a7fada7764c1f96a5eefefc4a3a382090eb7cad07c80419218300d853ccbef8f4e2288eb443ff06b3e64bf4511d9fa7aa84f5b794 SHA512 7f032913be363a43229ded85d495dcf7542b3c85974aaaba0d984228dc9ac1721da3dc388d3fa02325a80940161db7e9ad2c9e4521a424ad8a7d050c0902915b |
27 |
|
28 |
diff --git a/dev-libs/elfutils/elfutils-0.176.ebuild b/dev-libs/elfutils/elfutils-0.176.ebuild |
29 |
new file mode 100644 |
30 |
index 0000000..e80e341 |
31 |
--- /dev/null |
32 |
+++ b/dev-libs/elfutils/elfutils-0.176.ebuild |
33 |
@@ -0,0 +1,78 @@ |
34 |
+# Copyright 1999-2019 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=7 |
38 |
+ |
39 |
+inherit autotools flag-o-matic multilib-minimal |
40 |
+ |
41 |
+DESCRIPTION="Libraries/utilities to handle ELF objects (drop in replacement for libelf)" |
42 |
+HOMEPAGE="http://elfutils.org/" |
43 |
+SRC_URI="https://sourceware.org/elfutils/ftp/${PV}/${P}.tar.bz2" |
44 |
+ |
45 |
+LICENSE="|| ( GPL-2+ LGPL-3+ ) utils? ( GPL-3+ )" |
46 |
+SLOT="0" |
47 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux" |
48 |
+IUSE="bzip2 lzma nls static-libs test +threads +utils" |
49 |
+ |
50 |
+RDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] |
51 |
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] ) |
52 |
+ lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] ) |
53 |
+ !dev-libs/libelf" |
54 |
+DEPEND="${RDEPEND} |
55 |
+ nls? ( sys-devel/gettext ) |
56 |
+ >=sys-devel/flex-2.5.4a |
57 |
+ sys-devel/m4 |
58 |
+ elibc_musl? ( |
59 |
+ sys-libs/argp-standalone |
60 |
+ sys-libs/fts-standalone |
61 |
+ sys-libs/obstack-standalone |
62 |
+ )" |
63 |
+ |
64 |
+PATCHES=( |
65 |
+ "${FILESDIR}"/${PN}-0.118-PaX-support.patch |
66 |
+ "${FILESDIR}"/${PN}-0.175-disable-biarch-test-PR24158.patch |
67 |
+ "${FILESDIR}"/${PN}-0.176-portability-fixes.patch |
68 |
+) |
69 |
+ |
70 |
+src_prepare() { |
71 |
+ default |
72 |
+ |
73 |
+ eautoreconf |
74 |
+ |
75 |
+ if ! use static-libs; then |
76 |
+ sed -i -e '/^lib_LIBRARIES/s:=.*:=:' -e '/^%.os/s:%.o$::' lib{asm,dw,elf}/Makefile.in || die |
77 |
+ fi |
78 |
+ # https://sourceware.org/PR23914 |
79 |
+ sed -i 's:-Werror::' */Makefile.in || die |
80 |
+} |
81 |
+ |
82 |
+src_configure() { |
83 |
+ use test && append-flags -g #407135 |
84 |
+ multilib-minimal_src_configure |
85 |
+} |
86 |
+ |
87 |
+multilib_src_configure() { |
88 |
+ ECONF_SOURCE="${S}" econf \ |
89 |
+ $(use_enable nls) \ |
90 |
+ $(use_enable threads thread-safety) \ |
91 |
+ --program-prefix="eu-" \ |
92 |
+ --with-zlib \ |
93 |
+ $(use_with bzip2 bzlib) \ |
94 |
+ $(use_with lzma) |
95 |
+} |
96 |
+ |
97 |
+multilib_src_test() { |
98 |
+ env LD_LIBRARY_PATH="${BUILD_DIR}/libelf:${BUILD_DIR}/libebl:${BUILD_DIR}/libdw:${BUILD_DIR}/libasm" \ |
99 |
+ LC_ALL="C" \ |
100 |
+ emake check VERBOSE=1 |
101 |
+} |
102 |
+ |
103 |
+multilib_src_install_all() { |
104 |
+ einstalldocs |
105 |
+ dodoc NOTES |
106 |
+ # These build quick, and are needed for most tests, so don't |
107 |
+ # disable their building when the USE flag is disabled. |
108 |
+ if ! use utils; then |
109 |
+ rm -rf "${ED}"/usr/bin || die |
110 |
+ fi |
111 |
+} |
112 |
|
113 |
diff --git a/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch b/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch |
114 |
new file mode 100644 |
115 |
index 0000000..f573f76 |
116 |
--- /dev/null |
117 |
+++ b/dev-libs/elfutils/files/elfutils-0.176-portability-fixes.patch |
118 |
@@ -0,0 +1,414 @@ |
119 |
+From de94a67137e483db97efd40e7d13f0148e43e95c Mon Sep 17 00:00:00 2001 |
120 |
+From: Jory Pratt <anarchy@g.o> |
121 |
+Date: Thu, 11 Apr 2019 22:58:38 -0500 |
122 |
+Subject: [PATCH] portability fixes |
123 |
+ |
124 |
+--- |
125 |
+ configure.ac | 56 ++++++++++++++++++++++++++++++++++++++++++++ |
126 |
+ lib/error.h | 27 +++++++++++++++++++++ |
127 |
+ lib/fixedsizehash.h | 1 - |
128 |
+ libdw/Makefile.am | 2 +- |
129 |
+ libdwfl/dwfl_error.c | 9 +++++++ |
130 |
+ libelf/elf.h | 11 +++++++++ |
131 |
+ src/Makefile.am | 28 +++++++++++----------- |
132 |
+ src/arlib.h | 10 ++++++++ |
133 |
+ src/elfcompress.c | 8 +++++++ |
134 |
+ src/error.h | 27 +++++++++++++++++++++ |
135 |
+ src/readelf.c | 21 ++++++++++------- |
136 |
+ src/strip.c | 8 +++++++ |
137 |
+ src/unstrip.c | 9 +++++++ |
138 |
+ 13 files changed, 192 insertions(+), 25 deletions(-) |
139 |
+ create mode 100644 lib/error.h |
140 |
+ create mode 100644 src/error.h |
141 |
+ |
142 |
+diff --git a/configure.ac b/configure.ac |
143 |
+index b4e012d..27e6152 100644 |
144 |
+--- a/configure.ac |
145 |
++++ b/configure.ac |
146 |
+@@ -494,6 +494,62 @@ else |
147 |
+ fi |
148 |
+ AC_SUBST([argp_LDADD]) |
149 |
+ |
150 |
++dnl Check if we have fts available from our libc |
151 |
++AC_LINK_IFELSE( |
152 |
++ [AC_LANG_PROGRAM( |
153 |
++ [#if !defined(__x86_64__) |
154 |
++ #undef _FILE_OFFSET_BITS |
155 |
++ #define _FILE_OFFSET_BITS 32 |
156 |
++ #endif |
157 |
++ #include <fts.h>], |
158 |
++ [FTS* fts = 0; return fts_close(fts); return 0;] |
159 |
++ )], |
160 |
++ [libc_has_fts="true"], |
161 |
++ [libc_has_fts="false"] |
162 |
++) |
163 |
++ |
164 |
++dnl If our libc doesn't provide fts, then test for libfts |
165 |
++if test "$libc_has_fts" = "false" ; then |
166 |
++ AC_MSG_WARN("libc does not have fts") |
167 |
++ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"]) |
168 |
++ |
169 |
++ if test "$have_fts" = "false"; then |
170 |
++ AC_MSG_ERROR("no libfts found") |
171 |
++ else |
172 |
++ fts_LDADD="-lfts" |
173 |
++ fi |
174 |
++else |
175 |
++ fts_LDADD="" |
176 |
++fi |
177 |
++AC_SUBST([fts_LDADD]) |
178 |
++ |
179 |
++dnl Check if we have obstack available from our libc |
180 |
++AC_LINK_IFELSE( |
181 |
++ [AC_LANG_PROGRAM( |
182 |
++ [#include <obstack.h>], |
183 |
++ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;] |
184 |
++ )], |
185 |
++ [libc_has_obstack="true"], |
186 |
++ [libc_has_obstack="false"] |
187 |
++) |
188 |
++ |
189 |
++dnl If our libc doesn't provide obstack, then test for libobstack |
190 |
++if test "$libc_has_obstack" = "false" ; then |
191 |
++ AC_MSG_WARN("libc does not have obstack") |
192 |
++ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"]) |
193 |
++ |
194 |
++ if test "$have_obstack" = "false"; then |
195 |
++ AC_MSG_ERROR("no libobstack found") |
196 |
++ else |
197 |
++ obstack_LDADD="-lobstack" |
198 |
++ fi |
199 |
++else |
200 |
++ obstack_LDADD="" |
201 |
++fi |
202 |
++AC_SUBST([obstack_LDADD]) |
203 |
++ |
204 |
++dnl The directories with content. |
205 |
++ |
206 |
+ dnl The directories with content. |
207 |
+ |
208 |
+ dnl Documentation. |
209 |
+diff --git a/lib/error.h b/lib/error.h |
210 |
+new file mode 100644 |
211 |
+index 0000000..ef06827 |
212 |
+--- /dev/null |
213 |
++++ b/lib/error.h |
214 |
+@@ -0,0 +1,27 @@ |
215 |
++#ifndef _ERROR_H_ |
216 |
++#define _ERROR_H_ |
217 |
++ |
218 |
++#include <stdarg.h> |
219 |
++#include <stdio.h> |
220 |
++#include <stdlib.h> |
221 |
++#include <string.h> |
222 |
++#include <errno.h> |
223 |
++ |
224 |
++static unsigned int error_message_count = 0; |
225 |
++ |
226 |
++static inline void error(int status, int errnum, const char* format, ...) |
227 |
++{ |
228 |
++ va_list ap; |
229 |
++ fprintf(stderr, "%s: ", program_invocation_name); |
230 |
++ va_start(ap, format); |
231 |
++ vfprintf(stderr, format, ap); |
232 |
++ va_end(ap); |
233 |
++ if (errnum) |
234 |
++ fprintf(stderr, ": %s", strerror(errnum)); |
235 |
++ fprintf(stderr, "\n"); |
236 |
++ error_message_count++; |
237 |
++ if (status) |
238 |
++ exit(status); |
239 |
++} |
240 |
++ |
241 |
++#endif /* _ERROR_H_ */ |
242 |
+diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h |
243 |
+index dac2a5f..43016fc 100644 |
244 |
+--- a/lib/fixedsizehash.h |
245 |
++++ b/lib/fixedsizehash.h |
246 |
+@@ -30,7 +30,6 @@ |
247 |
+ #include <errno.h> |
248 |
+ #include <stdlib.h> |
249 |
+ #include <string.h> |
250 |
+-#include <sys/cdefs.h> |
251 |
+ |
252 |
+ #include <system.h> |
253 |
+ |
254 |
+diff --git a/libdw/Makefile.am b/libdw/Makefile.am |
255 |
+index 7a3d532..646fbd0 100644 |
256 |
+--- a/libdw/Makefile.am |
257 |
++++ b/libdw/Makefile.am |
258 |
+@@ -108,7 +108,7 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) |
259 |
+ libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ |
260 |
+ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a |
261 |
+ libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so |
262 |
+-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) |
263 |
++libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS) |
264 |
+ libdw_so_SOURCES = |
265 |
+ libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) |
266 |
+ # The rpath is necessary for libebl because its $ORIGIN use will |
267 |
+diff --git a/libdwfl/dwfl_error.c b/libdwfl/dwfl_error.c |
268 |
+index 7bcf61c..ff25ebb 100644 |
269 |
+--- a/libdwfl/dwfl_error.c |
270 |
++++ b/libdwfl/dwfl_error.c |
271 |
+@@ -154,7 +154,16 @@ dwfl_errmsg (int error) |
272 |
+ switch (error &~ 0xffff) |
273 |
+ { |
274 |
+ case OTHER_ERROR (ERRNO): |
275 |
++#if defined(__GLIBC__) |
276 |
+ return strerror_r (error & 0xffff, "bad", 0); |
277 |
++#else |
278 |
++ { |
279 |
++ static __thread char buf[128] = ""; |
280 |
++ if (0 == strerror_r(error & 0xffff, buf, sizeof(buf))) |
281 |
++ return buf; |
282 |
++ } |
283 |
++ return "strerror_r() failed"; |
284 |
++#endif |
285 |
+ case OTHER_ERROR (LIBELF): |
286 |
+ return elf_errmsg (error & 0xffff); |
287 |
+ case OTHER_ERROR (LIBDW): |
288 |
+diff --git a/libelf/elf.h b/libelf/elf.h |
289 |
+index 75043bc..da1598a 100644 |
290 |
+--- a/libelf/elf.h |
291 |
++++ b/libelf/elf.h |
292 |
+@@ -21,6 +21,17 @@ |
293 |
+ |
294 |
+ #include <features.h> |
295 |
+ |
296 |
++#if !defined(__GLIBC__) |
297 |
++/* C++ needs to know that types and declarations are C, not C++. */ |
298 |
++#ifdef __cplusplus |
299 |
++# define __BEGIN_DECLS extern "C" { |
300 |
++# define __END_DECLS } |
301 |
++#else |
302 |
++# define __BEGIN_DECLS |
303 |
++# define __END_DECLS |
304 |
++#endif |
305 |
++#endif |
306 |
++ |
307 |
+ __BEGIN_DECLS |
308 |
+ |
309 |
+ /* Standard ELF types. */ |
310 |
+diff --git a/src/Makefile.am b/src/Makefile.am |
311 |
+index 2b1c0dc..ad05977 100644 |
312 |
+--- a/src/Makefile.am |
313 |
++++ b/src/Makefile.am |
314 |
+@@ -67,22 +67,22 @@ ranlib_no_Wstack_usage = yes |
315 |
+ ar_no_Wstack_usage = yes |
316 |
+ unstrip_no_Wstack_usage = yes |
317 |
+ |
318 |
+-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl |
319 |
+-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \ |
320 |
++readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl |
321 |
++nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl \ |
322 |
+ $(demanglelib) |
323 |
+-size_LDADD = $(libelf) $(libeu) $(argp_LDADD) |
324 |
+-strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl |
325 |
+-elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl |
326 |
+-findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) |
327 |
+-addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) |
328 |
+-elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl |
329 |
++size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
330 |
++strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl |
331 |
++elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl |
332 |
++findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
333 |
++addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(demanglelib) |
334 |
++elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl |
335 |
+ objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl |
336 |
+-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) |
337 |
+-strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) |
338 |
+-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) |
339 |
+-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl |
340 |
+-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib) |
341 |
+-elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) |
342 |
++ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
343 |
++strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
344 |
++ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
345 |
++unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl |
346 |
++stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl $(demanglelib) |
347 |
++elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) |
348 |
+ |
349 |
+ installcheck-binPROGRAMS: $(bin_PROGRAMS) |
350 |
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ |
351 |
+diff --git a/src/arlib.h b/src/arlib.h |
352 |
+index e117166..c66a5c9 100644 |
353 |
+--- a/src/arlib.h |
354 |
++++ b/src/arlib.h |
355 |
+@@ -29,6 +29,16 @@ |
356 |
+ #include <stdint.h> |
357 |
+ #include <sys/types.h> |
358 |
+ |
359 |
++#if !defined(ACCESSPERMS) |
360 |
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ |
361 |
++#endif |
362 |
++#if !defined(ALLPERMS) |
363 |
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ |
364 |
++#endif |
365 |
++#if !defined(DEFFILEMODE) |
366 |
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ |
367 |
++#endif |
368 |
++ |
369 |
+ |
370 |
+ /* State of -D/-U flags. */ |
371 |
+ extern bool arlib_deterministic_output; |
372 |
+diff --git a/src/elfcompress.c b/src/elfcompress.c |
373 |
+index 6ba6af4..f7d032b 100644 |
374 |
+--- a/src/elfcompress.c |
375 |
++++ b/src/elfcompress.c |
376 |
+@@ -37,6 +37,14 @@ |
377 |
+ #include "libeu.h" |
378 |
+ #include "printversion.h" |
379 |
+ |
380 |
++#if !defined(FNM_EXTMATCH) |
381 |
++# define FNM_EXTMATCH 0 |
382 |
++#endif |
383 |
++ |
384 |
++#if !defined(ALLPERMS) |
385 |
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ |
386 |
++#endif |
387 |
++ |
388 |
+ /* Name and version of program. */ |
389 |
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; |
390 |
+ |
391 |
+diff --git a/src/error.h b/src/error.h |
392 |
+new file mode 100644 |
393 |
+index 0000000..ef06827 |
394 |
+--- /dev/null |
395 |
++++ b/src/error.h |
396 |
+@@ -0,0 +1,27 @@ |
397 |
++#ifndef _ERROR_H_ |
398 |
++#define _ERROR_H_ |
399 |
++ |
400 |
++#include <stdarg.h> |
401 |
++#include <stdio.h> |
402 |
++#include <stdlib.h> |
403 |
++#include <string.h> |
404 |
++#include <errno.h> |
405 |
++ |
406 |
++static unsigned int error_message_count = 0; |
407 |
++ |
408 |
++static inline void error(int status, int errnum, const char* format, ...) |
409 |
++{ |
410 |
++ va_list ap; |
411 |
++ fprintf(stderr, "%s: ", program_invocation_name); |
412 |
++ va_start(ap, format); |
413 |
++ vfprintf(stderr, format, ap); |
414 |
++ va_end(ap); |
415 |
++ if (errnum) |
416 |
++ fprintf(stderr, ": %s", strerror(errnum)); |
417 |
++ fprintf(stderr, "\n"); |
418 |
++ error_message_count++; |
419 |
++ if (status) |
420 |
++ exit(status); |
421 |
++} |
422 |
++ |
423 |
++#endif /* _ERROR_H_ */ |
424 |
+diff --git a/src/readelf.c b/src/readelf.c |
425 |
+index 33706bd..da6624b 100644 |
426 |
+--- a/src/readelf.c |
427 |
++++ b/src/readelf.c |
428 |
+@@ -4792,10 +4792,11 @@ listptr_base (struct listptr *p) |
429 |
+ return cudie_base (&cu); |
430 |
+ } |
431 |
+ |
432 |
++static const char *listptr_name; |
433 |
++ |
434 |
+ static int |
435 |
+-compare_listptr (const void *a, const void *b, void *arg) |
436 |
++compare_listptr (const void *a, const void *b) |
437 |
+ { |
438 |
+- const char *name = arg; |
439 |
+ struct listptr *p1 = (void *) a; |
440 |
+ struct listptr *p2 = (void *) b; |
441 |
+ |
442 |
+@@ -4811,21 +4812,21 @@ compare_listptr (const void *a, const void *b, void *arg) |
443 |
+ p1->warned = p2->warned = true; |
444 |
+ error (0, 0, |
445 |
+ gettext ("%s %#" PRIx64 " used with different address sizes"), |
446 |
+- name, (uint64_t) p1->offset); |
447 |
++ listptr_name, (uint64_t) p1->offset); |
448 |
+ } |
449 |
+ if (p1->dwarf64 != p2->dwarf64) |
450 |
+ { |
451 |
+ p1->warned = p2->warned = true; |
452 |
+ error (0, 0, |
453 |
+ gettext ("%s %#" PRIx64 " used with different offset sizes"), |
454 |
+- name, (uint64_t) p1->offset); |
455 |
++ listptr_name, (uint64_t) p1->offset); |
456 |
+ } |
457 |
+ if (listptr_base (p1) != listptr_base (p2)) |
458 |
+ { |
459 |
+ p1->warned = p2->warned = true; |
460 |
+ error (0, 0, |
461 |
+ gettext ("%s %#" PRIx64 " used with different base addresses"), |
462 |
+- name, (uint64_t) p1->offset); |
463 |
++ listptr_name, (uint64_t) p1->offset); |
464 |
+ } |
465 |
+ if (p1->attr != p2 ->attr) |
466 |
+ { |
467 |
+@@ -4833,7 +4834,7 @@ compare_listptr (const void *a, const void *b, void *arg) |
468 |
+ error (0, 0, |
469 |
+ gettext ("%s %#" PRIx64 |
470 |
+ " used with different attribute %s and %s"), |
471 |
+- name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), |
472 |
++ listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), |
473 |
+ dwarf_attr_name (p2->attr)); |
474 |
+ } |
475 |
+ } |
476 |
+@@ -4904,9 +4905,11 @@ notice_listptr (enum section_e section, struct listptr_table *table, |
477 |
+ static void |
478 |
+ sort_listptr (struct listptr_table *table, const char *name) |
479 |
+ { |
480 |
+- if (table->n > 0) |
481 |
+- qsort_r (table->table, table->n, sizeof table->table[0], |
482 |
+- &compare_listptr, (void *) name); |
483 |
++ if (table->n > 0) { |
484 |
++ listptr_name = name; |
485 |
++ qsort (table->table, table->n, sizeof table->table[0], |
486 |
++ &compare_listptr); |
487 |
++ } |
488 |
+ } |
489 |
+ |
490 |
+ static bool |
491 |
+diff --git a/src/strip.c b/src/strip.c |
492 |
+index a73009d..c6ed590 100644 |
493 |
+--- a/src/strip.c |
494 |
++++ b/src/strip.c |
495 |
+@@ -46,6 +46,14 @@ |
496 |
+ #include <system.h> |
497 |
+ #include <printversion.h> |
498 |
+ |
499 |
++#if !defined(FNM_EXTMATCH) |
500 |
++# define FNM_EXTMATCH 0 |
501 |
++#endif |
502 |
++ |
503 |
++#if !defined(ACCESSPERMS) |
504 |
++#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) |
505 |
++#endif |
506 |
++ |
507 |
+ typedef uint8_t GElf_Byte; |
508 |
+ |
509 |
+ /* Name and version of program. */ |
510 |
+diff --git a/src/unstrip.c b/src/unstrip.c |
511 |
+index 3495b1d..0754717 100644 |
512 |
+--- a/src/unstrip.c |
513 |
++++ b/src/unstrip.c |
514 |
+@@ -56,6 +56,15 @@ |
515 |
+ # define _(str) gettext (str) |
516 |
+ #endif |
517 |
+ |
518 |
++#ifndef strndupa |
519 |
++#define strndupa(s, n) \ |
520 |
++ (__extension__ ({const char *__in = (s); \ |
521 |
++ size_t __len = strnlen (__in, (n)) + 1; \ |
522 |
++ char *__out = (char *) alloca (__len); \ |
523 |
++ __out[__len-1] = '\0'; \ |
524 |
++ (char *) memcpy (__out, __in, __len-1);})) |
525 |
++#endif |
526 |
++ |
527 |
+ /* Name and version of program. */ |
528 |
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; |
529 |
+ |
530 |
+-- |
531 |
+2.21.0 |
532 |
+ |