1.0.2-6 - Better approach so as to mitigate changed treatment of...
...orphaned sections in ld.bfd/binutils-2.29, resulting in logging facility silently out of order (rhbz#1478089) - Related to that, build commands now shown in full to ease the sanity checking - Adapt spec file per the upstream version (conditionalizing build through --enable-syslog-tests no longer relevant since v1.0.2) Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
parent
63af3a4b3d
commit
9bf5b4b1b8
@ -1,8 +1,8 @@
|
||||
From 615f5ab4c68623d45bab4477d9967d8582073f2f Mon Sep 17 00:00:00 2001
|
||||
From eb3bde0891b71919e758543c8cf715b74db8411f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
|
||||
Date: Thu, 3 Aug 2017 17:40:09 +0200
|
||||
Subject: [PATCH 2/2] WIP 2: Experimental fix for libqb logging not working
|
||||
with ld.bfd 2.29
|
||||
Subject: [PATCH] WIP 4: Experimental fix for libqb logging not working with
|
||||
ld.bfd 2.29
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -25,11 +25,26 @@ symlink to the end versioned so file, which something known as an
|
||||
implicit linker script:
|
||||
https://sourceware.org/binutils/docs/ld/Implicit-Linker-Scripts.html).
|
||||
|
||||
Deficiencies of version 2 (some carried over, apparently):
|
||||
- BUILT_SOURCES in lib/Makefile.am should be generalized over all
|
||||
dependent places:
|
||||
https://www.gnu.org/software/automake/manual/automake.html#Recording-Dependencies-manually
|
||||
Version 3:
|
||||
Ditto for direct libqb.la users (incl. native examples and tests for
|
||||
which the original Makefile.am form could have been restored thanks
|
||||
to this -- not a subject of one-time configure check anymore),
|
||||
to capture the case someone is using that libtool indirection directly
|
||||
through a private checkout underneath the actual library user's repo.
|
||||
The solutions is to slightly abuse libtool's library archive handling
|
||||
and it's implicit dependency propagation within "dependency_libs"
|
||||
variable, where we inject a reference to our own artificial library
|
||||
archive that in turn eventually resolves to the discussed linker script.
|
||||
|
||||
Version 4:
|
||||
Overcomes some unintended RPATH occurrences in qb-blackbox binary
|
||||
or possibly libqb.so.*. That's definitely not desired:
|
||||
https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
|
||||
|
||||
Deficiencies of version 4 (some carried over, apparently):
|
||||
- see What's missing above
|
||||
- possibly needs and overhaul regarding documentation of the arrangement
|
||||
(now scattered throughout the files)
|
||||
|
||||
Deficiencies that are not solvable as long as we use the linker script
|
||||
to participate in restoring boundary section symbols being global again:
|
||||
@ -41,18 +56,17 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1477354#c8
|
||||
|
||||
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
|
||||
---
|
||||
configure.ac | 59 ++++++++++++++++++++++++++++++++++++++++----------
|
||||
examples/Makefile.am | 4 ++++
|
||||
include/qb/Makefile.am | 3 ++-
|
||||
lib/Makefile.am | 28 ++++++++++++++++++++++++
|
||||
configure.ac | 62 ++++++++++++++++++++++++++++++++++++++++----------
|
||||
lib/Makefile.am | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
lib/log.c | 7 ++++++
|
||||
lib/qblog_script.ld.in | 15 +++++++++++++
|
||||
tests/Makefile.am | 3 +++
|
||||
8 files changed, 107 insertions(+), 12 deletions(-)
|
||||
lib/qblog_script.la.in | 15 ++++++++++++
|
||||
lib/qblog_script.ld.in | 15 ++++++++++++
|
||||
6 files changed, 149 insertions(+), 12 deletions(-)
|
||||
create mode 100644 lib/qblog_script.la.in
|
||||
create mode 100644 lib/qblog_script.ld.in
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index fd37466..ffb81d0 100644
|
||||
index fd37466..f94af71 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -618,31 +618,68 @@ AC_SUBST(HAVE_SLOW_TESTS)
|
||||
@ -135,68 +149,80 @@ index fd37466..ffb81d0 100644
|
||||
|
||||
# --- ansi ---
|
||||
if test "x${enable_ansi}" = xyes && \
|
||||
diff --git a/examples/Makefile.am b/examples/Makefile.am
|
||||
index 3637d30..b2264fd 100644
|
||||
--- a/examples/Makefile.am
|
||||
+++ b/examples/Makefile.am
|
||||
@@ -23,6 +23,10 @@ CLEANFILES =
|
||||
@@ -721,7 +758,8 @@ AC_CONFIG_FILES([Makefile
|
||||
docs/Makefile
|
||||
docs/common.dox
|
||||
docs/html.dox
|
||||
- docs/man.dox])
|
||||
+ docs/man.dox
|
||||
+ lib/qblog_script.la:lib/qblog_script.la.in])
|
||||
|
||||
noinst_PROGRAMS = mapnotify simplelog tcpclient tcpserver ipcclient ipcserver
|
||||
AC_OUTPUT
|
||||
|
||||
+if NEED_GCC_ATTRIBUTE_SECTION_WORKAROUND
|
||||
+AM_LDFLAGS = $(top_builddir)/lib/qblog_script.ld
|
||||
+endif
|
||||
+
|
||||
mapnotify_SOURCES = mapnotify.c $(top_builddir)/include/qb/qbmap.h
|
||||
mapnotify_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
mapnotify_LDADD = $(top_builddir)/lib/libqb.la
|
||||
diff --git a/include/qb/Makefile.am b/include/qb/Makefile.am
|
||||
index 41d7e23..d09cca7 100644
|
||||
--- a/include/qb/Makefile.am
|
||||
+++ b/include/qb/Makefile.am
|
||||
@@ -18,7 +18,8 @@
|
||||
# along with libqb. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
-MAINTAINERCLEANFILES = Makefile.in
|
||||
+MAINTAINERCLEANFILES = Makefile.in
|
||||
+CLEANFILES = qblog.t
|
||||
instdir = $(includedir)/qb/
|
||||
inst_HEADERS = qbhdb.h qblist.h qbdefs.h qbatomic.h \
|
||||
qbloop.h qbrb.h qbutil.h qbarray.h \
|
||||
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
||||
index 0bebeb5..f85ba76 100644
|
||||
index 0bebeb5..b995034 100644
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -20,6 +20,7 @@
|
||||
@@ -19,6 +19,7 @@
|
||||
# along with libqb. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
+CLEANFILES = qblog_script.ld
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
noinst_HEADERS = ipc_int.h util_int.h ringbuffer_int.h loop_int.h \
|
||||
log_int.h map_int.h rpl_sem.h loop_poll_int.h \
|
||||
@@ -39,11 +40,15 @@ source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \
|
||||
@@ -39,9 +40,46 @@ source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \
|
||||
log_syslog.c log_dcs.c log_format.c \
|
||||
map.c skiplist.c hashtable.c trie.c
|
||||
|
||||
+BUILT_SOURCES = $(top_builddir)/lib/qblog_script.ld
|
||||
+# Following two files related to linkage using classic ld from binutils 2.29+
|
||||
+# with which we cannot afford to lose public access to section boundary symbols
|
||||
+# (as the mentioned version started to scope them privately by default, see
|
||||
+# the comment within the first of the files, ultimately leading to broken
|
||||
+# logging functionality of libqb) deserve a bit of explanation:
|
||||
+# * qblog_script.ld
|
||||
+# - linker script that instructs the output section that those symbols should
|
||||
+# be visible, i.e. supports the same behaviour regardless of ld version
|
||||
+# - serves two purposes:
|
||||
+# . local: libqb itself and its "private" (cf. examples) users need those
|
||||
+# symbols visible, which is achieved with a help of the other file
|
||||
+# . system-wide: whenever the non-private library users link against libqb
|
||||
+# (it's development files), this linker script with
|
||||
+# prepended INPUT command so as to refer to the actual
|
||||
+# libqb library (it's numbered alias that is eventually
|
||||
+# resolved to proper shared library) is masked as libqb.so,
|
||||
+# this arrangement achieves the libqb's user will have
|
||||
+# the discussed symbols visible alike
|
||||
+# * qblog_script.la
|
||||
+# - as mentioned earlier, this indirectly hooks into libtool machinery, with
|
||||
+# the only true intention of injecting "-Wl,<path to qblog_script.ld>"
|
||||
+# into "inherited_linker_flags" libtool archive variable, from where it's
|
||||
+# subsequently spread into the build process of all the internal library
|
||||
+# users, assuming they have their dep arranged as "user_LIBADD=libqb.la"
|
||||
+# (this also alleviates the burden on getting things right if, e.g., any
|
||||
+# libqb user consumes it directly like this from its own sub-checkout tree)
|
||||
+# - it indirectly, once libtool prechew the original link command
|
||||
+# originally referring to this file, it turns such reference into the
|
||||
+# "real" library reference (here combining libdir and old_library
|
||||
+# variables within the file), also ensures libqb itself will visibly
|
||||
+# expose the discussed symbols, because such references point again to
|
||||
+# the (not enriched) linker script file that will get interpreted just
|
||||
+# like that during the last build step of the library
|
||||
+EXTRA_libqb_la_DEPENDENCIES = qblog_script.ld qblog_script.la
|
||||
+EXTRA_DIST = qblog_script.ld.in qblog_script.la.in
|
||||
+
|
||||
libqb_la_SOURCES = $(source_to_lint) unix.c
|
||||
libqb_la_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS) $(socket_LIBS)
|
||||
+libqb_la_LIBADD += qblog_script.la
|
||||
|
||||
AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=)
|
||||
+if NEED_GCC_ATTRIBUTE_SECTION_WORKAROUND
|
||||
+AM_LDFLAGS += $(top_builddir)/lib/qblog_script.ld
|
||||
+endif
|
||||
|
||||
if HAVE_SEM_TIMEDWAIT
|
||||
else
|
||||
@@ -60,6 +65,29 @@ else
|
||||
@@ -60,6 +98,30 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
+%.ld: %.ld.in
|
||||
+qblog_script.ld: %.ld: %.ld.in
|
||||
+ $(CPP) -xc -I$(top_srcdir)/include -C -P $< \
|
||||
+ | sed -n "/$$(sed -n '/^[^#]/{s/[*\/]/\\\0/g;p;q}' $<)/{:r;p;n;br}" \
|
||||
+ > $@
|
||||
@ -204,9 +230,10 @@ index 0bebeb5..f85ba76 100644
|
||||
+# find the libqb.so symlink's target, if so, try to find out, iteratively,
|
||||
+# its gradually shorter forms that likewise symlinks the same target as the
|
||||
+# original libqb.so path, point to that file from the linker script using
|
||||
+# qblog_script.ld as a template, and stored in place of original libqb.so
|
||||
+# qblog_script.ld as a template, storing result in place of original libqb.so
|
||||
+# (e.g., libqb.so := "INPUT(libqb.so.0) " [...] "SECTIONS { " [...] "}")
|
||||
+# NOTE: readlink nor realpath are POSIX; not chained links ready
|
||||
+install-exec-hook: $(top_builddir)/lib/qblog_script.ld
|
||||
+install-exec-hook: qblog_script.ld
|
||||
+ target=$$(ls -l "$(DESTDIR)$(libdir)/libqb.so" || :); \
|
||||
+ target=$${target#* -> }; t1_bn=$$(basename "$${target}" || :); \
|
||||
+ while test -n "$${t1_bn}"; do t2_bn=$${t1_bn%.*[0-9]*}; \
|
||||
@ -223,14 +250,14 @@ index 0bebeb5..f85ba76 100644
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libqb.pc
|
||||
diff --git a/lib/log.c b/lib/log.c
|
||||
index bfd218f..3cb703b 100644
|
||||
index bfd218f..4ed432f 100644
|
||||
--- a/lib/log.c
|
||||
+++ b/lib/log.c
|
||||
@@ -40,6 +40,13 @@
|
||||
#include "util_int.h"
|
||||
#include <regex.h>
|
||||
|
||||
+#ifdef QB_NEED_ATTRIBUTE_SECTION_WORKAROUND
|
||||
+#if defined(QB_NEED_ATTRIBUTE_SECTION_WORKAROUND) && !defined(S_SPLINT_S)
|
||||
+/* following only needed to force these symbols be global
|
||||
+ with ld 2.29: https://bugzilla.redhat.com/1477354 */
|
||||
+struct qb_log_callsite __attribute__((weak)) QB_ATTR_SECTION_START[] = { 0 };
|
||||
@ -240,6 +267,27 @@ index bfd218f..3cb703b 100644
|
||||
static struct qb_log_target conf[QB_LOG_TARGET_MAX];
|
||||
static uint32_t conf_active_max = 0;
|
||||
static int32_t in_logger = QB_FALSE;
|
||||
diff --git a/lib/qblog_script.la.in b/lib/qblog_script.la.in
|
||||
new file mode 100644
|
||||
index 0000000..b475835
|
||||
--- /dev/null
|
||||
+++ b/lib/qblog_script.la.in
|
||||
@@ -0,0 +1,15 @@
|
||||
+# Generated by libtool
|
||||
+# NOTE: above line is just to pass func_ltwrapper_script_p sanity check of
|
||||
+# libtool script, as we are basically sort of abusing it so as to inject
|
||||
+# our custom linker script to "private" (cf. examples) users of libqb.la
|
||||
+
|
||||
+# shall rather carry a location of old_library (possibly libdir or something
|
||||
+# else, but installed=no needed to suppress 'library moved' warning then) as
|
||||
+# it's together (with libtool implied prefix otherwise) used for linking libqb
|
||||
+libdir=@abs_builddir@
|
||||
+
|
||||
+# avoids issues with library_names (spurious rpath emitting, relink-on-install)
|
||||
+old_library=qblog_script.ld
|
||||
+
|
||||
+# subject of our injection into libqb.la impacting build time for private users
|
||||
+inherited_linker_flags=-Wl,@abs_builddir@/qblog_script.ld
|
||||
diff --git a/lib/qblog_script.ld.in b/lib/qblog_script.ld.in
|
||||
new file mode 100644
|
||||
index 0000000..2d430ab
|
||||
@ -261,20 +309,6 @@ index 0000000..2d430ab
|
||||
+ QB_ATTR_SECTION_STOP = .;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index fe54741..44401cd 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -21,6 +21,9 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||
EXTRA_DIST =
|
||||
CLEANFILES =
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
+if NEED_GCC_ATTRIBUTE_SECTION_WORKAROUND
|
||||
+AM_LDFLAGS = $(top_builddir)/lib/qblog_script.ld
|
||||
+endif
|
||||
|
||||
noinst_PROGRAMS = bmc bmcpt bms rbreader rbwriter \
|
||||
bench-log format_compare_speed loop print_ver
|
||||
--
|
||||
2.14.0
|
||||
2.14.1
|
||||
|
18
libqb.spec
18
libqb.spec
@ -1,9 +1,8 @@
|
||||
%bcond_without check
|
||||
%bcond_without syslog_tests
|
||||
|
||||
Name: libqb
|
||||
Version: 1.0.2
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Summary: An IPC library for high performance servers
|
||||
|
||||
Group: System Environment/Libraries
|
||||
@ -11,7 +10,7 @@ License: LGPLv2+
|
||||
URL: https://github.com/ClusterLabs/libqb
|
||||
Source0: https://github.com/ClusterLabs/libqb/releases/download/v%{version}/%{name}-%{version}.tar.xz
|
||||
Patch0: 0001-build-configure-run-attribute-section-test-through-r.patch
|
||||
Patch1: 0002-WIP-2-Experimental-fix-for-libqb-logging-not-working.patch
|
||||
Patch1: 0002-WIP-4-Experimental-fix-for-libqb-logging-not-working.patch
|
||||
|
||||
BuildRequires: autoconf automake libtool doxygen procps check-devel
|
||||
# https://fedoraproject.org/wiki/Packaging:C_and_C%2B%2B#BuildRequires_and_Requires
|
||||
@ -32,9 +31,8 @@ and polling.
|
||||
|
||||
%build
|
||||
./autogen.sh
|
||||
%configure --disable-static \
|
||||
%{?with_syslog_tests:--enable-syslog-tests}
|
||||
make %{?_smp_mflags}
|
||||
%configure --disable-static
|
||||
make %{?_smp_mflags} V=1
|
||||
|
||||
%if 0%{?with_check}
|
||||
%check
|
||||
@ -74,6 +72,14 @@ developing applications that use %{name}.
|
||||
%{_mandir}/man3/qb*3*
|
||||
|
||||
%changelog
|
||||
* Fri Sep 01 2017 Jan Pokorný <jpokorny+rpm-libqb@redhat.com> - 1.0.2-6
|
||||
- Better approach so as to mitigate changed treatment of orphaned sections
|
||||
in ld.bfd/binutils-2.29, resulting in logging facility silently out of order
|
||||
(rhbz#1478089)
|
||||
- Related to that, build commands now shown in full to ease the sanity checking
|
||||
- Adapt spec file per the upstream version (conditionalizing build through
|
||||
--enable-syslog-tests no longer relevant since v1.0.2)
|
||||
|
||||
* Fri Aug 11 2017 Kalev Lember <klember@redhat.com> - 1.0.2-5
|
||||
- Bump and rebuild for an rpm signing issue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user