libelf: Add libeu objects to libelf.a static archive

Message ID 20241022130343.1658267-1-mark@klomp.org
State Committed
Headers
Series libelf: Add libeu objects to libelf.a static archive |

Commit Message

Mark Wielaard Oct. 22, 2024, 1:03 p.m. UTC
  libelf might use some symbols from libeu.a, specifically the eu-search
wrappers. But we don't ship libeu.a separately. So include the libeu
objects in the libelf.a archive to facilitate static linking.

	* libelf/Makefile.am (libeu_objects): New variable.
	(libelf_a_LIBADD): New, add libeu_objects.

https://sourceware.org/bugzilla/show_bug.cgi?id=32293

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libelf/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Aaron Merey Oct. 22, 2024, 1:19 p.m. UTC | #1
On Tue, Oct 22, 2024 at 9:04 AM Mark Wielaard <mark@klomp.org> wrote:
>
> libelf might use some symbols from libeu.a, specifically the eu-search
> wrappers. But we don't ship libeu.a separately. So include the libeu
> objects in the libelf.a archive to facilitate static linking.
>
>         * libelf/Makefile.am (libeu_objects): New variable.
>         (libelf_a_LIBADD): New, add libeu_objects.
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=32293
>
> Signed-off-by: Mark Wielaard <mark@klomp.org>
> ---
>  libelf/Makefile.am | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libelf/Makefile.am b/libelf/Makefile.am
> index 3402863ef174..2d3dbdf22756 100644
> --- a/libelf/Makefile.am
> +++ b/libelf/Makefile.am
> @@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
>         @$(textrel_check)
>         $(AM_V_at)ln -fs $@ $@.$(VERSION)
>
> +libeu_objects = $(shell $(AR) t ../lib/libeu.a)
> +libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects))
> +
>  install: install-am libelf.so
>         $(mkinstalldirs) $(DESTDIR)$(libdir)
>         $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
> --
> 2.47.0
>

Thanks Mark, LGTM

Aaron
  

Patch

diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 3402863ef174..2d3dbdf22756 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -122,6 +122,9 @@  libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS)
 	@$(textrel_check)
 	$(AM_V_at)ln -fs $@ $@.$(VERSION)
 
+libeu_objects = $(shell $(AR) t ../lib/libeu.a)
+libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects))
+
 install: install-am libelf.so
 	$(mkinstalldirs) $(DESTDIR)$(libdir)
 	$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so