mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
tools/elfutils: split upstreamable parts of portability patch
The addition of LT_INIT as well as the adjustment of the BUILD_STATIC and addition of the BUILD_SHARED conditionals and their usage to block building of shared objects and adjust the variables for building static libraries is potentially upstream-friendly. The use of a manifest file to keep a list of the objects in each library instead of calling ar is also potentially upstream-friendly. Separate these changes from the macOS-specific hacks. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
9670a38d08
commit
52a5344501
@ -8,7 +8,7 @@
|
||||
|
||||
AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.])
|
||||
AC_PREREQ(2.63) dnl Minimum Autoconf version required.
|
||||
@@ -88,16 +89,21 @@ AS_IF([test "$use_locks" = yes],
|
||||
@@ -88,11 +89,14 @@ AS_IF([test "$use_locks" = yes],
|
||||
|
||||
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
|
||||
|
||||
@ -23,26 +23,7 @@
|
||||
# Only available since automake 1.12
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_CHECK_TOOL([READELF], [readelf])
|
||||
AC_CHECK_TOOL([NM], [nm])
|
||||
|
||||
+LT_INIT([shared disable-static])
|
||||
+
|
||||
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
|
||||
ac_cv_visibility, [dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
@@ -415,7 +421,10 @@ AS_HELP_STRING([--enable-install-elfh],[
|
||||
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
|
||||
|
||||
AM_CONDITIONAL(BUILD_STATIC, [dnl
|
||||
-test "$use_gprof" = yes -o "$use_gcov" = yes])
|
||||
+test "$use_gprof" = yes -o "$use_gcov" = yes -o "$enable_static" = yes])
|
||||
+
|
||||
+AM_CONDITIONAL(BUILD_SHARED, [dnl
|
||||
+test "$enable_shared" = yes])
|
||||
|
||||
AC_ARG_ENABLE([tests-rpath],
|
||||
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
|
||||
@@ -635,6 +644,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
@@ -635,6 +639,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
|
||||
CFLAGS="$old_CFLAGS"])
|
||||
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
|
||||
|
||||
@ -91,47 +72,6 @@
|
||||
# define INTUSE(name) _INTUSE(name)
|
||||
# define _INTUSE(name) __##name##_internal
|
||||
# define INTDEF(name) _INTDEF(name)
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -35,8 +35,11 @@ endif
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libelf.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libelf_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
include_HEADERS = libelf.h gelf.h nlist.h
|
||||
|
||||
noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
|
||||
@@ -122,11 +125,15 @@ libelf.so: $(srcdir)/libelf.map $(libelf
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libelf.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
|
||||
ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
|
||||
+else
|
||||
+libelf_a_LIBADD = $(foreach dep,$(libelf_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
@@ -135,4 +132,10 @@ uninstall: uninstall-am
|
||||
|
||||
EXTRA_DIST = libelf.map
|
||||
|
||||
+EXTRA_libelf_a_DEPENDENCIES = libelf.manifest
|
||||
+
|
||||
+libelf.manifest: $(libelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
|
||||
--- a/backends/i386_auxv.c
|
||||
+++ b/backends/i386_auxv.c
|
||||
@@ -48,5 +48,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
|
||||
@ -263,271 +203,6 @@
|
||||
#include <libdw.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -35,8 +35,10 @@ AM_CPPFLAGS += -I$(srcdir)/../libebl -I$
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libdw.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libdw_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
|
||||
include_HEADERS = dwarf.h
|
||||
pkginclude_HEADERS = libdw.h known-dwarf.h
|
||||
@@ -121,11 +123,13 @@ libdw.so: $(srcdir)/libdw.map $(libdw_so
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdw.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
|
||||
ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
@@ -133,24 +128,31 @@ uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw.so
|
||||
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
|
||||
|
||||
-libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
|
||||
+libdwfl_objects = $(shell cat ../libdwfl/libdwfl.manifest)
|
||||
libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
|
||||
|
||||
-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
|
||||
+libdwelf_objects = $(shell cat ../libdwelf/libdwelf.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
|
||||
|
||||
-libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
|
||||
+libebl_objects = $(shell cat ../libebl/libebl.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
|
||||
|
||||
-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
|
||||
+backends_objects = $(shell cat ../backends/libebl_backends.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
|
||||
|
||||
-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
|
||||
+libcpu_objects = $(shell cat ../libcpu/libcpu.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
|
||||
|
||||
+if !BUILD_SHARED
|
||||
+libdw_a_LIBADD += $(foreach dep,$(libdw_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
+
|
||||
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
|
||||
dwarf_sig8_hash.h cfi.h encoded-value.h
|
||||
|
||||
EXTRA_DIST = libdw.map
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so libdw.so.$(VERSION)
|
||||
+EXTRA_libdw_a_DEPENDENCIES = libdw.manifest
|
||||
+
|
||||
+libdw.manifest: $(libdw_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) $(EXTRA_libdw_a_DEPENDENCIES) libdw.so libdw.so.$(VERSION)
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -119,4 +119,9 @@ am_libebl_backends_pic_a_OBJECTS = $(lib
|
||||
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
||||
EXTRA_DIST = $(modules:=_reloc.def)
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_backends_a_DEPENDENCIES = libebl_backends.manifest
|
||||
+
|
||||
+libebl_backends.manifest: $(libebl_backends_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS) $(EXTRA_libebl_backends_a_DEPENDENCIES)
|
||||
--- a/libcpu/Makefile.am
|
||||
+++ b/libcpu/Makefile.am
|
||||
@@ -101,6 +101,11 @@ bpf_disasm_CFLAGS = -Wno-format-nonliter
|
||||
|
||||
EXTRA_DIST = defs/i386
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
|
||||
+EXTRA_libcpu_a_DEPENDENCIES = libcpu.manifest
|
||||
+
|
||||
+libcpu.manifest: $(libcpu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS) $(EXTRA_libcpu_a_DEPENDENCIES)
|
||||
CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
|
||||
MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
|
||||
--- a/libdwelf/Makefile.am
|
||||
+++ b/libdwelf/Makefile.am
|
||||
@@ -54,4 +54,10 @@ libeu = ../lib/libeu.a
|
||||
libdwelf_pic_a_SOURCES =
|
||||
am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
|
||||
|
||||
+EXTRA_libdwelf_a_DEPENDENCIES = libdwelf.manifest
|
||||
+
|
||||
+libdwelf.manifest: $(libdwelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
|
||||
--- a/libdwfl/Makefile.am
|
||||
+++ b/libdwfl/Makefile.am
|
||||
@@ -93,4 +93,10 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_S
|
||||
|
||||
noinst_HEADERS = libdwflP.h
|
||||
|
||||
+EXTRA_libdwfl_a_DEPENDENCIES = libdwfl.manifest
|
||||
+
|
||||
+libdwfl.manifest: $(libdwfl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwfl_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
|
||||
--- a/libebl/Makefile.am
|
||||
+++ b/libebl/Makefile.am
|
||||
@@ -61,4 +61,9 @@ am_libebl_pic_a_OBJECTS = $(libebl_a_SOU
|
||||
|
||||
noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_a_DEPENDENCIES = libebl.manifest
|
||||
+
|
||||
+libebl.manifest: $(libebl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS) $(EXTRA_libebl_a_DEPENDENCIES)
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -41,3 +41,10 @@ noinst_HEADERS = fixedsizehash.h libeu.h
|
||||
eu-config.h color.h printversion.h bpf.h \
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h
|
||||
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
|
||||
+
|
||||
+EXTRA_libeu_a_DEPENDENCIES = libeu.manifest
|
||||
+
|
||||
+libeu.manifest: $(libeu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libeu_a_DEPENDENCIES)
|
||||
--- a/libasm/Makefile.am
|
||||
+++ b/libasm/Makefile.am
|
||||
@@ -33,8 +33,11 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libasm.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libasm_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
pkginclude_HEADERS = libasm.h
|
||||
|
||||
libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
|
||||
@@ -71,11 +74,15 @@ libasm.so: $(srcdir)/libasm.map $(libasm
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libasm.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
|
||||
ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
|
||||
+else
|
||||
+libasm_a_LIBADD = $(foreach dep,$(libasm_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
@@ -86,4 +83,10 @@ uninstall: uninstall-am
|
||||
noinst_HEADERS = libasmP.h symbolhash.h
|
||||
EXTRA_DIST = libasm.map
|
||||
|
||||
+EXTRA_libasm_a_DEPENDENCIES = libasm.manifest
|
||||
+
|
||||
+libasm.manifest: $(libasm_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libasm_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so libasm.so.$(VERSION)
|
||||
--- a/debuginfod/Makefile.am
|
||||
+++ b/debuginfod/Makefile.am
|
||||
@@ -77,8 +77,10 @@ debuginfod_find_LDADD = $(libdw) $(libel
|
||||
|
||||
if LIBDEBUGINFOD
|
||||
noinst_LIBRARIES = libdebuginfod.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES += libdebuginfod_pic.a
|
||||
endif
|
||||
+endif
|
||||
|
||||
libdebuginfod_a_SOURCES = debuginfod-client.c
|
||||
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
|
||||
@@ -111,12 +113,16 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
|
||||
libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs $< $@
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdebuginfod.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
|
||||
$(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
|
||||
+else
|
||||
+libdebuginfod_a_LIBADD = $(foreach dep,$(wildcard $(libdebuginfod_so_LDLIBS:.so=.a)) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
@@ -126,7 +122,13 @@ uninstall: uninstall-am
|
||||
endif
|
||||
|
||||
EXTRA_DIST = libdebuginfod.map
|
||||
-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
|
||||
+
|
||||
+EXTRA_libdebuginfod_a_DEPENDENCIES = libdebuginfod.manifest
|
||||
+
|
||||
+libdebuginfod.manifest: $(libdebuginfod_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME) $(EXTRA_libdebuginfod_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
|
||||
|
||||
# automake std-options override: arrange to pass LD_LIBRARY_PATH
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -50,7 +50,7 @@ check_PROGRAMS = arextract arsymtest new
|
||||
dwfl-report-offline-memory \
|
||||
varlocs backtrace backtrace-child \
|
||||
backtrace-data backtrace-dwarf debuglink debugaltlink \
|
||||
- buildid deleted deleted-lib.so aggregate_size peel_type \
|
||||
+ buildid aggregate_size peel_type \
|
||||
vdsosyms \
|
||||
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
|
||||
elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr \
|
||||
@@ -180,7 +180,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
run-readelf-addr.sh run-readelf-str.sh \
|
||||
run-readelf-multi-noline.sh \
|
||||
run-readelf-types.sh \
|
||||
- run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
|
||||
+ run-readelf-dwz-multi.sh run-allfcts-multi.sh \
|
||||
run-linkmap-cut.sh run-aggregate-size.sh run-peel-type.sh \
|
||||
vdsosyms run-readelf-A.sh \
|
||||
run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
|
||||
@@ -284,6 +284,11 @@ funcretval_test__11_SOURCES = funcretval
|
||||
TESTS += run-funcretval++11.sh
|
||||
endif
|
||||
|
||||
+if BUILD_SHARED
|
||||
+check_PROGRAMS += deleted deleted-lib.so
|
||||
+TESTS += run-deleted.sh
|
||||
+endif
|
||||
+
|
||||
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
|
||||
run-ar-N.sh \
|
||||
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
|
||||
--- a/config/libelf.pc.in
|
||||
+++ b/config/libelf.pc.in
|
||||
@@ -8,7 +8,7 @@ Description: elfutils libelf library to
|
||||
|
183
tools/elfutils/patches/101-shared-conditional.patch
Normal file
183
tools/elfutils/patches/101-shared-conditional.patch
Normal file
@ -0,0 +1,183 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -102,6 +102,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
AC_CHECK_TOOL([READELF], [readelf])
|
||||
AC_CHECK_TOOL([NM], [nm])
|
||||
|
||||
+LT_INIT([shared disable-static])
|
||||
+
|
||||
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
|
||||
ac_cv_visibility, [dnl
|
||||
save_CFLAGS="$CFLAGS"
|
||||
@@ -419,7 +421,10 @@ AS_HELP_STRING([--enable-install-elfh],[
|
||||
AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
|
||||
|
||||
AM_CONDITIONAL(BUILD_STATIC, [dnl
|
||||
-test "$use_gprof" = yes -o "$use_gcov" = yes])
|
||||
+test "$use_gprof" = yes -o "$use_gcov" = yes -o "$enable_static" = yes])
|
||||
+
|
||||
+AM_CONDITIONAL(BUILD_SHARED, [dnl
|
||||
+test "$enable_shared" = yes])
|
||||
|
||||
AC_ARG_ENABLE([tests-rpath],
|
||||
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -35,8 +35,11 @@ endif
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libelf.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libelf_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
include_HEADERS = libelf.h gelf.h nlist.h
|
||||
|
||||
noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
|
||||
@@ -122,11 +125,15 @@ libelf.so: $(srcdir)/libelf.map $(libelf
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libelf.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
|
||||
ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
|
||||
+else
|
||||
+libelf_a_LIBADD = $(foreach dep,$(libelf_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -35,8 +35,10 @@ AM_CPPFLAGS += -I$(srcdir)/../libebl -I$
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libdw.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libdw_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
|
||||
include_HEADERS = dwarf.h
|
||||
pkginclude_HEADERS = libdw.h known-dwarf.h
|
||||
@@ -121,11 +123,13 @@ libdw.so: $(srcdir)/libdw.map $(libdw_so
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdw.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
|
||||
ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
|
||||
@@ -148,6 +152,10 @@ libdw_a_LIBADD += $(addprefix ../backend
|
||||
libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
|
||||
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
|
||||
|
||||
+if !BUILD_SHARED
|
||||
+libdw_a_LIBADD += $(foreach dep,$(libdw_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
+
|
||||
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
|
||||
dwarf_sig8_hash.h cfi.h encoded-value.h
|
||||
|
||||
--- a/libasm/Makefile.am
|
||||
+++ b/libasm/Makefile.am
|
||||
@@ -33,8 +33,11 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
|
||||
VERSION = 1
|
||||
|
||||
lib_LIBRARIES = libasm.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES = libasm_pic.a
|
||||
noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
|
||||
+endif
|
||||
+
|
||||
pkginclude_HEADERS = libasm.h
|
||||
|
||||
libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
|
||||
@@ -71,11 +74,15 @@ libasm.so: $(srcdir)/libasm.map $(libasm
|
||||
@$(textrel_check)
|
||||
$(AM_V_at)ln -fs $@ $@.$(VERSION)
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libasm.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
|
||||
ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
|
||||
+else
|
||||
+libasm_a_LIBADD = $(foreach dep,$(libasm_so_DEPS:.so=.a) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
|
||||
--- a/debuginfod/Makefile.am
|
||||
+++ b/debuginfod/Makefile.am
|
||||
@@ -77,8 +77,10 @@ debuginfod_find_LDADD = $(libdw) $(libel
|
||||
|
||||
if LIBDEBUGINFOD
|
||||
noinst_LIBRARIES = libdebuginfod.a
|
||||
+if BUILD_SHARED
|
||||
noinst_LIBRARIES += libdebuginfod_pic.a
|
||||
endif
|
||||
+endif
|
||||
|
||||
libdebuginfod_a_SOURCES = debuginfod-client.c
|
||||
libdebuginfod_pic_a_SOURCES = debuginfod-client.c
|
||||
@@ -111,12 +113,16 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
|
||||
libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs $< $@
|
||||
|
||||
+if BUILD_SHARED
|
||||
install: install-am libdebuginfod.so
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_PROGRAM) $(LIBDEBUGINFOD_SONAME) \
|
||||
$(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME)
|
||||
ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so
|
||||
+else
|
||||
+libdebuginfod_a_LIBADD = $(foreach dep,$(wildcard $(libdebuginfod_so_LDLIBS:.so=.a)) $(LIBS:.so=.a),$(if $(findstring a,$(suffix $(dep))),$(addprefix $(dir $(dep)),$(shell cat $(basename $(dep)).manifest)),$(dep)))
|
||||
+endif
|
||||
|
||||
uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -50,7 +50,7 @@ check_PROGRAMS = arextract arsymtest new
|
||||
dwfl-report-offline-memory \
|
||||
varlocs backtrace backtrace-child \
|
||||
backtrace-data backtrace-dwarf debuglink debugaltlink \
|
||||
- buildid deleted deleted-lib.so aggregate_size peel_type \
|
||||
+ buildid aggregate_size peel_type \
|
||||
vdsosyms \
|
||||
getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
|
||||
elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr \
|
||||
@@ -180,7 +180,7 @@ TESTS = run-arextract.sh run-arsymtest.s
|
||||
run-readelf-addr.sh run-readelf-str.sh \
|
||||
run-readelf-multi-noline.sh \
|
||||
run-readelf-types.sh \
|
||||
- run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
|
||||
+ run-readelf-dwz-multi.sh run-allfcts-multi.sh \
|
||||
run-linkmap-cut.sh run-aggregate-size.sh run-peel-type.sh \
|
||||
vdsosyms run-readelf-A.sh \
|
||||
run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
|
||||
@@ -284,6 +284,11 @@ funcretval_test__11_SOURCES = funcretval
|
||||
TESTS += run-funcretval++11.sh
|
||||
endif
|
||||
|
||||
+if BUILD_SHARED
|
||||
+check_PROGRAMS += deleted deleted-lib.so
|
||||
+TESTS += run-deleted.sh
|
||||
+endif
|
||||
+
|
||||
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
|
||||
run-ar-N.sh \
|
||||
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
|
161
tools/elfutils/patches/110-objects-manifest.patch
Normal file
161
tools/elfutils/patches/110-objects-manifest.patch
Normal file
@ -0,0 +1,161 @@
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -137,19 +137,19 @@ uninstall: uninstall-am
|
||||
rm -f $(DESTDIR)$(libdir)/libdw.so
|
||||
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
|
||||
|
||||
-libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
|
||||
+libdwfl_objects = $(shell cat ../libdwfl/libdwfl.manifest)
|
||||
libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
|
||||
|
||||
-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
|
||||
+libdwelf_objects = $(shell cat ../libdwelf/libdwelf.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
|
||||
|
||||
-libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
|
||||
+libebl_objects = $(shell cat ../libebl/libebl.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
|
||||
|
||||
-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
|
||||
+backends_objects = $(shell cat ../backends/libebl_backends.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
|
||||
|
||||
-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
|
||||
+libcpu_objects = $(shell cat ../libcpu/libcpu.manifest)
|
||||
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
|
||||
|
||||
if !BUILD_SHARED
|
||||
@@ -161,4 +161,9 @@ noinst_HEADERS = libdwP.h memory-access.
|
||||
|
||||
EXTRA_DIST = libdw.map
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so libdw.so.$(VERSION)
|
||||
+EXTRA_libdw_a_DEPENDENCIES = libdw.manifest
|
||||
+
|
||||
+libdw.manifest: $(libdw_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) $(EXTRA_libdw_a_DEPENDENCIES) libdw.so libdw.so.$(VERSION)
|
||||
--- a/libdwfl/Makefile.am
|
||||
+++ b/libdwfl/Makefile.am
|
||||
@@ -93,4 +93,10 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_S
|
||||
|
||||
noinst_HEADERS = libdwflP.h
|
||||
|
||||
+EXTRA_libdwfl_a_DEPENDENCIES = libdwfl.manifest
|
||||
+
|
||||
+libdwfl.manifest: $(libdwfl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwfl_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
|
||||
--- a/libdwelf/Makefile.am
|
||||
+++ b/libdwelf/Makefile.am
|
||||
@@ -54,4 +54,10 @@ libeu = ../lib/libeu.a
|
||||
libdwelf_pic_a_SOURCES =
|
||||
am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
|
||||
|
||||
+EXTRA_libdwelf_a_DEPENDENCIES = libdwelf.manifest
|
||||
+
|
||||
+libdwelf.manifest: $(libdwelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libdwelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
|
||||
--- a/libebl/Makefile.am
|
||||
+++ b/libebl/Makefile.am
|
||||
@@ -61,4 +61,9 @@ am_libebl_pic_a_OBJECTS = $(libebl_a_SOU
|
||||
|
||||
noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_a_DEPENDENCIES = libebl.manifest
|
||||
+
|
||||
+libebl.manifest: $(libebl_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS) $(EXTRA_libebl_a_DEPENDENCIES)
|
||||
--- a/backends/Makefile.am
|
||||
+++ b/backends/Makefile.am
|
||||
@@ -119,4 +119,9 @@ am_libebl_backends_pic_a_OBJECTS = $(lib
|
||||
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
|
||||
EXTRA_DIST = $(modules:=_reloc.def)
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
|
||||
+EXTRA_libebl_backends_a_DEPENDENCIES = libebl_backends.manifest
|
||||
+
|
||||
+libebl_backends.manifest: $(libebl_backends_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS) $(EXTRA_libebl_backends_a_DEPENDENCIES)
|
||||
--- a/libcpu/Makefile.am
|
||||
+++ b/libcpu/Makefile.am
|
||||
@@ -101,6 +101,11 @@ bpf_disasm_CFLAGS = -Wno-format-nonliter
|
||||
|
||||
EXTRA_DIST = defs/i386
|
||||
|
||||
-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
|
||||
+EXTRA_libcpu_a_DEPENDENCIES = libcpu.manifest
|
||||
+
|
||||
+libcpu.manifest: $(libcpu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS) $(EXTRA_libcpu_a_DEPENDENCIES)
|
||||
CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
|
||||
MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -142,4 +142,10 @@ uninstall: uninstall-am
|
||||
|
||||
EXTRA_DIST = libelf.map
|
||||
|
||||
+EXTRA_libelf_a_DEPENDENCIES = libelf.manifest
|
||||
+
|
||||
+libelf.manifest: $(libelf_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libelf_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -41,3 +41,10 @@ noinst_HEADERS = fixedsizehash.h libeu.h
|
||||
eu-config.h color.h printversion.h bpf.h \
|
||||
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h
|
||||
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
|
||||
+
|
||||
+EXTRA_libeu_a_DEPENDENCIES = libeu.manifest
|
||||
+
|
||||
+libeu.manifest: $(libeu_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libeu_a_DEPENDENCIES)
|
||||
--- a/libasm/Makefile.am
|
||||
+++ b/libasm/Makefile.am
|
||||
@@ -93,4 +93,10 @@ uninstall: uninstall-am
|
||||
noinst_HEADERS = libasmP.h symbolhash.h
|
||||
EXTRA_DIST = libasm.map
|
||||
|
||||
+EXTRA_libasm_a_DEPENDENCIES = libasm.manifest
|
||||
+
|
||||
+libasm.manifest: $(libasm_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(EXTRA_libasm_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so libasm.so.$(VERSION)
|
||||
--- a/debuginfod/Makefile.am
|
||||
+++ b/debuginfod/Makefile.am
|
||||
@@ -132,7 +132,13 @@ uninstall: uninstall-am
|
||||
endif
|
||||
|
||||
EXTRA_DIST = libdebuginfod.map
|
||||
-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
|
||||
+
|
||||
+EXTRA_libdebuginfod_a_DEPENDENCIES = libdebuginfod.manifest
|
||||
+
|
||||
+libdebuginfod.manifest: $(libdebuginfod_a_OBJECTS)
|
||||
+ echo $^ > $@
|
||||
+
|
||||
+MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME) $(EXTRA_libdebuginfod_a_DEPENDENCIES)
|
||||
CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
|
||||
|
||||
# automake std-options override: arrange to pass LD_LIBRARY_PATH
|
Loading…
Reference in New Issue
Block a user