9a111c76d9c9fa3fb5b587898559e9619e60c9d9
[openwrt/staging/nbd.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/libdwfl/libdwflP.h
348 +++ b/libdwfl/libdwflP.h
349 @@ -31,6 +31,8 @@
350
351 #include <libdwfl.h>
352 #include <libebl.h>
353 +#include <libeu.h>
354 +#include <libgen.h>
355 #include <assert.h>
356 #include <dirent.h>
357 #include <errno.h>
358 --- /dev/null
359 +++ b/lib/stdio_ext.h
360 @@ -0,0 +1,6 @@
361 +#include <stdio.h>
362 +#ifndef __APPLE__
363 +#include_next <stdio_ext.h>
364 +#else
365 +#define __fsetlocking(...) 0
366 +#endif
367 --- a/libdw/libdwP.h
368 +++ b/libdw/libdwP.h
369 @@ -32,8 +32,10 @@
370 #include <stdbool.h>
371 #include <pthread.h>
372
373 +#include <libeu.h>
374 #include <libdw.h>
375 #include <dwarf.h>
376 +#include <libgen.h>
377
378
379 /* Known location expressions already decoded. */
380 --- a/libdw/Makefile.am
381 +++ b/libdw/Makefile.am
382 @@ -34,14 +34,12 @@ endif
383 AM_CPPFLAGS += -I$(srcdir)/../libebl -I$(srcdir)/../libelf -I$(srcdir)/../libdwelf -pthread
384 VERSION = 1
385
386 -lib_LIBRARIES = libdw.a
387 -noinst_LIBRARIES = libdw_pic.a
388 -noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
389 +lib_LTLIBRARIES = libdw.la
390
391 include_HEADERS = dwarf.h
392 pkginclude_HEADERS = libdw.h known-dwarf.h
393
394 -libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
395 +libdw_la_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
396 dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
397 dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
398 dwarf_attr.c dwarf_formstring.c \
399 @@ -103,50 +101,12 @@ $(srcdir)/known-dwarf.h: $(top_srcdir)/c
400 mv -f $@.new $@
401 endif
402
403 -libdw_pic_a_SOURCES =
404 -am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
405 -
406 -libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
407 - ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
408 - ../libdwfl/libdwfl_pic.a
409 -libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
410 -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
411 -libdw.so: $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
412 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
413 - -Wl,--soname,$@.$(VERSION),--enable-new-dtags \
414 - -Wl,--version-script,$< \
415 - $(NO_UNDEFINED) \
416 - -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \
417 - $(libdw_so_LDLIBS)
418 - @$(textrel_check)
419 - $(AM_V_at)ln -fs $@ $@.$(VERSION)
420 -
421 -install: install-am libdw.so
422 - $(mkinstalldirs) $(DESTDIR)$(libdir)
423 - $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
424 - ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
425 - ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
426 -
427 -uninstall: uninstall-am
428 - rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
429 - rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
430 - rm -f $(DESTDIR)$(libdir)/libdw.so
431 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
432 -
433 -libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
434 -libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
435 -
436 -libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
437 -libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
438 -
439 -libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
440 -libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
441 -
442 -backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
443 -libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
444 -
445 -libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
446 -libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
447 +libdw_la_LIBADD = \
448 + ../libdwfl/libdwfl.la \
449 + ../libdwelf/libdwelf.la \
450 + ../libebl/libebl.la \
451 + ../backends/libebl_backends.la \
452 + ../libcpu/libcpu.la
453
454 noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
455 dwarf_sig8_hash.h cfi.h encoded-value.h
456 --- a/libasm/Makefile.am
457 +++ b/libasm/Makefile.am
458 @@ -32,12 +32,10 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
459
460 VERSION = 1
461
462 -lib_LIBRARIES = libasm.a
463 -noinst_LIBRARIES = libasm_pic.a
464 -noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
465 +lib_LTLIBRARIES = libasm.la
466 pkginclude_HEADERS = libasm.h
467
468 -libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
469 +libasm_la_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
470 asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \
471 asm_newsubscn.c asm_newsym.c asm_newcomsym.c \
472 asm_newabssym.c \
473 @@ -51,38 +49,6 @@ libasm_a_SOURCES = asm_begin.c asm_abort
474 disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \
475 symbolhash.c
476
477 -libasm_pic_a_SOURCES =
478 -am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
479 -
480 -libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl_pic.a ../libelf/libelf.so ../libdw/libdw.so
481 -libasm_so_LDLIBS = $(libasm_so_DEPS)
482 -if USE_LOCKS
483 -libasm_so_LDLIBS += -lpthread
484 -endif
485 -
486 -libasm_so_LIBS = libasm_pic.a
487 -libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS)
488 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
489 - -Wl,--soname,$@.$(VERSION) \
490 - -Wl,--version-script,$< \
491 - $(NO_UNDEFINED) \
492 - -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \
493 - $(libasm_so_LDLIBS)
494 - @$(textrel_check)
495 - $(AM_V_at)ln -fs $@ $@.$(VERSION)
496 -
497 -install: install-am libasm.so
498 - $(mkinstalldirs) $(DESTDIR)$(libdir)
499 - $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
500 - ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
501 - ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
502 -
503 -uninstall: uninstall-am
504 - rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
505 - rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
506 - rm -f $(DESTDIR)$(libdir)/libasm.so
507 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
508 -
509 noinst_HEADERS = libasmP.h symbolhash.h
510 EXTRA_DIST = libasm.map
511
512 --- a/libdwfl/Makefile.am
513 +++ b/libdwfl/Makefile.am
514 @@ -34,13 +34,11 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
515 -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf -I$(builddir)/../debuginfod
516 VERSION = 1
517
518 -noinst_LIBRARIES = libdwfl.a
519 -noinst_LIBRARIES += libdwfl_pic.a
520 +noinst_LTLIBRARIES = libdwfl.la
521
522 pkginclude_HEADERS = libdwfl.h
523
524 -
525 -libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
526 +libdwfl_la_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
527 dwfl_module.c dwfl_report_elf.c relocate.c \
528 dwfl_module_build_id.c dwfl_module_report_build_id.c \
529 derelocate.c offline.c segment.c \
530 @@ -73,24 +71,14 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
531 gzip.c debuginfod-client.c
532
533 if BZLIB
534 -libdwfl_a_SOURCES += bzip2.c
535 +libdwfl_la_SOURCES += bzip2.c
536 endif
537 if LZMA
538 -libdwfl_a_SOURCES += lzma.c
539 +libdwfl_la_SOURCES += lzma.c
540 endif
541 if ZSTD
542 -libdwfl_a_SOURCES += zstd.c
543 +libdwfl_la_SOURCES += zstd.c
544 endif
545
546 -libdwfl = $(libdw)
547 -libdw = ../libdw/libdw.so
548 -libelf = ../libelf/libelf.so
549 -libebl = ../libebl/libebl.a
550 -libeu = ../lib/libeu.a
551 -
552 -libdwfl_pic_a_SOURCES =
553 -am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
554 -
555 noinst_HEADERS = libdwflP.h
556
557 -CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
558 --- a/backends/Makefile.am
559 +++ b/backends/Makefile.am
560 @@ -34,7 +34,7 @@ endif
561 AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
562 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
563
564 -noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a
565 +noinst_LTLIBRARIES = libebl_backends.la
566
567 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
568 m68k bpf riscv csky loongarch arc
569 @@ -102,17 +102,13 @@ loongarch_SRCS = loongarch_init.c loonga
570
571 arc_SRCS = arc_init.c arc_symbol.c
572
573 -libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
574 +libebl_backends_la_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \
575 $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \
576 $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \
577 $(ppc64_SRCS) $(s390_SRCS) \
578 $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) \
579 $(loongarch_SRCS) $(arc_SRCS)
580
581 -libebl_backends_pic_a_SOURCES =
582 -am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
583
584 noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
585 EXTRA_DIST = $(modules:=_reloc.def)
586 -
587 -MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
588 --- a/libdwelf/Makefile.am
589 +++ b/libdwelf/Makefile.am
590 @@ -34,24 +34,12 @@ AM_CPPFLAGS += -I$(srcdir)/../libelf -I$
591 -I$(srcdir)/../libdwfl -I$(srcdir)/../libebl
592 VERSION = 1
593
594 -noinst_LIBRARIES = libdwelf.a libdwelf_pic.a
595 +noinst_LTLIBRARIES = libdwelf.la
596
597 pkginclude_HEADERS = libdwelf.h
598 noinst_HEADERS = libdwelfP.h
599
600 -libdwelf_a_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
601 +libdwelf_la_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \
602 dwelf_elf_gnu_build_id.c dwelf_scn_gnu_compressed_size.c \
603 dwelf_strtab.c dwelf_elf_begin.c \
604 dwelf_elf_e_machine_string.c
605 -
606 -libdwelf = $(libdw)
607 -
608 -libdw = ../libdw/libdw.so
609 -libelf = ../libelf/libelf.so
610 -libebl = ../libebl/libebl.a
611 -libeu = ../lib/libeu.a
612 -
613 -libdwelf_pic_a_SOURCES =
614 -am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
615 -
616 -CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
617 --- a/libebl/Makefile.am
618 +++ b/libebl/Makefile.am
619 @@ -34,9 +34,9 @@ endif
620 AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libdw -I$(srcdir)/../libasm
621 VERSION = 1
622
623 -noinst_LIBRARIES = libebl.a libebl_pic.a
624 +noinst_LTLIBRARIES = libebl.la
625
626 -libebl_a_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
627 +libebl_la_SOURCES = eblopenbackend.c eblclosebackend.c eblreloctypename.c \
628 eblsegmenttypename.c eblsectiontypename.c \
629 eblmachineflagname.c eblsymboltypename.c \
630 ebldynamictagname.c eblsectionname.c \
631 @@ -56,9 +56,4 @@ libebl_a_SOURCES = eblopenbackend.c eblc
632 eblresolvesym.c eblcheckreloctargettype.c \
633 ebl_data_marker_symbol.c
634
635 -libebl_pic_a_SOURCES =
636 -am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os)
637 -
638 noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
639 -
640 -MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
641 --- a/debuginfod/Makefile.am
642 +++ b/debuginfod/Makefile.am
643 @@ -40,23 +40,12 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/.
644 program_prefix=
645 program_transform_name = s,x,x,
646
647 -if BUILD_STATIC
648 -libasm = ../libasm/libasm.a
649 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
650 -libelf = ../libelf/libelf.a -lz
651 -if DUMMY_LIBDEBUGINFOD
652 -libdebuginfod = ./libdebuginfod.a
653 -else
654 -libdebuginfod = ./libdebuginfod.a -lpthread $(libcurl_LIBS)
655 -endif
656 -else
657 -libasm = ../libasm/libasm.so
658 -libdw = ../libdw/libdw.so
659 -libelf = ../libelf/libelf.so
660 -libdebuginfod = ./libdebuginfod.so
661 -endif
662 -libebl = ../libebl/libebl.a
663 -libeu = ../lib/libeu.a
664 +libasm = ../libasm/libasm.la
665 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
666 +libelf = ../libelf/libelf.la
667 +libdebuginfod = ./libdebuginfod.la
668 +libebl = ../libebl/libebl.la
669 +libeu = ../lib/libeu.la
670
671 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw:.
672
673 @@ -76,14 +65,10 @@ debuginfod_find_SOURCES = debuginfod-fin
674 debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
675
676 if LIBDEBUGINFOD
677 -noinst_LIBRARIES = libdebuginfod.a
678 -noinst_LIBRARIES += libdebuginfod_pic.a
679 +libdebuginfod_la_SOURCES = debuginfod-client.c
680 +noinst_LTLIBRARIES = libdebuginfod.la
681 endif
682
683 -libdebuginfod_a_SOURCES = debuginfod-client.c
684 -libdebuginfod_pic_a_SOURCES = debuginfod-client.c
685 -am_libdebuginfod_pic_a_OBJECTS = $(libdebuginfod_a_SOURCES:.c=.os)
686 -
687 if DUMMY_LIBDEBUGINFOD
688 AM_CPPFLAGS += -Wno-unused-parameter
689 endif
690 @@ -92,42 +77,7 @@ if LIBDEBUGINFOD
691 pkginclude_HEADERS = debuginfod.h
692 endif
693
694 -if LIBDEBUGINFOD
695 -libdebuginfod_so_LIBS = libdebuginfod_pic.a
696 -if DUMMY_LIBDEBUGINFOD
697 -libdebuginfod_so_LDLIBS =
698 -else
699 -libdebuginfod_so_LDLIBS = -lpthread $(libcurl_LIBS) $(fts_LIBS) $(libelf)
700 -endif
701 -$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
702 - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
703 - -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \
704 - -Wl,--version-script,$< \
705 - $(NO_UNDEFINED) \
706 - -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \
707 - $(libdebuginfod_so_LDLIBS)
708 - @$(textrel_check)
709 -
710 -libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
711 - ln -fs $< $@
712 -
713 -install: install-am libdebuginfod.so
714 - $(mkinstalldirs) $(DESTDIR)$(libdir)
715 - $(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
716 - $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
717 - ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
718 - ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
719 -
720 -uninstall: uninstall-am
721 - rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
722 - rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
723 - rm -f $(DESTDIR)$(libdir)/libdebuginfod.so
724 - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
725 -endif
726 -
727 EXTRA_DIST = libdebuginfod.map
728 -MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
729 -CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
730
731 # automake std-options override: arrange to pass LD_LIBRARY_PATH
732 installcheck-binPROGRAMS: $(bin_PROGRAMS)
733 --- a/lib/Makefile.am
734 +++ b/lib/Makefile.am
735 @@ -31,9 +31,9 @@ include $(top_srcdir)/config/eu.am
736 AM_CFLAGS += $(fpic_CFLAGS)
737 AM_CPPFLAGS += -I$(srcdir)/../libelf
738
739 -noinst_LIBRARIES = libeu.a
740 +noinst_LTLIBRARIES = libeu.la
741
742 -libeu_a_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
743 +libeu_la_SOURCES = xasprintf.c xstrdup.c xstrndup.c xmalloc.c next_prime.c \
744 crc32.c crc32_file.c \
745 color.c error.c printversion.c
746
747 --- a/src/Makefile.am
748 +++ b/src/Makefile.am
749 @@ -29,9 +29,9 @@ bin_PROGRAMS = readelf nm size strip elf
750 elfcmp objdump ranlib strings ar unstrip stack elfcompress \
751 elfclassify srcfiles
752
753 -noinst_LIBRARIES = libar.a
754 +noinst_LTLIBRARIES = libar.la
755
756 -libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
757 +libar_la_SOURCES = arlib.c arlib2.c arlib-argp.c
758
759 EXTRA_DIST = arlib.h debugpred.h
760
761 @@ -39,27 +39,16 @@ bin_SCRIPTS = make-debug-archive
762 EXTRA_DIST += make-debug-archive.in
763 CLEANFILES += make-debug-archive
764
765 -if BUILD_STATIC
766 -libasm = ../libasm/libasm.a
767 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
768 -libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
769 +libasm = ../libasm/libasm.la
770 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) -ldl -lpthread
771 +libelf = ../libelf/libelf.la -lz $(zstd_LIBS)
772 if LIBDEBUGINFOD
773 -libdebuginfod = ../debuginfod/libdebuginfod.a -lpthread $(libcurl_LIBS)
774 +libdebuginfod = ../debuginfod/libdebuginfod.la -lpthread $(libcurl_LIBS)
775 else
776 libdebuginfod =
777 endif
778 -else
779 -libasm = ../libasm/libasm.so
780 -libdw = ../libdw/libdw.so
781 -libelf = ../libelf/libelf.so
782 -if LIBDEBUGINFOD
783 -libdebuginfod = ../debuginfod/libdebuginfod.so
784 -else
785 -libdebuginfod =
786 -endif
787 -endif
788 -libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
789 -libeu = ../lib/libeu.a
790 +libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
791 +libeu = ../lib/libeu.la
792
793 if DEMANGLE
794 demanglelib = -lstdc++
795 @@ -87,9 +76,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $
796 addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
797 elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
798 objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
799 -ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
800 +ranlib_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
801 strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
802 -ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
803 +ar_LDADD = libar.la $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
804 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
805 stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
806 elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
807 --- a/tests/Makefile.am
808 +++ b/tests/Makefile.am
809 @@ -689,17 +689,11 @@ installcheck-local:
810 TESTS_ENVIRONMENT="$(installed_TESTS_ENVIRONMENT)" \
811 LOG_COMPILER="$(installed_LOG_COMPILER)" check-TESTS
812
813 -if BUILD_STATIC
814 -libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
815 -libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
816 -libasm = ../libasm/libasm.a
817 -else
818 -libdw = ../libdw/libdw.so
819 -libelf = ../libelf/libelf.so
820 -libasm = ../libasm/libasm.so
821 -endif
822 -libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
823 -libeu = ../lib/libeu.a
824 +libdw = ../libdw/libdw.la -lz $(zip_LIBS) $(libelf) $(libebl) -ldl -lpthread
825 +libelf = ../libelf/libelf.la
826 +libasm = ../libasm/libasm.la
827 +libebl = ../libebl/libebl.la ../backends/libebl_backends.la ../libcpu/libcpu.la
828 +libeu = ../lib/libeu.la
829
830 arextract_LDADD = $(libelf)
831 arsymtest_LDADD = $(libelf)
832 --- a/libcpu/Makefile.am
833 +++ b/libcpu/Makefile.am
834 @@ -38,19 +38,16 @@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAG
835 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
836 AM_YFLAGS = -p$(<F:parse.y=)
837
838 -noinst_LIBRARIES = libcpu.a libcpu_pic.a
839 +noinst_LTLIBRARIES = libcpu.la
840
841 noinst_HEADERS = i386_dis.h i386_mne.h x86_64_dis.h
842
843 -libcpu_a_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
844 -
845 -libcpu_pic_a_SOURCES =
846 -am_libcpu_pic_a_OBJECTS = $(libcpu_a_SOURCES:.c=.os)
847 +libcpu_la_SOURCES = i386_disasm.c x86_64_disasm.c bpf_disasm.c riscv_disasm.c
848
849 i386_gendis_SOURCES = i386_gendis.c i386_lex.l i386_parse.y
850
851 -i386_disasm.o: i386.mnemonics $(srcdir)/i386_dis.h
852 -x86_64_disasm.o: x86_64.mnemonics $(srcdir)/x86_64_dis.h
853 +$(libcpu_la_OBJECTS): i386.mnemonics $(srcdir)/i386_dis.h
854 +$(libcpu_la_OBJECTS): x86_64.mnemonics $(srcdir)/x86_64_dis.h
855
856 %_defs: $(srcdir)/defs/i386
857 $(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T
858 @@ -87,20 +84,15 @@ endif
859
860 i386_lex_no_Werror = yes
861
862 -libeu = ../lib/libeu.a
863 +libeu = ../lib/libeu.la
864
865 i386_lex_CFLAGS = -Wno-unused-label -Wno-unused-function -Wno-sign-compare \
866 -Wno-implicit-fallthrough
867 -i386_parse.o: i386_parse.c i386.mnemonics
868 -i386_lex.o: i386_parse.h
869 i386_gendis_LDADD = $(libeu) -lm $(obstack_LIBS)
870
871 -i386_parse.h: i386_parse.c ;
872 -
873 bpf_disasm_CFLAGS = -Wno-format-nonliteral
874
875 EXTRA_DIST = defs/i386
876
877 -MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
878 CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
879 MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
880 --- a/config/libelf.pc.in
881 +++ b/config/libelf.pc.in
882 @@ -8,7 +8,7 @@ Description: elfutils libelf library to
883 Version: @VERSION@
884 URL: http://elfutils.org/
885
886 -Libs: -L${libdir} -lelf
887 +Libs: -L${libdir} -lelf -lz
888 Cflags: -I${includedir}
889
890 Requires.private: zlib @LIBZSTD@
891 --- a/lib/next_prime.c
892 +++ b/lib/next_prime.c
893 @@ -27,6 +27,7 @@
894 the GNU Lesser General Public License along with this program. If
895 not, see <http://www.gnu.org/licenses/>. */
896
897 +#include <config.h>
898 #include <stddef.h>
899
900
901 --- a/libdw/libdwP.h
902 +++ b/libdw/libdwP.h
903 @@ -35,7 +35,7 @@
904 #include <libeu.h>
905 #include <libdw.h>
906 #include <dwarf.h>
907 -#include <libgen.h>
908 +#include <dirname.h>
909
910
911 /* Known location expressions already decoded. */
912
913 --- a/libdwfl/libdwflP.h
914 +++ b/libdwfl/libdwflP.h
915 @@ -32,7 +32,7 @@
916 #include <libdwfl.h>
917 #include <libebl.h>
918 #include <libeu.h>
919 -#include <libgen.h>
920 +#include <dirname.h>
921 #include <assert.h>
922 #include <dirent.h>
923 #include <errno.h>
924