1.0.2-7 - Evolution of the previous (rhbz#1478089, rhbz#1487787)

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
Jan Pokorný 2017-09-04 17:55:39 +02:00
parent 9bf5b4b1b8
commit f2f605942d
No known key found for this signature in database
GPG Key ID: 61BBB23A9E8F8DE2

View File

@ -1,7 +1,7 @@
From eb3bde0891b71919e758543c8cf715b74db8411f Mon Sep 17 00:00:00 2001
From 10cd5db8821e4d313ae5245b33061e02ba8d3ff5 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 4: Experimental fix for libqb logging not working with
Subject: [PATCH] WIP 5: Experimental fix for libqb logging not working with
ld.bfd 2.29
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@ -15,6 +15,12 @@ What's missing:
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?)
* related to that, we should really enable attribute((__section__)) for
powerpc platforms, it seems to work well there -- and related to that,
we need to figure out how static and dynamic call sites can live
together -- say what will happen to logging programs compiled with
libqb w/o attribute sections when the underlying libqb is flipped
to the one with them...
Version 2:
Simplify the compilation against libqb for its users that now no
@ -41,7 +47,16 @@ 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):
Version 5:
Overcomes issues when HAVE_GCC_ATTRIBUTE_SECTION is not defined, hence
qblog_script.ld script used to carry unresolved symbolic references as
a consequence: https://bugzilla.redhat.com/show_bug.cgi?id=1487787
Now the script is not used at all in that case, and if accidentally was,
there is an extra guard conditionalizing the content referring to those
values to only the case they are expected to be defined.
Plus some more, missing in retrospect, conditionalizing is added.
Deficiencies of version 5 (some carried over, apparently):
- see What's missing above
- possibly needs and overhaul regarding documentation of the arrangement
(now scattered throughout the files)
@ -56,12 +71,12 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1477354#c8
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
configure.ac | 62 ++++++++++++++++++++++++++++++++++++++++----------
lib/Makefile.am | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 62 +++++++++++++++++++++++++++++++++++++---------
lib/Makefile.am | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++
lib/log.c | 7 ++++++
lib/qblog_script.la.in | 15 ++++++++++++
lib/qblog_script.ld.in | 15 ++++++++++++
6 files changed, 149 insertions(+), 12 deletions(-)
lib/qblog_script.la.in | 15 +++++++++++
lib/qblog_script.ld.in | 17 +++++++++++++
6 files changed, 156 insertions(+), 12 deletions(-)
create mode 100644 lib/qblog_script.la.in
create mode 100644 lib/qblog_script.ld.in
@ -160,7 +175,7 @@ index fd37466..f94af71 100644
AC_OUTPUT
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0bebeb5..b995034 100644
index 0bebeb5..85dd434 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -19,6 +19,7 @@
@ -171,7 +186,7 @@ index 0bebeb5..b995034 100644
MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = ipc_int.h util_int.h ringbuffer_int.h loop_int.h \
@@ -39,9 +40,46 @@ source_to_lint = util.c hdb.c ringbuffer.c ringbuffer_helper.c \
@@ -39,9 +40,48 @@ 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
@ -214,16 +229,18 @@ index 0bebeb5..b995034 100644
libqb_la_SOURCES = $(source_to_lint) unix.c
libqb_la_CFLAGS = $(PTHREAD_CFLAGS)
libqb_la_LIBADD = $(LTLIBOBJS) $(dlopen_LIBS) $(PTHREAD_LIBS) $(socket_LIBS)
+if NEED_GCC_ATTRIBUTE_SECTION_WORKAROUND
+libqb_la_LIBADD += qblog_script.la
+endif
AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=)
@@ -60,6 +98,30 @@ else
@@ -60,6 +100,33 @@ else
endif
endif
+qblog_script.ld: %.ld: %.ld.in
+ $(CPP) -xc -I$(top_srcdir)/include -C -P $< \
+ $(AM_V_GEN)$(CPP) -xc -I$(top_srcdir)/include -C -P $< \
+ | sed -n "/$$(sed -n '/^[^#]/{s/[*\/]/\\\0/g;p;q}' $<)/{:r;p;n;br}" \
+ > $@
+
@ -233,6 +250,8 @@ index 0bebeb5..b995034 100644
+# 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
+# NOTE: conservative check, i.e., not per NEED_GCC_ATTRIBUTE_SECTION_WORKAROUND
+if HAVE_GCC_ATTRIBUTE_SECTION
+install-exec-hook: qblog_script.ld
+ target=$$(ls -l "$(DESTDIR)$(libdir)/libqb.so" || :); \
+ target=$${target#* -> }; t1_bn=$$(basename "$${target}" || :); \
@ -243,9 +262,10 @@ index 0bebeb5..b995034 100644
+ test "$${t2_target}" = "$${target}" || break; \
+ t1_bn=$${t2_bn}; done; test -n "$${t1_bn}" || \
+ { echo "only applicable to SO symlink scheme"; exit 1; }; \
+ echo "INPUT($${t1_bn})" > "$(DESTDIR)$(libdir)/libqb.so-t"; \
+ cat $< >> "$(DESTDIR)$(libdir)/libqb.so-t"; \
+ echo "INPUT($${t1_bn})" > "$(DESTDIR)$(libdir)/libqb.so-t"
+ cat $< >> "$(DESTDIR)$(libdir)/libqb.so-t"
+ mv -f "$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(libdir)/libqb.so"
+endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libqb.pc
@ -290,10 +310,10 @@ index 0000000..b475835
+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
index 0000000..1f37976
--- /dev/null
+++ b/lib/qblog_script.ld.in
@@ -0,0 +1,15 @@
@@ -0,0 +1,17 @@
+#include <qb/qblog.h>
+/* GNU ld script
+ This atypical arrangement enforces global visibility of boundary symbols
@ -303,11 +323,13 @@ index 0000000..2d430ab
+ binutils change the visibility as of version 2.29, making the logging
+ unusable without artificial stimulus: https://bugzilla.redhat.com/1477354 */
+SECTIONS {
+#ifdef QB_HAVE_ATTRIBUTE_SECTION
+ QB_ATTR_SECTION : {
+ QB_ATTR_SECTION_START = .;
+ *(QB_ATTR_SECTION);
+ QB_ATTR_SECTION_STOP = .;
+ }
+#endif
+}
--
2.14.1