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