From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id 5BB7D3857003 for ; Wed, 9 Dec 2020 00:12:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5BB7D3857003 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id D0BEC72C8B5; Wed, 9 Dec 2020 03:12:53 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id BE4957CC8A3; Wed, 9 Dec 2020 03:12:53 +0300 (MSK) Date: Wed, 9 Dec 2020 03:12:53 +0300 From: "Dmitry V. Levin" To: Mark Wielaard Cc: elfutils-devel@sourceware.org Subject: [PATCH v3 1/3] debuginfod: export DEBUGINFOD_SONAME macro in debuginfod.h Message-ID: <20201209001253.GA3294@altlinux.org> References: <20201130090000.GA30063@altlinux.org> <20201206122813.GA27041@altlinux.org> <70c7aa3cc1fdda6b6c886d714178654dfd0757d0.camel@klomp.org> <20201208151540.GD28403@altlinux.org> <20201208230704.GD3189@wildebeest.org> <20201208232030.GA3078@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201208232030.GA3078@altlinux.org> X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2020 00:12:58 -0000 Add DEBUGINFOD_SONAME macro to API for use by those of libdebuginfod clients that would like to dlopen the library in the same way as __libdwfl_debuginfod_init does. Signed-off-by: Dmitry V. Levin --- ChangeLog | 5 +++++ configure.ac | 5 ++++- debuginfod/ChangeLog | 11 +++++++++++ debuginfod/Makefile.am | 13 ++++++------- debuginfod/{debuginfod.h => debuginfod.h.in} | 3 +++ doc/ChangeLog | 4 ++++ doc/debuginfod_find_debuginfo.3 | 15 +++++++++++++++ 7 files changed, 48 insertions(+), 8 deletions(-) rename debuginfod/{debuginfod.h => debuginfod.h.in} (97%) diff --git a/ChangeLog b/ChangeLog index 128da6c6..dcfc1cde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-11-30 Dmitry V. Levin + + * configure.ac (LIBDEBUGINFOD_SONAME): New AC_SUBST variable. + (AC_CONFIG_FILES): Add debuginfod/debuginfod.h. + 2020-10-28 Mark Wielaard * configure.ac: Set version to 0.182. diff --git a/configure.ac b/configure.ac index 515ac704..2270509f 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,9 @@ m4_ifndef([AC_PACKAGE_URL], [Define to home page for this package]) AC_SUBST([PACKAGE_URL], ["http://elfutils.org/"])]) +LIBDEBUGINFOD_SONAME=libdebuginfod.so.1 +AC_SUBST([LIBDEBUGINFOD_SONAME]) + # We want eu- as default program prefix if none was given by the user. # But if the user explicitly provided --program-prefix="" then pretend # it wasn't set at all (NONE). We want to test this really early before @@ -61,7 +64,7 @@ dnl The RPM spec file. We substitute a few values in the file. AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) dnl debuginfo-server client & server parts. -AC_CONFIG_FILES([debuginfod/Makefile]) +AC_CONFIG_FILES([debuginfod/Makefile debuginfod/debuginfod.h]) AC_CANONICAL_HOST diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 244bcda3..6eff25cc 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,14 @@ +2020-11-30 Dmitry V. Levin + + * Makefile.am (libdebuginfod.so): Replace $@.$(VERSION) with + $(LIBDEBUGINFOD_SONAME). + (install, uninstall, MOSTLYCLEANFILES): Replace + libdebuginfod.so.$(VERSION) with $(LIBDEBUGINFOD_SONAME). + (VERSION): Remove. + * debuginfod.h: Rename to ... + * debuginfod.h.in ... this. + (DEBUGINFOD_SONAME): New macro. + 2020-11-30 Dmitry V. Levin * Makefile.am (libdebuginfod.so$(EXEEXT)): Drop $(EXEEXT) suffix. diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am index 9e7dcd54..931a0eb9 100644 --- a/debuginfod/Makefile.am +++ b/debuginfod/Makefile.am @@ -34,7 +34,6 @@ AM_CPPFLAGS += -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \ $(libmicrohttpd_CFLAGS) $(libcurl_CFLAGS) $(sqlite3_CFLAGS) \ $(libarchive_CFLAGS) -VERSION = 1 # Disable eu- prefixing for artifacts (binaries & man pages) in this # directory, since they do not conflict with binutils tools. @@ -102,30 +101,30 @@ libdebuginfod_so_LDLIBS = $(libcurl_LIBS) endif libdebuginfod.so: $(srcdir)/libdebuginfod.map $(libdebuginfod_so_LIBS) $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ - -Wl,--soname,$@.$(VERSION) \ + -Wl,--soname,$(LIBDEBUGINFOD_SONAME) \ -Wl,--version-script,$<,--no-undefined \ -Wl,--whole-archive $(libdebuginfod_so_LIBS) -Wl,--no-whole-archive \ $(libdebuginfod_so_LDLIBS) @$(textrel_check) - $(AM_V_at)ln -fs $@ $@.$(VERSION) + $(AM_V_at)ln -fs $@ $(LIBDEBUGINFOD_SONAME) endif if LIBDEBUGINFOD install: install-am libdebuginfod.so $(mkinstalldirs) $(DESTDIR)$(libdir) $(INSTALL_PROGRAM) libdebuginfod.so $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so - ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so.$(VERSION) - ln -fs libdebuginfod.so.$(VERSION) $(DESTDIR)$(libdir)/libdebuginfod.so + ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME) + ln -fs libdebuginfod-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdebuginfod.so uninstall: uninstall-am rm -f $(DESTDIR)$(libdir)/libdebuginfod-$(PACKAGE_VERSION).so - rm -f $(DESTDIR)$(libdir)/libdebuginfod.so.$(VERSION) + rm -f $(DESTDIR)$(libdir)/$(LIBDEBUGINFOD_SONAME) rm -f $(DESTDIR)$(libdir)/libdebuginfod.so rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils endif EXTRA_DIST = libdebuginfod.map -MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so.$(VERSION) +MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME) CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so # automake std-options override: arrange to pass LD_LIBRARY_PATH diff --git a/debuginfod/debuginfod.h b/debuginfod/debuginfod.h.in similarity index 97% rename from debuginfod/debuginfod.h rename to debuginfod/debuginfod.h.in index 8d90838b..e919b6e3 100644 --- a/debuginfod/debuginfod.h +++ b/debuginfod/debuginfod.h.in @@ -35,6 +35,9 @@ #define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT" #define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS" +/* The libdebuginfod soname. */ +#define DEBUGINFOD_SONAME "@LIBDEBUGINFOD_SONAME@" + /* Handle for debuginfod-client connection. */ typedef struct debuginfod_client debuginfod_client; diff --git a/doc/ChangeLog b/doc/ChangeLog index 8c33f174..8c524fd9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2020-12-06 Dmitry V. Levin + + * debuginfod_find_debuginfo.3: Document DEBUGINFOD_SONAME macro. + 2020-10-29 Frank Ch. Eigler PR26775 diff --git a/doc/debuginfod_find_debuginfo.3 b/doc/debuginfod_find_debuginfo.3 index eec04e5e..ee5e9b27 100644 --- a/doc/debuginfod_find_debuginfo.3 +++ b/doc/debuginfod_find_debuginfo.3 @@ -198,6 +198,21 @@ removed from the cache during cleaning. These files should contain only an ASCII decimal integer representing the interval or max unused age in seconds. The default is one day and one week, respectively. Values of zero mean "immediately". +.SH "MACROS" + +.SS "DEBUGINFOD_SONAME" + +Defined to the string that could be passed to +.BR dlopen (3) +if the library is loaded at runtime, for example + +.PP +.in +4n +.EX +void *debuginfod_so = dlopen(DEBUGINFOD_SONAME, RTLD_LAZY); +.EE +.in + .SH "SECURITY" .BR debuginfod_find_debuginfo (), .BR debuginfod_find_executable (), -- ldv