[PATCH v2] Support building when fts and obstack aren't part of libc.
Mark Wielaard
mark@klomp.org
Tue Nov 3 00:13:31 GMT 2020
Hi Érico,
On Sun, Nov 01, 2020 at 09:48:50PM -0300, Érico Nogueira via Elfutils-devel wrote:
> From: Érico Rolim <erico.erc@gmail.com>
>
> - Make configure.ac test for fts and obstack availability;
> - Add fts and obstack ldflags to all files that need them;
> - Add missing argp ldflags to programs in debuginfod/.
This looks good.
> Signed-off-by: Érico Rolim <erico.erc@gmail.com>
> ---
> ChangeLog | 4 ++++
> configure.ac | 20 ++++++++++++++++++++
> debuginfod/Makefile.am | 6 +++---
> libdw/Makefile.am | 2 +-
> src/Makefile.am | 6 +++---
> 5 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 128da6c6..565d021c 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
> +
> + * configure.ac: Check for fts and obstack from outside libc.
> +
> 2020-10-28 Mark Wielaard <mark@klomp.org>
>
> * configure.ac: Set version to 0.182.
> diff --git a/configure.ac b/configure.ac
> index 515ac704..c1a6954d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -542,6 +542,26 @@ else
> fi
> AC_SUBST([argp_LDADD])
>
> +saved_LIBS="$LIBS"
> +AC_SEARCH_LIBS([fts_close], [fts])
> +LIBS="$saved_LIBS"
> +case "$ac_cv_search_fts_close" in
> + no) AC_MSG_FAILURE([failed to find fts_close]) ;;
> + -l*) fts_LIBS="$ac_cv_search_fts_close" ;;
> + *) fts_LIBS= ;;
> +esac
> +AC_SUBST([fts_LIBS])
> +
> +saved_LIBS="$LIBS"
> +AC_SEARCH_LIBS([_obstack_free], [obstack])
> +LIBS="$saved_LIBS"
> +case "$ac_cv_search__obstack_free" in
> + no) AC_MSG_FAILURE([failed to find obstack_free]) ;;
> + -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
> + *) obstack_LIBS= ;;
> +esac
> +AC_SUBST([obstack_LIBS])
> +
> dnl The directories with content.
OK, normally this says none required which is handled by the *) case.
Shouldn't we do argp in the same way? This looks simpler than what we
have now.
> dnl Documentation.
> diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am
> index 01985600..0af3b58c 100644
> --- a/debuginfod/Makefile.am
> +++ b/debuginfod/Makefile.am
> @@ -71,10 +71,10 @@ bin_PROGRAMS += debuginfod-find
> endif
>
> debuginfod_SOURCES = debuginfod.cxx
> -debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
> +debuginfod_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS) $(libmicrohttpd_LIBS) $(sqlite3_LIBS) $(libarchive_LIBS) -lpthread -ldl
OK, debuginfod uses argp and fts.
> debuginfod_find_SOURCES = debuginfod-find.c
> -debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod)
> +debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) $(argp_LDADD) $(fts_LIBS)
Likewise for debuginfod_find.
> if LIBDEBUGINFOD
> noinst_LIBRARIES = libdebuginfod.a
> @@ -98,7 +98,7 @@ libdebuginfod_so_LIBS = libdebuginfod_pic.a
> if DUMMY_LIBDEBUGINFOD
> libdebuginfod_so_LDLIBS =
> else
> -libdebuginfod_so_LDLIBS = $(libcurl_LIBS)
> +libdebuginfod_so_LDLIBS = $(libcurl_LIBS) $(fts_LIBS)
libdebuginfod_so uses fts.
> endif
> libdebuginfod.so$(EXEEXT): $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS)
> $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
> diff --git a/libdw/Makefile.am b/libdw/Makefile.am
> index 33b5838d..1dbb3d5e 100644
> --- a/libdw/Makefile.am
> +++ b/libdw/Makefile.am
> @@ -109,7 +109,7 @@ libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
> ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
> ../libdwfl/libdwfl_pic.a
> libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
> -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) -pthread
> +libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LIBS) $(obstack_LIBS) $(zip_LIBS) -pthread
OK. libdw.so uses fts and obstacks.
> libdw_so_SOURCES =
> libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
> $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
> diff --git a/src/Makefile.am b/src/Makefile.am
> index e462e7d7..88d0ac8f 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -69,7 +69,7 @@ ar_no_Wstack_usage = yes
> unstrip_no_Wstack_usage = yes
>
> readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD)
> -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
> +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) \
> $(demanglelib)
OK, nm uses obstacks.
> size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
> strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
> @@ -78,9 +78,9 @@ findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
> addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
> elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
> objdump_LDADD = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
> -ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
> +ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
ranlib includes arlib.h which uses obstack.
> strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
> -ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
> +ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
Likewise for ar.
> unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
> stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
> elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
I added the missing ChangeLog entries and pushed.
Thanks,
Mark
More information about the Elfutils-devel
mailing list