openwrt/tools/elfutils/patches/100-portability.patch

583 lines
19 KiB
Diff
Raw Normal View History

--- a/configure.ac
+++ b/configure.ac
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@@ -44,6 +44,7 @@ fi
AC_CONFIG_AUX_DIR([config])
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
AC_CONFIG_FILES([config/Makefile])
+AC_CONFIG_FILES([libgnu/Makefile])
AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.])
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
AC_PREREQ(2.63) dnl Minimum Autoconf version required.
@@ -88,16 +89,21 @@ AS_IF([test "$use_locks" = yes],
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+AC_USE_SYSTEM_EXTENSIONS()
+
m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
AC_PROG_CXX
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_LEX([noyywrap])
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+gl_EARLY
# Only available since automake 1.12
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CHECK_TOOL([READELF], [readelf])
AC_CHECK_TOOL([NM], [nm])
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+LT_INIT([shared disable-static])
+
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
ac_cv_visibility, [dnl
save_CFLAGS="$CFLAGS"
@@ -415,7 +421,7 @@ 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])
AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
@@ -635,6 +641,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
CFLAGS="$old_CFLAGS"])
AS_IF([test "x$ac_cv_fno_addrsig" = "xyes"], CFLAGS="$CFLAGS -fno-addrsig")
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+gl_INIT
+
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([argp_parse], [argp])
LIBS="$saved_LIBS"
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -59,14 +59,18 @@
# define once(once_control, init_routine) init_routine()
#endif /* USE_LOCKS */
-#include <libintl.h>
+#include <gettext.h>
/* gettext helper macros. */
#define N_(Str) Str
#define _(Str) dgettext ("elfutils", Str)
/* Compiler-specific definitions. */
+#ifdef __APPLE__
+#define strong_alias(name, aliasname)
+#else
#define strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#endif
#ifdef __i386__
# define internal_function __attribute__ ((regparm (3), stdcall))
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@@ -77,7 +81,7 @@
#define internal_strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
-#ifdef HAVE_VISIBILITY
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+#if defined(HAVE_VISIBILITY) && !defined(__APPLE__)
#define attribute_hidden \
__attribute__ ((visibility ("hidden")))
#else
@@ -166,7 +170,7 @@ asm (".section predict_data, \"aw\"; .pr
#endif
/* Avoid PLT entries. */
-#ifdef PIC
+#if defined(PIC) && !defined(__APPLE__)
# define INTUSE(name) _INTUSE(name)
# define _INTUSE(name) __##name##_internal
# define INTDEF(name) _INTDEF(name)
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
@@ -35,8 +35,6 @@ endif
VERSION = 1
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
lib_LIBRARIES = libelf.a
-noinst_LIBRARIES = libelf_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
include_HEADERS = libelf.h gelf.h nlist.h
noinst_HEADERS = abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
@@ -111,6 +109,8 @@ if USE_LOCKS
libelf_so_LDLIBS += -lpthread
endif
+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)))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
+
libelf_so_LIBS = libelf_pic.a
libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
@@ -122,11 +122,8 @@ libelf.so: $(srcdir)/libelf.map $(libelf
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
-install: install-am libelf.so
+install: install-am
$(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
uninstall: uninstall-am
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
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
return 1;
}
-__typeof (i386_auxv_info) x86_64_auxv_info
- __attribute__ ((alias ("i386_auxv_info")));
+auxv_info_alias(x86_64)
--- a/backends/ppc_regs.c
+++ b/backends/ppc_regs.c
@@ -204,5 +204,11 @@ ppc_register_info (Ebl *ebl __attribute_
return namelen;
}
-__typeof (ppc_register_info)
- ppc64_register_info __attribute__ ((alias ("ppc_register_info")));
+ssize_t
+ppc64_register_info (Ebl *ebl,
+ int regno, char *name, size_t namelen,
+ const char **prefix, const char **setname,
+ int *bits, int *type)
+{
+ return ppc_register_info(ebl, regno, name, namelen, prefix, setname, bits, type);
+}
--- a/backends/libebl_CPU.h
+++ b/backends/libebl_CPU.h
@@ -97,4 +97,10 @@ dwarf_is_pointer (int tag)
case DW_TAG_reference_type: \
case DW_TAG_rvalue_reference_type
+#define auxv_info_alias(arch) \
+ int EBLHOOK_1(arch ## _, auxv_info) (GElf_Xword a_type, const char **name, const char **format) \
+ { \
+ return EBLHOOK(auxv_info)(a_type, name, format); \
+ }
+
#endif /* libebl_CPU.h */
--- a/backends/ppc_auxv.c
+++ b/backends/ppc_auxv.c
@@ -51,5 +51,4 @@ EBLHOOK(auxv_info) (GElf_Xword a_type, c
return 1;
}
-__typeof (ppc_auxv_info) ppc64_auxv_info
- __attribute__ ((alias ("ppc_auxv_info")));
+auxv_info_alias(ppc64)
--- a/backends/ppc_cfi.c
+++ b/backends/ppc_cfi.c
@@ -72,6 +72,7 @@ ppc_abi_cfi (Ebl *ebl __attribute__ ((un
return 0;
}
-__typeof (ppc_abi_cfi)
- ppc64_abi_cfi
- __attribute__ ((alias ("ppc_abi_cfi")));
+int ppc64_abi_cfi(Ebl *ebl, Dwarf_CIE *abi_info)
+{
+ return ppc_abi_cfi(ebl, abi_info);
+}
--- a/backends/ppc_initreg.c
+++ b/backends/ppc_initreg.c
@@ -68,9 +68,10 @@ ppc_dwarf_to_regno (Ebl *ebl __attribute
abort ();
}
-__typeof (ppc_dwarf_to_regno)
- ppc64_dwarf_to_regno
- __attribute__ ((alias ("ppc_dwarf_to_regno")));
+bool ppc64_dwarf_to_regno (Ebl *ebl, unsigned *regno)
+{
+ return ppc_dwarf_to_regno(ebl, regno);
+}
bool
ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
@@ -127,6 +128,7 @@ ppc_set_initial_registers_tid (pid_t tid
#endif /* __powerpc__ */
}
-__typeof (ppc_set_initial_registers_tid)
- ppc64_set_initial_registers_tid
- __attribute__ ((alias ("ppc_set_initial_registers_tid")));
+bool ppc64_set_initial_registers_tid(pid_t tid, ebl_tid_registers_t *setfunc, void *arg)
+{
+ return ppc_set_initial_registers_tid(tid, setfunc, arg);
+}
--- a/backends/ppc_attrs.c
+++ b/backends/ppc_attrs.c
@@ -81,6 +81,9 @@ ppc_check_object_attribute (Ebl *ebl __a
return false;
}
-__typeof (ppc_check_object_attribute)
- ppc64_check_object_attribute
- __attribute__ ((alias ("ppc_check_object_attribute")));
+bool ppc64_check_object_attribute(Ebl *ebl,
+ const char *vendor, int tag, uint64_t value,
+ const char **tag_name, const char **value_name)
+{
+ return ppc_check_object_attribute(ebl, vendor, tag, value, tag_name, value_name);
+}
--- a/libdwfl/libdwflP.h
+++ b/libdwfl/libdwflP.h
@@ -31,6 +31,7 @@
#include <libdwfl.h>
#include <libebl.h>
+#include <libeu.h>
#include <assert.h>
#include <dirent.h>
#include <errno.h>
--- /dev/null
+++ b/lib/stdio_ext.h
@@ -0,0 +1,6 @@
+#include <stdio.h>
+#ifndef __APPLE__
+#include_next <stdio_ext.h>
+#else
+#define __fsetlocking(...) 0
+#endif
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@@ -32,6 +32,7 @@
#include <stdbool.h>
#include <pthread.h>
+#include <libeu.h>
#include <libdw.h>
#include <dwarf.h>
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
@@ -35,8 +35,6 @@ AM_CPPFLAGS += -I$(srcdir)/../libebl -I$
VERSION = 1
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
lib_LIBRARIES = libdw.a
-noinst_LIBRARIES = libdw_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
include_HEADERS = dwarf.h
pkginclude_HEADERS = libdw.h known-dwarf.h
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@@ -121,11 +119,8 @@ libdw.so: $(srcdir)/libdw.map $(libdw_so
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
-install: install-am libdw.so
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+install: install-am
$(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
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
uninstall: uninstall-am
rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
@@ -133,24 +128,31 @@ uninstall: uninstall-am
rm -f $(DESTDIR)$(libdir)/libdw.so
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
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))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
-libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
+libdwelf_objects = $(shell cat ../libdwelf/libdwelf.manifest)
libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
-libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
+libebl_objects = $(shell cat ../libebl/libebl.manifest)
libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
-backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
+backends_objects = $(shell cat ../backends/libebl_backends.manifest)
libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
-libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
+libcpu_objects = $(shell cat ../libcpu/libcpu.manifest)
libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
+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)))
+
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
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
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
@@ -33,8 +33,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/libelf -I
VERSION = 1
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
lib_LIBRARIES = libasm.a
-noinst_LIBRARIES = libasm_pic.a
-noinst_DATA = $(noinst_LIBRARIES:_pic.a=.so)
pkginclude_HEADERS = libasm.h
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
@@ -60,6 +58,8 @@ if USE_LOCKS
libasm_so_LDLIBS += -lpthread
endif
+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)))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
+
libasm_so_LIBS = libasm_pic.a
libasm.so: $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
@@ -71,11 +71,8 @@ libasm.so: $(srcdir)/libasm.map $(libasm
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
-install: install-am libasm.so
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+install: install-am
$(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
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
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
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
@@ -77,7 +77,6 @@ debuginfod_find_LDADD = $(libdw) $(libel
if LIBDEBUGINFOD
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
noinst_LIBRARIES = libdebuginfod.a
-noinst_LIBRARIES += libdebuginfod_pic.a
endif
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
libdebuginfod_a_SOURCES = debuginfod-client.c
@@ -98,6 +97,7 @@ if DUMMY_LIBDEBUGINFOD
libdebuginfod_so_LDLIBS =
else
libdebuginfod_so_LDLIBS = -lpthread $(libcurl_LIBS) $(fts_LIBS) $(libelf)
+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)))
tools/elfutils: do not use libtool for all subdirectories Importing gnulib in order to have a local portable library to link against for missing functions currently requires using libtool to produce the libgnu.la library. Ideally, linking would be simple if the rest of the libraries built by elfutils were also built using libtool, as linking them together would not require any manipulations of library paths. However, upstream elfutils does not support building the libraries statically with libtool, so using libtool comes at the cost of creating a huge patch to introduce that functionality. For building on macOS, it turns out that libgnu.la is only needed for building the binaries, and that just one or two objects from libgnu are needed to build the libraries, so in this case, it would be simple to add the specific non-libtool-wrapped library and objects to the link paths as needed, rather than use libtool to link the libtool wrappers, which greatly reduces the need to patch. Not using libtool also makes the original Makefile definitions for LIBADD once again be the right ones to use. However, to be portable, for libdw the wildcard function needs to be used in order to exclude special archive members like "__.SYMDEF" which are not compiled objects because some BSD-like versions of ar include that metadata in the list, or because the library included may have objects from another subdirectory. Also, the rest of the subdirectories have custom "LDLIBS" variables meant for building shared objects only, so define the LIBADD variables with objects from those existing definitions so that when building only the static versions of the libraries, those objects can still be included. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 00:11:58 +00:00
endif
$(LIBDEBUGINFOD_SONAME): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
@@ -111,12 +111,8 @@ $(LIBDEBUGINFOD_SONAME): $(srcdir)/libde
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
libdebuginfod.so: $(LIBDEBUGINFOD_SONAME)
ln -fs $< $@
-install: install-am libdebuginfod.so
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
+install: install-am
$(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
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
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
tools/elfutils: simplify portability patch Several changes to the elfutils source files made during the process of figuring out how to successfully build elfutils on macOS turn out to not be necessary to do so, and were most likely leftover bits during testing. Remove the line changes that are not needed and add some line changes to adapt to sources as is: - Remove now unnecessary bump to autoconf version prereq - AC_CONFIG_MACRO_DIRS is not necessary to define as ACLOCAL_AMFLAGS is already defined in Makefiles - let libtool "enable_static" variable also decide the value of the local conditional BUILD_STATIC - override configure variables instead of removing checks for libraries or additions to LDFLAGS - only exclude "hidden" attribute for macOS instead of deleting - preserve original list of sources to build for libelf - use openwrt Makefile to add gnulib headers - use openwrt Makefile to add LIBADD variables - remove deletion of variables and rules for shared objects - prefer recursively expanded variables over muliple renames each time that a word is added to its value - remove changes to subdirectories that are not built and remove changes to target files of those subdirectories - prefer basic text rename over variables in cases where there would be no line number difference - give LT_INIT forced default values that match upstream - move gl_EARLY and gl_INIT down relative to compiler checks - reorganize some line changes to save some lines Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-18 03:47:54 +00:00
@@ -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 \
--- a/config/libelf.pc.in
+++ b/config/libelf.pc.in
@@ -8,7 +8,7 @@ Description: elfutils libelf library to
Version: @VERSION@
URL: http://elfutils.org/
-Libs: -L${libdir} -lelf
+Libs: -L${libdir} -lelf -lz
Cflags: -I${includedir}
Requires.private: zlib @LIBZSTD@
--- a/lib/next_prime.c
+++ b/lib/next_prime.c
@@ -27,6 +27,7 @@
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
+#include <config.h>
#include <stddef.h>
--- a/libebl/eblopenbackend.c
+++ b/libebl/eblopenbackend.c
tools/elfutils: add missing MIPS reloc support Backport an upstream patch series that adds backend elfutils support for DWARF relocations in MIPS debug info. This support is needed by pahole to generate BTF for modules in BTF-enabled kernel builds. The problem first manifests as pahole warnings during build: BTF [M] lib/libcrc32c.ko die__process_unit: DW_TAG_compile_unit (0x11) @ <0x932d> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! die__process_unit: DW_TAG_compile_unit (0x11) @ <0x99a3> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! During system boot the problem then causes module loading failures, which may result in many other runtime issues: [ 13.169785] kmodloader: loading kernel modules from /etc/modules.d/* [ ... ] [ 17.422840] mac80211_hwsim: initializing netlink [ 17.526518] PPP generic driver version 2.4.2 [ 17.550346] NET: Registered PF_PPPOX protocol family [ 17.795353] kmodloader: 26 modules could not be probed [ 17.796084] kmodloader: dependency not loaded nf_conntrack [ 17.796737] kmodloader: - act_connmark - 1 [ 17.797402] kmodloader: dependency not loaded nf_conntrack [ 17.798056] kmodloader: - act_ctinfo - 1 [ ... ] Link: https://lore.kernel.org/bpf/ZlkoM6%2FPSxVcGM6X@kodidev-ubuntu/ Signed-off-by: Tony Ambardar <itugrok@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/15697 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-10 06:59:12 +00:00
@@ -200,8 +200,6 @@ static bool default_object_note (const c
uint32_t descsz, const char *desc);
static bool default_debugscn_p (const char *name);
static bool default_copy_reloc_p (int reloc);
-static bool default_none_reloc_p (int reloc);
-static bool default_relative_reloc_p (int reloc);
static bool default_check_special_symbol (Elf *elf,
const GElf_Sym *sym,
const char *name,
tools/elfutils: add missing MIPS reloc support Backport an upstream patch series that adds backend elfutils support for DWARF relocations in MIPS debug info. This support is needed by pahole to generate BTF for modules in BTF-enabled kernel builds. The problem first manifests as pahole warnings during build: BTF [M] lib/libcrc32c.ko die__process_unit: DW_TAG_compile_unit (0x11) @ <0x932d> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! die__process_unit: DW_TAG_compile_unit (0x11) @ <0x99a3> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! During system boot the problem then causes module loading failures, which may result in many other runtime issues: [ 13.169785] kmodloader: loading kernel modules from /etc/modules.d/* [ ... ] [ 17.422840] mac80211_hwsim: initializing netlink [ 17.526518] PPP generic driver version 2.4.2 [ 17.550346] NET: Registered PF_PPPOX protocol family [ 17.795353] kmodloader: 26 modules could not be probed [ 17.796084] kmodloader: dependency not loaded nf_conntrack [ 17.796737] kmodloader: - act_connmark - 1 [ 17.797402] kmodloader: dependency not loaded nf_conntrack [ 17.798056] kmodloader: - act_ctinfo - 1 [ ... ] Link: https://lore.kernel.org/bpf/ZlkoM6%2FPSxVcGM6X@kodidev-ubuntu/ Signed-off-by: Tony Ambardar <itugrok@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/15697 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-10 06:59:12 +00:00
@@ -253,8 +251,8 @@ fill_defaults (Ebl *result)
result->object_note = default_object_note;
result->debugscn_p = default_debugscn_p;
result->copy_reloc_p = default_copy_reloc_p;
- result->none_reloc_p = default_none_reloc_p;
- result->relative_reloc_p = default_relative_reloc_p;
+ result->none_reloc_p = default_copy_reloc_p;
+ result->relative_reloc_p = default_copy_reloc_p;
result->check_special_symbol = default_check_special_symbol;
result->data_marker_symbol = default_data_marker_symbol;
result->check_st_other_bits = default_check_st_other_bits;
tools/elfutils: add missing MIPS reloc support Backport an upstream patch series that adds backend elfutils support for DWARF relocations in MIPS debug info. This support is needed by pahole to generate BTF for modules in BTF-enabled kernel builds. The problem first manifests as pahole warnings during build: BTF [M] lib/libcrc32c.ko die__process_unit: DW_TAG_compile_unit (0x11) @ <0x932d> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! die__process_unit: DW_TAG_compile_unit (0x11) @ <0x99a3> not handled! die__process_unit: tag not supported 0x11 (compile_unit)! die__process: got compile_unit unexpected tag after DW_TAG_compile_unit! During system boot the problem then causes module loading failures, which may result in many other runtime issues: [ 13.169785] kmodloader: loading kernel modules from /etc/modules.d/* [ ... ] [ 17.422840] mac80211_hwsim: initializing netlink [ 17.526518] PPP generic driver version 2.4.2 [ 17.550346] NET: Registered PF_PPPOX protocol family [ 17.795353] kmodloader: 26 modules could not be probed [ 17.796084] kmodloader: dependency not loaded nf_conntrack [ 17.796737] kmodloader: - act_connmark - 1 [ 17.797402] kmodloader: dependency not loaded nf_conntrack [ 17.798056] kmodloader: - act_ctinfo - 1 [ ... ] Link: https://lore.kernel.org/bpf/ZlkoM6%2FPSxVcGM6X@kodidev-ubuntu/ Signed-off-by: Tony Ambardar <itugrok@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/15697 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-10 06:59:12 +00:00
@@ -636,8 +634,6 @@ default_copy_reloc_p (int reloc __attrib
{
return false;
}
-strong_alias (default_copy_reloc_p, default_none_reloc_p)
-strong_alias (default_copy_reloc_p, default_relative_reloc_p)
static bool
default_check_special_symbol (Elf *elf __attribute__ ((unused)),
--- a/src/srcfiles.cxx
+++ b/src/srcfiles.cxx
@@ -78,7 +78,9 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = print_ve
/* Bug report address. */
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
+#ifdef HAVE_LIBARCHIVE
constexpr size_t BUFFER_SIZE = 8192;
+#endif
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =