1.0.2-3 - Rebuilt + (temporary) fix logging silently out of order
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild - Mitigate changed treatment of orphaned sections in ld.bfd/binutils-2.29, resulting in logging facility silently out of order (rhbz#1478089) Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
parent
d0b57594c4
commit
25f04d7bbe
164
WIP-Experimental-fix-for-libqb-logging-not-working-w.patch
Normal file
164
WIP-Experimental-fix-for-libqb-logging-not-working-w.patch
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
From 223ed8251dc088bccfc11390f7c7f14d37a132a1 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] WIP: 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
|
||||||
|
|
||||||
|
What's missing:
|
||||||
|
* cross-testing programs vs. libqb prior/after this fix with ld.bfd 2.29
|
||||||
|
* program vs. library sanity attestation for good measure
|
||||||
|
- code header-included in the program could/shall run-time one-off
|
||||||
|
self-test the library code actually logs anything via custom callback
|
||||||
|
log handler
|
||||||
|
- library could/shall attest in qb_log_init that QB_ATTR_SECTION_START
|
||||||
|
+ STOP symbols belong to other address space than its own (dladdr?)
|
||||||
|
|
||||||
|
References:
|
||||||
|
http://oss.clusterlabs.org/pipermail/developers/2017-July/000503.html
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1477354#c8
|
||||||
|
|
||||||
|
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
|
||||||
|
---
|
||||||
|
configure.ac | 2 ++
|
||||||
|
examples/Makefile.am | 4 ++++
|
||||||
|
include/qb/Makefile.am | 10 +++++++++-
|
||||||
|
include/qb/qblog.t.in | 10 ++++++++++
|
||||||
|
lib/Makefile.am | 3 +++
|
||||||
|
lib/libqb.pc.in | 2 +-
|
||||||
|
lib/log.c | 7 +++++++
|
||||||
|
tests/Makefile.am | 3 +++
|
||||||
|
8 files changed, 39 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 include/qb/qblog.t.in
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index ff7133e83..e60bd74d8 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -612,8 +612,10 @@ if test "x${GCC}" = xyes; then
|
||||||
|
AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1,
|
||||||
|
[Enabling code using __attribute__((section))])
|
||||||
|
PACKAGE_FEATURES="$PACKAGE_FEATURES attribute-section"
|
||||||
|
+ AC_SUBST([PC_QBLOG_LINKER_SCRIPT], [-Wl,${includedir}/qb/qblog.t])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
+AM_CONDITIONAL(HAVE_GCC_ATTRIBUTE_SECTION, [test "x${gcc_has_attribute_section}" = xyes])
|
||||||
|
|
||||||
|
# --- ansi ---
|
||||||
|
if test "x${enable_ansi}" = xyes && \
|
||||||
|
diff --git a/examples/Makefile.am b/examples/Makefile.am
|
||||||
|
index 3637d3063..9100073ca 100644
|
||||||
|
--- a/examples/Makefile.am
|
||||||
|
+++ b/examples/Makefile.am
|
||||||
|
@@ -23,6 +23,10 @@ CLEANFILES =
|
||||||
|
|
||||||
|
noinst_PROGRAMS = mapnotify simplelog tcpclient tcpserver ipcclient ipcserver
|
||||||
|
|
||||||
|
+if HAVE_GCC_ATTRIBUTE_SECTION
|
||||||
|
+AM_LDFLAGS = $(top_builddir)/include/qb/qblog.t
|
||||||
|
+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 41d7e2319..cd17aea0c 100644
|
||||||
|
--- a/include/qb/Makefile.am
|
||||||
|
+++ b/include/qb/Makefile.am
|
||||||
|
@@ -18,9 +18,17 @@
|
||||||
|
# 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 \
|
||||||
|
qbipcc.h qbipcs.h qbipc_common.h qblog.h \
|
||||||
|
qbconfig.h qbmap.h
|
||||||
|
+if HAVE_GCC_ATTRIBUTE_SECTION
|
||||||
|
+inst_HEADERS += qblog.t
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+qblog.t: %: %.in
|
||||||
|
+ $(CPP) -xc -I$(top_srcdir)/include -P $< \
|
||||||
|
+ | sed -n "/$$(sed -n '/^[^#]/{p;q}' $<)/{:r;p;n;br}" > $@
|
||||||
|
diff --git a/include/qb/qblog.t.in b/include/qb/qblog.t.in
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..e065995e8
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/include/qb/qblog.t.in
|
||||||
|
@@ -0,0 +1,10 @@
|
||||||
|
+#include <qb/qblog.h>
|
||||||
|
+SECTIONS
|
||||||
|
+{
|
||||||
|
+ QB_ATTR_SECTION :
|
||||||
|
+ {
|
||||||
|
+ QB_ATTR_SECTION_START = .;
|
||||||
|
+ *(QB_ATTR_SECTION);
|
||||||
|
+ QB_ATTR_SECTION_STOP = .;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
||||||
|
index 0bebeb5e7..e29ef38ab 100644
|
||||||
|
--- a/lib/Makefile.am
|
||||||
|
+++ b/lib/Makefile.am
|
||||||
|
@@ -44,6 +44,9 @@ libqb_la_CFLAGS = $(PTHREAD_CFLAGS)
|
||||||
|
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS) $(socket_LIBS)
|
||||||
|
|
||||||
|
AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=)
|
||||||
|
+if HAVE_GCC_ATTRIBUTE_SECTION
|
||||||
|
+AM_LDFLAGS += $(top_builddir)/include/qb/qblog.t
|
||||||
|
+endif
|
||||||
|
|
||||||
|
if HAVE_SEM_TIMEDWAIT
|
||||||
|
else
|
||||||
|
diff --git a/lib/libqb.pc.in b/lib/libqb.pc.in
|
||||||
|
index 8a8d0ba8f..4b3aa1605 100644
|
||||||
|
--- a/lib/libqb.pc.in
|
||||||
|
+++ b/lib/libqb.pc.in
|
||||||
|
@@ -7,5 +7,5 @@ Name: libqb
|
||||||
|
Version: @PACKAGE_VERSION@
|
||||||
|
Description: libqb
|
||||||
|
Requires:
|
||||||
|
-Libs: -L${libdir} -lqb @LIBS@
|
||||||
|
+Libs: @PC_QBLOG_LINKER_SCRIPT@ -L${libdir} -lqb @LIBS@
|
||||||
|
Cflags: -I${includedir}
|
||||||
|
diff --git a/lib/log.c b/lib/log.c
|
||||||
|
index f10321ee7..e534ece90 100644
|
||||||
|
--- a/lib/log.c
|
||||||
|
+++ b/lib/log.c
|
||||||
|
@@ -40,6 +40,13 @@
|
||||||
|
#include "util_int.h"
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
|
+#ifdef QB_HAVE_ATTRIBUTE_SECTION
|
||||||
|
+/* 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 };
|
||||||
|
+struct qb_log_callsite __attribute__((weak)) QB_ATTR_SECTION_STOP[] = { 0 };
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
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/tests/Makefile.am b/tests/Makefile.am
|
||||||
|
index fe5474116..d38599c44 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 HAVE_GCC_ATTRIBUTE_SECTION
|
||||||
|
+AM_LDFLAGS = $(top_builddir)/include/qb/qblog.t
|
||||||
|
+endif
|
||||||
|
|
||||||
|
noinst_PROGRAMS = bmc bmcpt bms rbreader rbwriter \
|
||||||
|
bench-log format_compare_speed loop print_ver
|
||||||
|
--
|
||||||
|
2.13.3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user