91fff1ca7871edb017be9c6de9ada7f0298c11ae
[openwrt/staging/stintel.git] / tools / elfutils / patches / 100-portability.patch
1 --- a/configure.ac
2 +++ b/configure.ac
3 @@ -20,6 +20,7 @@ dnl You should have received a copy of
4 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
5 AC_INIT([elfutils],[0.191],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
6
7 +AC_CONFIG_MACRO_DIRS([m4])
8 dnl Workaround for older autoconf < 2.64
9 m4_ifndef([AC_PACKAGE_URL],
10 [AC_DEFINE([PACKAGE_URL], ["http://elfutils.org/"],
11 @@ -43,16 +44,17 @@ elif test "x$program_prefix" = "x"; then
12 fi
13
14 AC_CONFIG_AUX_DIR([config])
15 -AC_CONFIG_FILES([config/Makefile])
16 +AC_CONFIG_FILES([config/Makefile libgnu/Makefile])
17
18 AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.])
19 -AC_PREREQ(2.63) dnl Minimum Autoconf version required.
20 +AC_PREREQ(2.64) dnl Minimum Autoconf version required.
21
22 dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
23 AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
24 AM_MAINTAINER_MODE
25
26 AM_SILENT_RULES([yes])
27 +AC_USE_SYSTEM_EXTENSIONS()
28
29 AC_CONFIG_SRCDIR([libelf/libelf.h])
30 AC_CONFIG_FILES([Makefile])
31 @@ -89,12 +91,14 @@ AS_IF([test "$use_locks" = yes],
32 AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
33
34 m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
35 +gl_EARLY
36 +gl_INIT
37 AC_PROG_CXX
38 -AC_PROG_RANLIB
39 AC_PROG_YACC
40 AC_PROG_LEX([noyywrap])
41 # Only available since automake 1.12
42 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
43 +LT_INIT()
44 AC_CHECK_TOOL([READELF], [readelf])
45 AC_CHECK_TOOL([NM], [nm])
46
47 @@ -195,7 +199,6 @@ AC_CACHE_CHECK([whether the compiler gen
48 AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))])
49 if test "$ac_cv_buildid" = "no"; then
50 AC_MSG_WARN([compiler doesn't generate build-id by default])
51 - LDFLAGS="$LDFLAGS -Wl,--build-id"
52 fi
53
54 ZRELRO_LDFLAGS="-Wl,-z,relro"
55 @@ -635,36 +638,6 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
56 CFLAGS="$old_CFLAGS"])
57 AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
58
59 -saved_LIBS="$LIBS"
60 -AC_SEARCH_LIBS([argp_parse], [argp])
61 -LIBS="$saved_LIBS"
62 -case "$ac_cv_search_argp_parse" in
63 - no) AC_MSG_FAILURE([failed to find argp_parse]) ;;
64 - -l*) argp_LDADD="$ac_cv_search_argp_parse" ;;
65 - *) argp_LDADD= ;;
66 -esac
67 -AC_SUBST([argp_LDADD])
68 -
69 -saved_LIBS="$LIBS"
70 -AC_SEARCH_LIBS([fts_close], [fts])
71 -LIBS="$saved_LIBS"
72 -case "$ac_cv_search_fts_close" in
73 - no) AC_MSG_FAILURE([failed to find fts_close]) ;;
74 - -l*) fts_LIBS="$ac_cv_search_fts_close" ;;
75 - *) fts_LIBS= ;;
76 -esac
77 -AC_SUBST([fts_LIBS])
78 -
79 -saved_LIBS="$LIBS"
80 -AC_SEARCH_LIBS([_obstack_free], [obstack])
81 -LIBS="$saved_LIBS"
82 -case "$ac_cv_search__obstack_free" in
83 - no) AC_MSG_FAILURE([failed to find _obstack_free]) ;;
84 - -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
85 - *) obstack_LIBS= ;;
86 -esac
87 -AC_SUBST([obstack_LIBS])
88 -
89 dnl The directories with content.
90
91 dnl Documentation.
92 --- a/libelf/elf_update.c
93 +++ b/libelf/elf_update.c
94 @@ -37,6 +37,33 @@
95
96 #include "libelfP.h"
97
98 +#include "elf_fill.c"
99 +
100 +#ifdef __APPLE__
101 +static int posix_fallocate(int fd, off_t offset, off_t len)
102 +{
103 + off_t c_test;
104 + int ret;
105 + if (!__builtin_saddll_overflow(offset, len, &c_test)) {
106 + fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, offset + len, 0};
107 + // Try to get a continuous chunk of disk space
108 + ret = fcntl(fd, F_PREALLOCATE, &store);
109 + if (ret < 0) {
110 + // OK, perhaps we are too fragmented, allocate non-continuous
111 + store.fst_flags = F_ALLOCATEALL;
112 + ret = fcntl(fd, F_PREALLOCATE, &store);
113 + if (ret < 0) {
114 + return ret;
115 + }
116 + }
117 + ret = ftruncate(fd, offset + len);
118 + } else {
119 + // offset+len would overflow.
120 + ret = -1;
121 + }
122 + return ret;
123 +}
124 +#endif
125
126 static int64_t
127 write_file (Elf *elf, int64_t size, int change_bo, size_t shnum)
128 --- a/lib/eu-config.h
129 +++ b/lib/eu-config.h
130 @@ -59,14 +59,18 @@
131 # define once(once_control, init_routine) init_routine()
132 #endif /* USE_LOCKS */
133
134 -#include <libintl.h>
135 +#include <gettext.h>
136 /* gettext helper macros. */
137 #define N_(Str) Str
138 #define _(Str) dgettext ("elfutils", Str)
139
140 /* Compiler-specific definitions. */
141 +#ifdef __APPLE__
142 +#define strong_alias(name, aliasname)
143 +#else
144 #define strong_alias(name, aliasname) \
145 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
146 +#endif
147
148 #ifdef __i386__
149 # define internal_function __attribute__ ((regparm (3), stdcall))
150 @@ -77,12 +81,7 @@
151 #define internal_strong_alias(name, aliasname) \
152 extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
153
154 -#ifdef HAVE_VISIBILITY
155 -#define attribute_hidden \
156 - __attribute__ ((visibility ("hidden")))
157 -#else
158 #define attribute_hidden /* empty */
159 -#endif
160
161 #ifdef HAVE_GCC_STRUCT
162 #define attribute_packed \
163 @@ -166,7 +165,7 @@ asm (".section predict_data, \"aw\"; .pr
164 #endif
165
166 /* Avoid PLT entries. */
167 -#ifdef PIC
168 +#if defined(PIC) && !defined(__APPLE__)
169 # define INTUSE(name) _INTUSE(name)
170 # define _INTUSE(name) __##name##_internal
171 # define INTDEF(name) _INTDEF(name)
172 --- a/config/eu.am
173 +++ b/config/eu.am
174 @@ -31,7 +31,7 @@
175 ##
176
177 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
178 -AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
179 +AM_CPPFLAGS = -I$(top_builddir)/libgnu -I$(top_srcdir)/libgnu -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
180
181 # Drop the 'u' flag that automake adds by default. It is incompatible
182 # with deterministic archives.
183 --- a/libelf/Makefile.am
184 +++ b/libelf/Makefile.am
185 @@ -34,9 +34,7 @@ endif
186
187 VERSION = 1
188
189 -lib_LIBRARIES = libelf.a
190 -noinst_LIBRARIES = libelf_pic.a
191 -noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
192 +lib_LTLIBRARIES = libelf.la
193 include_HEADERS = libelf.h gelf.h nlist.h
194
195 noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
196 @@ -51,7 +49,8 @@ endif
197
198 pkginclude_HEADERS = elf-knowledge.h
199
200 -libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
201 +libelf_la_LIBADD = ../libgnu/libgnu.la ../lib/libeu.la -lz $(zstd_LIBS) -lpthread
202 +libelf_la_SOURCES = elf_version.c elf_hash.c elf_error.c \
203 elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \
204 gelf_getclass.c elf_getbase.c elf_getident.c \
205 elf32_fsize.c elf64_fsize.c gelf_fsize.c \
206 @@ -102,37 +101,9 @@ libelf_a_SOURCES = elf_version.c elf_has
207 elf32_getchdr.c elf64_getchdr.c gelf_getchdr.c \
208 elf_compress.c elf_compress_gnu.c
209
210 -libelf_pic_a_SOURCES =
211 -am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
212 -
213 -libelf_so_DEPS = ../lib/libeu.a
214 -libelf_so_LDLIBS = $(libelf_so_DEPS) -lz $(zstd_LIBS)
215 -if USE_LOCKS
216 -libelf_so_LDLIBS += -lpthread
217 -endif
218 -
219 -libelf_so_LIBS = libelf_pic.a
220 -libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
221 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
222 - -Wl,--soname,$@.$(VERSION) \
223 - -Wl,--version-script,$< \
224 - $(NO_UNDEFINED) \
225 - -Wl,--whole-archive $(libelf_so_LIBS) -Wl,--no-whole-archive \
226 - $(libelf_so_LDLIBS)
227 - @$(textrel_check)
228 - $(AM_V_at)ln -fs $@ $@.$(VERSION)
229 -
230 -install: install-am libelf.so
231 +install: install-am
232 $(mkinstalldirs) $(DESTDIR)$(libdir)
233 - $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
234 - ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
235 - ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
236
237 uninstall: uninstall-am
238 - rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
239 - rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
240 - rm -f $(DESTDIR)$(libdir)/libelf.so
241
242 EXTRA_DIST = libelf.map
243 -
244 -CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
245 --- a/backends/i386_auxv.c
246 +++ b/backends/i386_auxv.c
247 @@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
248 return 1;
249 }
250
251 -__typeof (i386_auxv_info) x86_64_auxv_info
252 - __attribute__ ((alias ("i386_auxv_info")));
253 +auxv_info_alias(x86_64)
254 --- a/backends/ppc_regs.c
255 +++ b/backends/ppc_regs.c
256 @@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_
257 return namelen;
258 }
259
260 -__typeof (ppc_register_info)
261 - ppc64_register_info __attribute__ ((alias ("ppc_register_info")));
262 +ssize_t
263 +ppc64_register_info (Ebl *ebl,
264 + int regno, char *name, size_t namelen,
265 + const char **prefix, const char **setname,
266 + int *bits, int *type)
267 +{
268 + return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type);
269 +}
270 --- a/backends/libebl_CPU.h
271 +++ b/backends/libebl_CPU.h
272 @@ -97,4 +97,10 @@ dwarf_is_pointer (int tag)
273 case DW_TAG_reference_type: \
274 case DW_TAG_rvalue_reference_type
275
276 +#define auxv_info_alias(arch) \
277 + int EBLHOOK_1(arch ## _, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
278 + { \
279 + return EBLHOOK(auxv_info)(a_type, name, format); \
280 + }
281 +
282 #endif /* libebl_CPU.h */
283 --- a/backends/ppc_auxv.c
284 +++ b/backends/ppc_auxv.c
285 @@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
286 return 1;
287 }
288
289 -__typeof (ppc_auxv_info) ppc64_auxv_info
290 - __attribute__ ((alias ("ppc_auxv_info")));
291 +auxv_info_alias(ppc64)
292 --- a/backends/ppc_cfi.c
293 +++ b/backends/ppc_cfi.c
294 @@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un
295 return 0;
296 }
297
298 -__typeof (ppc_abi_cfi)
299 - ppc64_abi_cfi
300 - __attribute__ ((alias ("ppc_abi_cfi")));
301 +int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info)
302 +{
303 + return ppc_abi_cfi(ebl, abi_info);
304 +}
305 --- a/backends/ppc_initreg.c
306 +++ b/backends/ppc_initreg.c
307 @@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute
308 abort ();
309 }
310
311 -__typeof (ppc_dwarf_to_regno)
312 - ppc64_dwarf_to_regno
313 - __attribute__ ((alias ("ppc_dwarf_to_regno")));
314 +bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno)
315 +{
316 + return ppc_dwarf_to_regno(ebl, regno);
317 +}
318
319 bool
320 ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
321 @@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid
322 #endif /* __powerpc__ */
323 }
324
325 -__typeof (ppc_set_initial_registers_tid)
326 - ppc64_set_initial_registers_tid
327 - __attribute__ ((alias ("ppc_set_initial_registers_tid")));
328 +bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg)
329 +{
330 + return ppc_set_initial_registers_tid(tid, setfunc, arg);
331 +}
332 --- a/backends/ppc_attrs.c
333 +++ b/backends/ppc_attrs.c
334 @@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a
335 return false;
336 }
337
338 -__typeof (ppc_check_object_attribute)
339 - ppc64_check_object_attribute
340 - __attribute__ ((alias ("ppc_check_object_attribute")));
341 +bool ppc64_check_object_attribute(Ebl *ebl,
342 + const char *vendor, int tag, uint64_t value,
343 + const char **tag_name, const char **value_name)
344 +{
345 + return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name);
346 +}
347 --- a/lib/libeu.h
348 +++ b/lib/libeu.h
349 @@ -45,4 +45,11 @@ extern char *xasprintf(const char *fmt,
350 extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
351 extern int crc32_file (int fd, uint32_t *resp);
352
353 +#ifdef __APPLE__
354 +static inline void tdestroy(void *root __attribute__ ((unused)),
355 + void (*freekey)(void *) __attribute__ ((unused)))
356 +{
357 +}
358 +#endif
359 +
360 #endif
361 --- a/libdwfl/libdwflP.h
362 +++ b/libdwfl/libdwflP.h
363 @@ -31,6 +31,8 @@
364
365 #include <libdwfl.h>
366 #include <libebl.h>
367 +#include <libeu.h>
368 +#include <libgen.h>
369 #include <assert.h>
370 #include <dirent.h>
371 #include <errno.h>
372 --- /dev/null
373 +++ b/lib/stdio_ext.h
374 @@ -0,0 +1,6 @@
375 +#include <stdio.h>
376 +#ifndef __APPLE__
377 +#include_next <stdio_ext.h>
378 +#else
379 +#define __fsetlocking(...) 0
380 +#endif
381 --- a/libdw/libdwP.h
382 +++ b/libdw/libdwP.h
383 @@ -32,8 +32,10 @@
384 #include <stdbool.h>
385 #include <pthread.h>
386
387 +#include <libeu.h>
388 #include <libdw.h>
389 #include <dwarf.h>
390 +#include <libgen.h>
391
392
393 /* Known location expressions already decoded. */
394 --- a/libdw/Makefile.am
395 +++ b/libdw/Makefile.am
396 @@ -34,14 +34,12 @@ endif
397 AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread
398 VERSION = 1
399
400 -lib_LIBRARIES = libdw.a
401 -noinst_LIBRARIES = libdw_pic.a
402 -noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
403 +lib_LTLIBRARIES = libdw.la
404
405 include_HEADERS = dwarf.h
406 pkginclude_HEADERS = libdw.h known-dwarf.h
407
408 -libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
409 +libdw_la_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
410 dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
411 dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
412 dwarf_attr.c dwarf_formstring.c \
413 @@ -103,50 +101,12 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/c
414 mv -f $@.new $@
415 endif
416
417 -libdw_pic_a_SOURCES =
418 -am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
419 -
420 -libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
421 - ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
422 - ../libdwfl/libdwfl_pic.a
423 -libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
424 -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
425 -libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
426 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
427 - -Wl,--soname,$@.$(VERSION),--enable-new-dtags \
428 - -Wl,--version-script,$< \
429 - $(NO_UNDEFINED) \
430 - -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \
431 - $(libdw_so_LDLIBS)
432 - @$(textrel_check)
433 - $(AM_V_at)ln -fs $@ $@.$(VERSION)
434 -
435 -install: install-am libdw.so
436 - $(mkinstalldirs) $(DESTDIR)$(libdir)
437 - $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
438 - ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
439 - ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
440 -
441 -uninstall: uninstall-am
442 - rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
443 - rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
444 - rm -f $(DESTDIR)$(libdir)/libdw.so
445 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
446 -
447 -libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
448 -libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
449 -
450 -libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
451 -libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
452 -
453 -libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
454 -libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
455 -
456 -backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
457 -libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
458 -
459 -libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
460 -libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
461 +libdw_la_LIBADD = \
462 + ../libdwfl/libdwfl.la \
463 + ../libdwelf/libdwelf.la \
464 + ../libebl/libebl.la \
465 + ../backends/libebl_backends.la \
466 + ../libcpu/libcpu.la
467
468 noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
469 dwarf_sig8_hash.h cfi.h encoded-value.h
470 --- a/libasm/Makefile.am
471 +++ b/libasm/Makefile.am
472 @@ -32,12 +32,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
473
474 VERSION = 1
475
476 -lib_LIBRARIES = libasm.a
477 -noinst_LIBRARIES = libasm_pic.a
478 -noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
479 +lib_LTLIBRARIES = libasm.la
480 pkginclude_HEADERS = libasm.h
481
482 -libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
483 +libasm_la_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
484 asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \
485 asm_newsubscn.c asm_newsym.c asm_newcomsym.c \
486 asm_newabssym.c \
487 @@ -51,38 +49,6 @@ libasm_a_SOURCES = asm_begin.c asm_abort
488 disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \
489 symbolhash.c
490
491 -libasm_pic_a_SOURCES =
492 -am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
493 -
494 -libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl_pic.a ../libelf/libelf.so ../libdw/libdw.so
495 -libasm_so_LDLIBS = $(libasm_so_DEPS)
496 -if USE_LOCKS
497 -libasm_so_LDLIBS += -lpthread
498 -endif
499 -
500 -libasm_so_LIBS = libasm_pic.a
501 -libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS)
502 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
503 - -Wl,--soname,$@.$(VERSION) \
504 - -Wl,--version-script,$< \
505 - $(NO_UNDEFINED) \
506 - -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \
507 - $(libasm_so_LDLIBS)
508 - @$(textrel_check)
509 - $(AM_V_at)ln -fs $@ $@.$(VERSION)
510 -
511 -install: install-am libasm.so
512 - $(mkinstalldirs) $(DESTDIR)$(libdir)
513 - $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
514 - ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
515 - ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
516 -
517 -uninstall: uninstall-am
518 - rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
519 - rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
520 - rm -f $(DESTDIR)$(libdir)/libasm.so
521 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
522 -
523 noinst_HEADERS = libasmP.h symbolhash.h
524 EXTRA_DIST = libasm.map
525
526 --- a/libdwfl/Makefile.am
527 +++ b/libdwfl/Makefile.am
528 @@ -34,13 +34,11 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
529 -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(builddir)/../debuginfod
530 VERSION = 1
531
532 -noinst_LIBRARIES = libdwfl.a
533 -noinst_LIBRARIES += libdwfl_pic.a
534 +noinst_LTLIBRARIES = libdwfl.la
535
536 pkginclude_HEADERS = libdwfl.h
537
538 -
539 -libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
540 +libdwfl_la_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
541 dwfl_module.c dwfl_report_elf.c relocate.c \
542 dwfl_module_build_id.c dwfl_module_report_build_id.c \
543 derelocate.c offline.c segment.c \
544 @@ -73,24 +71,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
545 gzip.c debuginfod-client.c
546
547 if BZLIB
548 -libdwfl_a_SOURCES += bzip2.c
549 +libdwfl_la_SOURCES += bzip2.c
550 endif
551 if LZMA
552 -libdwfl_a_SOURCES += lzma.c
553 +libdwfl_la_SOURCES += lzma.c
554 endif
555 if ZSTD
556 -libdwfl_a_SOURCES += zstd.c
557 +libdwfl_la_SOURCES += zstd.c
558 endif
559
560 -libdwfl = $(libdw)
561 -libdw = ../libdw/libdw.so
562 -libelf = ../libelf/libelf.so
563 -libebl = ../libebl/libebl.a
564 -libeu = ../lib/libeu.a
565 -
566 -libdwfl_pic_a_SOURCES =
567 -am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
568 -
569 noinst_HEADERS = libdwflP.h
570
571 -CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
572 --- a/backends/Makefile.am
573 +++ b/backends/Makefile.am
574 @@ -34,7 +34,7 @@ endif
575 AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
576 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
577
578 -noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
579 +noinst_LTLIBRARIES = libebl_backends.la
580
581 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
582 m68k bpf riscv csky loongarch arc
583 @@ -102,17 +102,13 @@ loongarch_SRCS = loongarch_init.c loonga
584
585 arc_SRCS = arc_init.c arc_symbol.c
586
587 -libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
588 +libebl_backends_la_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
589 $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
590 $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
591 $(ppc64_SRCS) $(s390_SRCS) \
592 $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
593 $(loongarch_SRCS) $(arc_SRCS)
594
595 -libebl_backends_pic_a_SOURCES =
596 -am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
597
598 noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
599 EXTRA_DIST = $(modules:=_reloc.def)
600 -
601 -MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
602 --- a/libdwelf/Makefile.am
603 +++ b/libdwelf/Makefile.am
604 @@ -34,24 +34,12 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$
605 -I$(srcdir)/../libdwfl -I$(srcdir)/../libebl
606 VERSION = 1
607
608 -noinst_LIBRARIES = libdwelf.a libdwelf_pic.a
609 +noinst_LTLIBRARIES = libdwelf.la
610
611 pkginclude_HEADERS = libdwelf.h
612 noinst_HEADERS = libdwelfP.h
613
614 -libdwelf_a_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
615 +libdwelf_la_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
616 dwelf_elf_gnu_build_id.c dwelf_scn_gnu_compressed_size.c \
617 dwelf_strtab.c dwelf_elf_begin.c \
618 dwelf_elf_e_machine_string.c
619 -
620 -libdwelf = $(libdw)
621 -
622 -libdw = ../libdw/libdw.so
623 -libelf = ../libelf/libelf.so
624 -libebl = ../libebl/libebl.a
625 -libeu = ../lib/libeu.a
626 -
627 -libdwelf_pic_a_SOURCES =
628 -am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
629 -
630 -CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
631 --- a/libebl/Makefile.am
632 +++ b/libebl/Makefile.am
633 @@ -34,9 +34,9 @@ endif
634 AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdw -I$(srcdir)/../libasm
635 VERSION = 1
636
637 -noinst_LIBRARIES = libebl.a libebl_pic.a
638 +noinst_LTLIBRARIES = libebl.la
639
640 -libebl_a_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
641 +libebl_la_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
642 eblsegmenttypename.c eblsectiontypename.c \
643 eblmachineflagname.c eblsymboltypename.c \
644 ebldynamictagname.c eblsectionname.c \
645 @@ -56,9 +56,4 @@ libebl_a_SOURCES = eblopenbackend.c eblc
646 eblresolvesym.c eblcheckreloctargettype.c \
647 ebl_data_marker_symbol.c
648
649 -libebl_pic_a_SOURCES =
650 -am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os)
651 -
652 noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
653 -
654 -MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
655 --- a/debuginfod/Makefile.am
656 +++ b/debuginfod/Makefile.am
657 @@ -40,23 +40,12 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
658 program_prefix=
659 program_transform_name = s,x,x,
660
661 -if BUILD_STATIC
662 -libasm = ../libasm/libasm.a
663 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
664 -libelf = ../libelf/libelf.a -lz
665 -if DUMMY_LIBDEBUGINFOD
666 -libdebuginfod = ./libdebuginfod.a
667 -else
668 -libdebuginfod = ./libdebuginfod.a -lpthread $(libcurl_LIBS)
669 -endif
670 -else
671 -libasm = ../libasm/libasm.so
672 -libdw = ../libdw/libdw.so
673 -libelf = ../libelf/libelf.so
674 -libdebuginfod = ./libdebuginfod.so
675 -endif
676 -libebl = ../libebl/libebl.a
677 -libeu = ../lib/libeu.a
678 +libasm = ../libasm/libasm.la
679 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
680 +libelf = ../libelf/libelf.la
681 +libdebuginfod = ./libdebuginfod.la
682 +libebl = ../libebl/libebl.la
683 +libeu = ../lib/libeu.la
684
685 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
686
687 @@ -76,14 +65,10 @@ debuginfod_find_SOURCES = debuginfod-fin
688 debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
689
690 if LIBDEBUGINFOD
691 -noinst_LIBRARIES = libdebuginfod.a
692 -noinst_LIBRARIES += libdebuginfod_pic.a
693 +libdebuginfod_la_SOURCES = debuginfod-client.c
694 +noinst_LTLIBRARIES = libdebuginfod.la
695 endif
696
697 -libdebuginfod_a_SOURCES = debuginfod-client.c
698 -libdebuginfod_pic_a_SOURCES = debuginfod-client.c
699 -am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os)
700 -
701 if DUMMY_LIBDEBUGINFOD
702 AM_CPPFLAGS += -Wno-unused-parameter
703 endif
704 @@ -92,42 +77,7 @@ if LIBDEBUGINFOD
705 pkginclude_HEADERS = debuginfod.h
706 endif
707
708 -if LIBDEBUGINFOD
709 -libdebuginfod_so_LIBS = libdebuginfod_pic.a
710 -if DUMMY_LIBDEBUGINFOD
711 -libdebuginfod_so_LDLIBS =
712 -else
713 -libdebuginfod_so_LDLIBS = -lpthread $(libcurl_LIBS) $(fts_LIBS) $(libelf)
714 -endif
715 -$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
716 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
717 - -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \
718 - -Wl,--version-script,$< \
719 - $(NO_UNDEFINED) \
720 - -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \
721 - $(libdebuginfod_so_LDLIBS)
722 - @$(textrel_check)
723 -
724 -libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
725 - ln -fs $< $@
726 -
727 -install: install-am libdebuginfod.so
728 - $(mkinstalldirs) $(DESTDIR)$(libdir)
729 - $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
730 - $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
731 - ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
732 - ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
733 -
734 -uninstall: uninstall-am
735 - rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
736 - rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
737 - rm -f $(DESTDIR)$(libdir)/libdebuginfod.so
738 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
739 -endif
740 -
741 EXTRA_DIST = libdebuginfod.map
742 -MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
743 -CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
744
745 # automake std-options override: arrange to pass LD_LIBRARY_PATH
746 installcheck-binPROGRAMS: $(bin_PROGRAMS)
747 --- a/lib/Makefile.am
748 +++ b/lib/Makefile.am
749 @@ -31,9 +31,9 @@ include $(top_srcdir)/config/eu.am
750 AM_CFLAGS += $(fpic_CFLAGS)
751 AM_CPPFLAGS += -I$(srcdir)/../libelf
752
753 -noinst_LIBRARIES = libeu.a
754 +noinst_LTLIBRARIES = libeu.la
755
756 -libeu_a_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
757 +libeu_la_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
758 crc32.c crc32_file.c \
759 color.c error.c printversion.c
760
761 --- a/src/Makefile.am
762 +++ b/src/Makefile.am
763 @@ -29,9 +29,9 @@ bin_PROGRAMS = readelf nm size strip elf
764 elfcmp objdump ranlib strings ar unstrip stack elfcompress \
765 elfclassify srcfiles
766
767 -noinst_LIBRARIES = libar.a
768 +noinst_LTLIBRARIES = libar.la
769
770 -libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
771 +libar_la_SOURCES = arlib.c arlib2.c arlib-argp.c
772
773 EXTRA_DIST = arlib.h debugpred.h
774
775 @@ -39,27 +39,16 @@ bin_SCRIPTS = make-debug-archive
776 EXTRA_DIST += make-debug-archive.in
777 CLEANFILES += make-debug-archive
778
779 -if BUILD_STATIC
780 -libasm = ../libasm/libasm.a
781 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
782 -libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
783 +libasm = ../libasm/libasm.la
784 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) -ldl -lpthread
785 +libelf = ../libelf/libelf.la -lz $(zstd_LIBS)
786 if LIBDEBUGINFOD
787 -libdebuginfod = ../debuginfod/libdebuginfod.a -lpthread $(libcurl_LIBS)
788 +libdebuginfod = ../debuginfod/libdebuginfod.la -lpthread $(libcurl_LIBS)
789 else
790 libdebuginfod =
791 endif
792 -else
793 -libasm = ../libasm/libasm.so
794 -libdw = ../libdw/libdw.so
795 -libelf = ../libelf/libelf.so
796 -if LIBDEBUGINFOD
797 -libdebuginfod = ../debuginfod/libdebuginfod.so
798 -else
799 -libdebuginfod =
800 -endif
801 -endif
802 -libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
803 -libeu = ../lib/libeu.a
804 +libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
805 +libeu = ../lib/libeu.la
806
807 if DEMANGLE
808 demanglelib = -lstdc++
809 @@ -87,9 +76,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $
810 addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
811 elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
812 objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
813 -ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
814 +ranlib_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
815 strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
816 -ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
817 +ar_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
818 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
819 stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
820 elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
821 --- a/tests/Makefile.am
822 +++ b/tests/Makefile.am
823 @@ -689,17 +689,11 @@ installcheck-local:
824 TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)" \
825 LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS
826
827 -if BUILD_STATIC
828 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
829 -libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
830 -libasm = ../libasm/libasm.a
831 -else
832 -libdw = ../libdw/libdw.so
833 -libelf = ../libelf/libelf.so
834 -libasm = ../libasm/libasm.so
835 -endif
836 -libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
837 -libeu = ../lib/libeu.a
838 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
839 +libelf = ../libelf/libelf.la
840 +libasm = ../libasm/libasm.la
841 +libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
842 +libeu = ../lib/libeu.la
843
844 arextract_LDADD = $(libelf)
845 arsymtest_LDADD = $(libelf)
846 --- a/libcpu/Makefile.am
847 +++ b/libcpu/Makefile.am
848 @@ -38,19 +38,16 @@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAG
849 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
850 AM_YFLAGS = -p$(<F:parse.y=)
851
852 -noinst_LIBRARIES = libcpu.a libcpu_pic.a
853 +noinst_LTLIBRARIES = libcpu.la
854
855 noinst_HEADERS = i386_dis.h i386_mne.h x86_64_dis.h
856
857 -libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
858 -
859 -libcpu_pic_a_SOURCES =
860 -am_libcpu_pic_a_OBJECTS = $(libcpu_a_SOURCES:.c=.os)
861 +libcpu_la_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
862
863 i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
864
865 -i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
866 -x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
867 +$(libcpu_la_OBJECTS): i386.mnemonics $(srcdir)/i386_dis.h
868 +$(libcpu_la_OBJECTS): x86_64.mnemonics $(srcdir)/x86_64_dis.h
869
870 %_defs: $(srcdir)/defs/i386
871 $(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T
872 @@ -87,20 +84,15 @@ endif
873
874 i386_lex_no_Werror = yes
875
876 -libeu = ../lib/libeu.a
877 +libeu = ../lib/libeu.la
878
879 i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
880 -Wno-implicit-fallthrough
881 -i386_parse.o: i386_parse.c i386.mnemonics
882 -i386_lex.o: i386_parse.h
883 i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
884
885 -i386_parse.h: i386_parse.c ;
886 -
887 bpf_disasm_CFLAGS = -Wno-format-nonliteral
888
889 EXTRA_DIST = defs/i386
890
891 -MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
892 CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
893 MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
894 --- a/config/libelf.pc.in
895 +++ b/config/libelf.pc.in
896 @@ -8,7 +8,7 @@ Description: elfutils libelf library to
897 Version: @VERSION@
898 URL: http://elfutils.org/
899
900 -Libs: -L${libdir} -lelf
901 +Libs: -L${libdir} -lelf -lz
902 Cflags: -I${includedir}
903
904 Requires.private: zlib @LIBZSTD@
905 --- a/lib/next_prime.c
906 +++ b/lib/next_prime.c
907 @@ -27,6 +27,7 @@
908 the GNU Lesser General Public License along with this program. If
909 not, see <http://www.gnu.org/licenses/>. */
910
911 +#include <config.h>
912 #include <stddef.h>
913
914
915 --- a/libdw/libdwP.h
916 +++ b/libdw/libdwP.h
917 @@ -35,7 +35,7 @@
918 #include <libeu.h>
919 #include <libdw.h>
920 #include <dwarf.h>
921 -#include <libgen.h>
922 +#include <dirname.h>
923
924
925 /* Known location expressions already decoded. */
926
927 --- a/libdwfl/libdwflP.h
928 +++ b/libdwfl/libdwflP.h
929 @@ -32,7 +32,7 @@
930 #include <libdwfl.h>
931 #include <libebl.h>
932 #include <libeu.h>
933 -#include <libgen.h>
934 +#include <dirname.h>
935 #include <assert.h>
936 #include <dirent.h>
937 #include <errno.h>
938