1.0.2-14 - Evolution of the previous (rhbz#1478089)

- Make -devel package dependency on the main package arch-qualified

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
This commit is contained in:
Jan Pokorný 2017-11-15 18:16:31 +01:00
parent 18a84f6e3e
commit 1799fc0be2
No known key found for this signature in database
GPG Key ID: 61BBB23A9E8F8DE2
8 changed files with 222 additions and 149 deletions

View File

@ -116,5 +116,5 @@ index 3cb4eef..4954932 100644
#else #else
#define QB_LOG_INIT_DATA(name) #define QB_LOG_INIT_DATA(name)
-- --
2.14.3 2.15.0

View File

@ -0,0 +1,80 @@
From 9fadd438cbbabcde8fe3e19644bacc044279ebdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 2/6] build: configure: check section boundary symbols present
in the test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There was an idea to make apparently run-time test set to that effect,
but it would make cross-building harder. So arrange the test as if it
would be meant for AC_TRY_RUN, but achieve the same as with the first
assertion by the means of inspecting the linked result with, possibly
target-specific, nm utility.
While arranging the test for AC_TRY_RUN, based on feedback by Ferenc
Wágner, unify and increase usability of the run-time error signalling
through assertions.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
configure.ac | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 22630ba..29bd569 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,7 @@ AC_CHECK_PROGS([DOXYGEN], [doxygen])
AM_CONDITIONAL(HAVE_DOXYGEN, test -n "${DOXYGEN}")
AC_CHECK_PROGS([SPLINT], [splint])
AM_CONDITIONAL(HAVE_SPLINT, test -n "${SPLINT}")
+AC_CHECK_TOOLS([NM], [eu-nm nm], [:])
## local helper functions
@@ -620,15 +621,31 @@ AC_SUBST(HAVE_SLOW_TESTS)
if test "x${GCC}" = xyes; then
AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections])
if test "x${ac_cv_link_attribute_section}" = x ; then
- AC_TRY_LINK([#include <assert.h>
- extern void * __start___verbose, * __stop___verbose;],
- [static int my_var __attribute__((section("__verbose"))) = 5;
- if (__start___verbose == __stop___verbose) assert(0);
- if (my_var == 5) return 0;
- else return -1;
- ],
- [gcc_has_attribute_section=yes],
- [gcc_has_attribute_section=no])
+ dnl could be turned to AC_TRY_RUN (first assertion is equivalent to
+ dnl the further check in action-if-true), but that would prevent
+ dnl cross-building
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <assert.h>
+ extern void * __start___verbose, * __stop___verbose;]],
+ [[static int my_var __attribute__((section("__verbose"))) = 5;
+ assert("non-empty data section"
+ && __start___verbose != __stop___verbose);
+ assert("no data section value loss"
+ && my_var == 5);]]
+ )],
+ [# alternatively something like (but requires number parsing):
+ # readelf -SW "conftest${ac_exeext}" \
+ # | sed -n '/__verbose/s/^\s*//p' | tr -s ' ' | cut -d" " -f6
+ verbose_start_addr=$(${NM} -g --portability -- "conftest${ac_exeext}" \
+ | grep __start___verbose | cut -d" " -f 3)
+ verbose_stop_addr=$(${NM} -g --portability -- "conftest${ac_exeext}" \
+ | grep __stop___verbose | cut -d" " -f 3)
+ test "${verbose_start_addr}" = "${verbose_stop_addr}" \
+ && gcc_has_attribute_section=no \
+ || gcc_has_attribute_section=yes],
+ [gcc_has_attribute_section=no]
+ )
else
gcc_has_attribute_section=${ac_cv_link_attribute_section}
fi
--
2.15.0

View File

@ -1,56 +0,0 @@
From 287ae050e5330202eca59adbb7e87e9d26d69e08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 2/6] build: configure: run attribute section test through
run-time assertion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It's unclear why the apparently run-time test hasn't been set to that
effect, mere compilability was tested so far.
Also, based on feedback by Ferenc Wágner, unify and increase usability
of the run-time error signalling through assertions.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
configure.ac | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 22630ba..478194c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -620,15 +620,19 @@ AC_SUBST(HAVE_SLOW_TESTS)
if test "x${GCC}" = xyes; then
AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections])
if test "x${ac_cv_link_attribute_section}" = x ; then
- AC_TRY_LINK([#include <assert.h>
- extern void * __start___verbose, * __stop___verbose;],
- [static int my_var __attribute__((section("__verbose"))) = 5;
- if (__start___verbose == __stop___verbose) assert(0);
- if (my_var == 5) return 0;
- else return -1;
- ],
- [gcc_has_attribute_section=yes],
- [gcc_has_attribute_section=no])
+ AC_TRY_RUN(
+ AC_LANG_PROGRAM(
+ [[#include <assert.h>
+ extern void * __start___verbose, * __stop___verbose;]],
+ [[static int my_var __attribute__((section("__verbose"))) = 5;
+ assert("non-empty data section"
+ && __start___verbose != __stop___verbose);
+ assert("no data section value loss"
+ && my_var == 5);]]
+ ),
+ [gcc_has_attribute_section=yes],
+ [gcc_has_attribute_section=no]
+ )
else
gcc_has_attribute_section=${ac_cv_link_attribute_section}
fi
--
2.14.3

View File

@ -1,4 +1,4 @@
From d471da4335c1da2501f2c31ffafc18ae884af389 Mon Sep 17 00:00:00 2001 From f400d33a3ce8ca04248a6602441a40b878eadf2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com> From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200 Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 3/6] tests: new sort of tests dubbed "functional", cover Subject: [PATCH 3/6] tests: new sort of tests dubbed "functional", cover
@ -180,7 +180,7 @@ Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
create mode 100755 tests/functional/log_test_mock.sh create mode 100755 tests/functional/log_test_mock.sh
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 478194c..274b49c 100644 index 29bd569..8c588cb 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([lib/ringbuffer.c]) @@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([lib/ringbuffer.c])
@ -192,7 +192,7 @@ index 478194c..274b49c 100644
dnl automake >= 1.11 offers --enable-silent-rules for suppressing the output from dnl automake >= 1.11 offers --enable-silent-rules for suppressing the output from
dnl normal compilation. When a failure occurs, it will then display the full dnl normal compilation. When a failure occurs, it will then display the full
dnl command line dnl command line
@@ -717,6 +717,9 @@ AC_CONFIG_FILES([Makefile @@ -730,6 +730,9 @@ AC_CONFIG_FILES([Makefile
lib/libqb.pc lib/libqb.pc
tools/Makefile tools/Makefile
tests/Makefile tests/Makefile
@ -202,7 +202,7 @@ index 478194c..274b49c 100644
tests/test.conf tests/test.conf
examples/Makefile examples/Makefile
docs/Makefile docs/Makefile
@@ -724,6 +727,8 @@ AC_CONFIG_FILES([Makefile @@ -737,6 +740,8 @@ AC_CONFIG_FILES([Makefile
docs/html.dox docs/html.dox
docs/man.dox]) docs/man.dox])
@ -1067,5 +1067,5 @@ index 0000000..145b9f4
+ "- results stored in '_results/<timestamp>_<input_name>[_<tag>]'" \ + "- results stored in '_results/<timestamp>_<input_name>[_<tag>]'" \
+ || do_proceed "$@" + || do_proceed "$@"
-- --
2.14.3 2.15.0

View File

@ -1,4 +1,4 @@
From 06388b7fdf471438a08740791c21ae658c657bd0 Mon Sep 17 00:00:00 2001 From 260768d94017023771af9e7f1bddcff91883617a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com> From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200 Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 4/6] Med: add extra run-time (client, libqb) checks that Subject: [PATCH 4/6] Med: add extra run-time (client, libqb) checks that
@ -247,10 +247,10 @@ Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
create mode 100755 tests/functional/syslog-stdout.py create mode 100755 tests/functional/syslog-stdout.py
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 027154c..5338352 100644 index 8c588cb..fdcd93c 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -644,6 +644,7 @@ if test "x${GCC}" = xyes; then @@ -655,6 +655,7 @@ if test "x${GCC}" = xyes; then
AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1, AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1,
[Enabling code using __attribute__((section))]) [Enabling code using __attribute__((section))])
PACKAGE_FEATURES="$PACKAGE_FEATURES attribute-section" PACKAGE_FEATURES="$PACKAGE_FEATURES attribute-section"
@ -259,7 +259,7 @@ index 027154c..5338352 100644
fi fi
diff --git a/include/qb/qblog.h b/include/qb/qblog.h diff --git a/include/qb/qblog.h b/include/qb/qblog.h
index aba63a0..e71556c 100644 index 4954932..a9a9ef2 100644
--- a/include/qb/qblog.h --- a/include/qb/qblog.h
+++ b/include/qb/qblog.h +++ b/include/qb/qblog.h
@@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@
@ -627,5 +627,5 @@ index 0000000..64baf4c
+if __name__ == '__main__': +if __name__ == '__main__':
+ main(*argv) + main(*argv)
-- --
2.14.3 2.15.0

View File

@ -1,4 +1,4 @@
From ae68f462c4ee6cadcbdbbd31b4c19e19bdd7aab2 Mon Sep 17 00:00:00 2001 From cd5d104895f018cf90480dc84f09f32f6dcc2b3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com> From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200 Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 5/6] High: bare fix for libqb logging not working with Subject: [PATCH 5/6] High: bare fix for libqb logging not working with
@ -280,24 +280,32 @@ References:
Signed-off-by: Jan Pokorný <jpokorny@redhat.com> Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
--- ---
configure.ac | 147 +++++++++++++++++++++++++++++++++++++++++------ configure.ac | 156 +++++++++++++++++++++++++++++++++++++++++------
include/qb/qblog.h | 32 +++++++++-- include/qb/qblog.h | 32 ++++++++--
lib/Makefile.am | 67 +++++++++++++++++++++ lib/Makefile.am | 79 +++++++++++++++++++++++-
lib/libqb.pc.in | 8 +++ lib/libqb.pc.in | 11 ++++
lib/log.c | 7 +++ lib/log.c | 7 +++
lib/qblog_script.la.in | 15 +++++ lib/qblog_script.la.in | 15 +++++
lib/qblog_script.ld.in | 27 +++++++++ lib/qblog_script.ld.in | 30 +++++++++
lib/qblog_script_noop.ld | 1 + lib/qblog_script_noop.ld | 1 +
8 files changed, 280 insertions(+), 24 deletions(-) 8 files changed, 304 insertions(+), 27 deletions(-)
create mode 100644 lib/qblog_script.la.in create mode 100644 lib/qblog_script.la.in
create mode 100644 lib/qblog_script.ld.in create mode 100644 lib/qblog_script.ld.in
create mode 100644 lib/qblog_script_noop.ld create mode 100644 lib/qblog_script_noop.ld
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 5338352..ac56c4c 100644 index fdcd93c..cc3d3c3 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -503,6 +503,14 @@ AC_ARG_ENABLE([debug], @@ -78,6 +78,7 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test -n "${DOXYGEN}")
AC_CHECK_PROGS([SPLINT], [splint])
AM_CONDITIONAL(HAVE_SPLINT, test -n "${SPLINT}")
AC_CHECK_TOOLS([NM], [eu-nm nm], [:])
+AC_CHECK_TOOLS([READELF], [eu-readelf readelf], [:])
## local helper functions
@@ -502,6 +503,14 @@ AC_ARG_ENABLE([debug],
AC_ARG_ENABLE([coverage], AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],[coverage analysis of the codebase])]) [AS_HELP_STRING([--enable-coverage],[coverage analysis of the codebase])])
@ -312,7 +320,7 @@ index 5338352..ac56c4c 100644
AC_ARG_ENABLE([slow-tests], AC_ARG_ENABLE([slow-tests],
[AS_HELP_STRING([--enable-slow-tests],[build and run slow tests])]) [AS_HELP_STRING([--enable-slow-tests],[build and run slow tests])])
@@ -611,6 +619,19 @@ else @@ -610,6 +619,19 @@ else
COVERAGE_LDFLAGS="" COVERAGE_LDFLAGS=""
fi fi
@ -332,27 +340,17 @@ index 5338352..ac56c4c 100644
if test "x${enable_slow_tests}" = xyes ; then if test "x${enable_slow_tests}" = xyes ; then
AC_DEFINE([HAVE_SLOW_TESTS], 1,[have slow tests]) AC_DEFINE([HAVE_SLOW_TESTS], 1,[have slow tests])
AC_MSG_NOTICE([Enabling Slow tests]) AC_MSG_NOTICE([Enabling Slow tests])
@@ -620,33 +641,121 @@ AC_SUBST(HAVE_SLOW_TESTS) @@ -619,20 +641,60 @@ AC_SUBST(HAVE_SLOW_TESTS)
# --- callsite sections --- # --- callsite sections ---
if test "x${GCC}" = xyes; then if test "x${GCC}" = xyes; then
+ AX_SAVE_FLAGS + AX_SAVE_FLAGS
AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections]) AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections])
if test "x${ac_cv_link_attribute_section}" = x ; then if test "x${ac_cv_link_attribute_section}" = x ; then
- AC_TRY_RUN(
- AC_LANG_PROGRAM(
+ LDFLAGS="${LDFLAGS_save} -shared -fPIC" # we are compiling shared lib + LDFLAGS="${LDFLAGS_save} -shared -fPIC" # we are compiling shared lib
+ AC_LINK_IFELSE( + AC_LINK_IFELSE(
+ [AC_LANG_SOURCE( + [AC_LANG_SOURCE(
[[#include <assert.h> + [[#include <assert.h>
- extern void * __start___verbose, * __stop___verbose;]],
- [[static int my_var __attribute__((section("__verbose"))) = 5;
- assert("non-empty data section"
- && __start___verbose != __stop___verbose);
- assert("no data section value loss"
- && my_var == 5);]]
- ),
- [gcc_has_attribute_section=yes],
+ extern int __start___verbose[], __stop___verbose[]; + extern int __start___verbose[], __stop___verbose[];
+ int test(void) { + int test(void) {
+ static int my_var __attribute__((section("__verbose"))) = 3; + static int my_var __attribute__((section("__verbose"))) = 3;
@ -362,52 +360,74 @@ index 5338352..ac56c4c 100644
+ && my_var == 3 /* for 2.29.1+ */); + && my_var == 3 /* for 2.29.1+ */);
+ return *((int *) __start___verbose); }]] + return *((int *) __start___verbose); }]]
+ )], + )],
+ [gcc_has_attribute_section=yes; cp "conftest${EXEEXT}" "conftest.so"], + [gcc_has_attribute_section=yes; cp "conftest${ac_exeext}" "conftest.so"],
[gcc_has_attribute_section=no] + [gcc_has_attribute_section=no]
) + )
+ AX_RESTORE_FLAGS + AX_RESTORE_FLAGS
else + else
gcc_has_attribute_section=${ac_cv_link_attribute_section} + gcc_has_attribute_section=${ac_cv_link_attribute_section}
fi + fi
- + AC_MSG_RESULT($gcc_has_attribute_section)
AC_MSG_RESULT($gcc_has_attribute_section)
- if test $gcc_has_attribute_section = yes; then
- AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1,
- [Enabling code using __attribute__((section))])
- PACKAGE_FEATURES="$PACKAGE_FEATURES attribute-section"
- AC_SUBST([client_dlopen_LIBS],[$dlopen_LIBS])
+ +
+ # in the failing case (e.g. with ld from binutils 2.29), it's likely the + # in the failing case (e.g. with ld from binutils 2.29), it's likely the
+ # following will fail readily in linkage (hidden symbol `__stop___verbose' + # following will fail readily in linkage (hidden symbol `__stop___verbose'
+ # in conftest is referenced by DSO), but keep the sensible test + # in conftest is referenced by DSO), but keep the sensible test
+ # (in-executable symbol is expected to be propagated into the library, + # (in-executable symbol is expected to be propagated into the library,
+ # and to draw the full circle back to the executable through standard + # and to draw the full circle back to the executable through standard
+ # return value passing; + # return value passing (respectively no-exec probing to spot the issue);
+ # -rpath passed because LD_LIBRARY_PATH exporting is unwieldy here); + # -rpath passed because LD_LIBRARY_PATH exporting is unwieldy here);
+ # moreover, "my_var" == 3 assertion above is necessary so that binutils + # moreover, "my_var" == 3 assertion above (respectively checking if the
+ # 2.29.1+ will not slip other parts of the overall is-workaround-needed + # boundary symbol visibility differs from DEFAULT in readelf output) is
+ # harness, as it restored some (but not all) of the original behaviour, + # necessary so that binutils 2.29.1+ will not slip other parts of the
+ # but the workaround is still provably needed + # overall is-workaround-needed harness, as it restored some (but not
+ # all) of the original behaviour, but the workaround is still provably
+ # needed
+ if test "x${gcc_has_attribute_section}" = xyes; then + if test "x${gcc_has_attribute_section}" = xyes; then
+ AC_MSG_CHECKING([whether linker emits global boundary symbols for orphan sections]) + AC_MSG_CHECKING([whether linker emits global boundary symbols for orphan sections])
+ LIBS="${LIBS} -L. -l:conftest.so -Wl,-rpath=$(pwd)" + LIBS="${LIBS} -L. -l:conftest${shrext_cmds} -Wl,-rpath=$(pwd)"
+ AC_TRY_RUN( dnl could be turned to AC_TRY_RUN (first assertion is equivalent to
+ AC_LANG_PROGRAM( dnl the further check in action-if-true), but that would prevent
+ [[#include <assert.h> dnl cross-building
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <assert.h>
- extern void * __start___verbose, * __stop___verbose;]],
+ extern int __start___verbose[], __stop___verbose[]; + extern int __start___verbose[], __stop___verbose[];
+ int test(void);]], + int test(void);]],
+ [[static int my_var __attribute__((section("__verbose"))) = 5; [[static int my_var __attribute__((section("__verbose"))) = 5;
- assert("non-empty data section"
+ assert("E:non-empty data section" + assert("E:non-empty data section"
+ && __start___verbose != __stop___verbose); && __start___verbose != __stop___verbose);
- assert("no data section value loss"
- && my_var == 5);]]
+ assert("E:no data section value loss" + assert("E:no data section value loss"
+ && my_var == test() /*5?*/);]] + && my_var == test() /*5?*/);]]
+ ), )],
+ [gcc_has_attribute_section_visible=yes], [# alternatively something like (but requires number parsing):
# readelf -SW "conftest${ac_exeext}" \
@@ -642,22 +704,78 @@ if test "x${GCC}" = xyes; then
verbose_stop_addr=$(${NM} -g --portability -- "conftest${ac_exeext}" \
| grep __stop___verbose | cut -d" " -f 3)
test "${verbose_start_addr}" = "${verbose_stop_addr}" \
- && gcc_has_attribute_section=no \
- || gcc_has_attribute_section=yes],
- [gcc_has_attribute_section=no]
+ && gcc_has_attribute_section_visible=no \
+ || { verbose_start_type=$(${READELF} -s backup \
+ | sed -n '/__start___verbose/{s/^\s*//p;q}' \
+ | tr -s ' ' \
+ | cut -d" " -f6)
+ test "${verbose_start_type}" = DEFAULT \
+ && gcc_has_attribute_section_visible=yes \
+ || gcc_has_attribute_section_visible=no; }],
+ [gcc_has_attribute_section_visible=no] + [gcc_has_attribute_section_visible=no]
+ ) )
- else
- gcc_has_attribute_section=${ac_cv_link_attribute_section}
- fi
+ AX_RESTORE_FLAGS + AX_RESTORE_FLAGS
+ AC_MSG_RESULT($gcc_has_attribute_section_visible) + AC_MSG_RESULT($gcc_has_attribute_section_visible)
+ rm -f "conftest.so" + rm -f "conftest${shrext_cmds}"
+ +
+ if test "x${gcc_has_attribute_section_visible}" = xno; then + if test "x${gcc_has_attribute_section_visible}" = xno; then
+ # check if the linker script based workaround is + # check if the linker script based workaround is
@ -444,7 +464,13 @@ index 5338352..ac56c4c 100644
+ AC_MSG_RESULT([$gcc_has_attribute_section]) + AC_MSG_RESULT([$gcc_has_attribute_section])
+ rm -f "conftest.ld" + rm -f "conftest.ld"
+ fi + fi
+
- AC_MSG_RESULT($gcc_has_attribute_section)
- if test $gcc_has_attribute_section = yes; then
- AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1,
- [Enabling code using __attribute__((section))])
- PACKAGE_FEATURES="$PACKAGE_FEATURES attribute-section"
- AC_SUBST([client_dlopen_LIBS],[$dlopen_LIBS])
+ if test "x${gcc_has_attribute_section}" = xyes; then + if test "x${gcc_has_attribute_section}" = xyes; then
+ AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1, + AC_DEFINE([QB_HAVE_ATTRIBUTE_SECTION], 1,
+ [Enabling code using __attribute__((section))]) + [Enabling code using __attribute__((section))])
@ -470,7 +496,7 @@ index 5338352..ac56c4c 100644
# --- ansi --- # --- ansi ---
if test "x${enable_ansi}" = xyes && \ if test "x${enable_ansi}" = xyes && \
@@ -728,9 +837,11 @@ AC_CONFIG_FILES([Makefile @@ -739,9 +857,11 @@ AC_CONFIG_FILES([Makefile
docs/Makefile docs/Makefile
docs/common.dox docs/common.dox
docs/html.dox docs/html.dox
@ -485,7 +511,7 @@ index 5338352..ac56c4c 100644
AC_OUTPUT AC_OUTPUT
diff --git a/include/qb/qblog.h b/include/qb/qblog.h diff --git a/include/qb/qblog.h b/include/qb/qblog.h
index e71556c..e0890a9 100644 index a9a9ef2..00adb3a 100644
--- a/include/qb/qblog.h --- a/include/qb/qblog.h
+++ b/include/qb/qblog.h +++ b/include/qb/qblog.h
@@ -79,7 +79,10 @@ extern "C" { @@ -79,7 +79,10 @@ extern "C" {
@ -552,7 +578,7 @@ index e71556c..e0890a9 100644
assert("non-empty implicit callsite section, otherwise target's \ assert("non-empty implicit callsite section, otherwise target's \
linkage at fault and logging would not work reliably" \ linkage at fault and logging would not work reliably" \
diff --git a/lib/Makefile.am b/lib/Makefile.am diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0bebeb5..ff5b3b4 100644 index 0bebeb5..1572cff 100644
--- a/lib/Makefile.am --- a/lib/Makefile.am
+++ b/lib/Makefile.am +++ b/lib/Makefile.am
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
@ -612,15 +638,23 @@ index 0bebeb5..ff5b3b4 100644
AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=) AM_LDFLAGS = $(LDFLAGS_COPY:-Bsymbolic-functions=)
@@ -60,6 +100,33 @@ else @@ -60,9 +100,42 @@ else
endif endif
endif endif
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libqb.pc
+qblog_script.ld: %.ld: %.ld.in +qblog_script.ld: %.ld: %.ld.in
+ $(AM_V_GEN)$(CPP) -xc -I$(top_srcdir)/include -D_GNU_SOURCE -C -P $< \ + $(AM_V_GEN)$(CPP) -xc -I$(top_srcdir)/include -D_GNU_SOURCE -C -P $< \
+ | sed -n "/$$(sed -n '/^[^#]/{s/[*\/]/\\&/g;p;q;}' $<)/,$$ p" \ + | sed -n "/$$(sed -n '/^[^#]/{s/[*\/]/\\&/g;p;q;}' $<)/,$$ p" \
+ > $@ + > $@
+ +
+# sadly, there's a distinction between "exec" and "data" install, and it's hard
+# to decouple install-exec-hook below (.pc file is platform-dependent, anyway)
+pkgconfigexecdir = $(libdir)/pkgconfig
+pkgconfigexec_DATA = libqb.pc
+
+# find the libqb.so symlink's target, if so, try to find out, iteratively, +# 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 +# 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 +# original libqb.so path, point to that file from the linker script using
@ -639,29 +673,36 @@ index 0bebeb5..ff5b3b4 100644
+ test "$${t2_target}" = "$${target}" || break; \ + test "$${t2_target}" = "$${target}" || break; \
+ t1_bn=$${t2_bn}; done; test -n "$${t1_bn}" || \ + t1_bn=$${t2_bn}; done; test -n "$${t1_bn}" || \
+ { echo "only applicable to SO symlink scheme"; exit 1; }; \ + { echo "only applicable to SO symlink scheme"; exit 1; }; \
+ echo "INPUT($${t1_bn})" > "$(DESTDIR)$(libdir)/libqb.so-t" + echo "$${t1_bn}" > "$(DESTDIR)$(libdir)/libqb.so-t"
+ cat $< >> "$(DESTDIR)$(libdir)/libqb.so-t" + so_ver=$$(cat "$(DESTDIR)$(libdir)/libqb.so-t"); \
+ mv -f "$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(libdir)/libqb.so" + echo "INPUT($${so_ver})" > "$(DESTDIR)$(libdir)/libqb.so-t"; \
+ cat $< >> "$(DESTDIR)$(libdir)/libqb.so-t"; \
+ sed -i -- "s/libqb.so.<digit>/$${so_ver}/" \
+ "$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(pkgconfigexecdir)/libqb.pc"
+ mv -f "$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(libdir)/libqb.so"
+endif +endif
pkgconfigdir = $(libdir)/pkgconfig if HAVE_SPLINT
pkgconfig_DATA = libqb.pc check_SCRIPTS = run_splint.sh
diff --git a/lib/libqb.pc.in b/lib/libqb.pc.in diff --git a/lib/libqb.pc.in b/lib/libqb.pc.in
index 37d27b7..65d3b8e 100644 index 37d27b7..d9839bf 100644
--- a/lib/libqb.pc.in --- a/lib/libqb.pc.in
+++ b/lib/libqb.pc.in +++ b/lib/libqb.pc.in
@@ -8,5 +8,13 @@ Version: @PACKAGE_VERSION@ @@ -8,5 +8,16 @@ Version: @PACKAGE_VERSION@
Description: libqb Description: libqb
Requires: Requires:
Libs: -L${libdir} -lqb @client_dlopen_LIBS@ Libs: -L${libdir} -lqb @client_dlopen_LIBS@
+# NOTE: If -lqb not usable for linking (e.g. linker not compatible with +# NOTE: If -lqb not usable for linking (e.g. linker not compatible with
+# linker scripts ad-hoc modifying output sections), try recent +# linker scripts ad-hoc modifying output sections), try recent
+# ld.bfd/binutils linker first when available, otherwise you can +# ld.bfd/binutils linker first when available, otherwise you can
+# try "-l:libqb.so.<digit>" link switch (right <digit> available, +# try "-l:libqb.so.<digit>" link switch that bypasses said linker
+# for example, directly within libqb.so plaintext) that bypasses +# script -- but beware, logging may be less efficient and may lack
+# said linker script -- but beware, logging problems may ensue. +# possible future optimizations and extra features. Consequently,
+# That can be partially mitigated with QB_KILL_ATTRIBUTE_SECTION +# logging issues (typically bound to QB_LOG_INIT_DATA macro) can be
+# macro defined when compiling, but testing remains a must. +# mitigated with QB_KILL_ATTRIBUTE_SECTION macro defined for a build.
+# NOTE: when concerned about a warning coming from the build process like
+# warning: [...]libqb.so contains output sections; did you forget -T?
+# and the build finishes OK, take it merely as a harmless side-effect
Libs.private: @LIBS@ Libs.private: @LIBS@
Cflags: -I${includedir} Cflags: -I${includedir}
diff --git a/lib/log.c b/lib/log.c diff --git a/lib/log.c b/lib/log.c
@ -705,10 +746,10 @@ index 0000000..f262df8
+inherited_linker_flags=-Wl,@abs_builddir@/qblog_script.ld +inherited_linker_flags=-Wl,@abs_builddir@/qblog_script.ld
diff --git a/lib/qblog_script.ld.in b/lib/qblog_script.ld.in diff --git a/lib/qblog_script.ld.in b/lib/qblog_script.ld.in
new file mode 100644 new file mode 100644
index 0000000..2ee2da0 index 0000000..a188ac2
--- /dev/null --- /dev/null
+++ b/lib/qblog_script.ld.in +++ b/lib/qblog_script.ld.in
@@ -0,0 +1,27 @@ @@ -0,0 +1,30 @@
+#include <qb/qblog.h> +#include <qb/qblog.h>
+/* GNU ld script +/* GNU ld script
+ This atypical arrangement enforces global visibility of boundary symbols + This atypical arrangement enforces global visibility of boundary symbols
@ -721,11 +762,14 @@ index 0000000..2ee2da0
+ NOTE: If -lqb not usable for linking (e.g. linker not compatible with + NOTE: If -lqb not usable for linking (e.g. linker not compatible with
+ linker scripts ad-hoc modifying output sections), try recent + linker scripts ad-hoc modifying output sections), try recent
+ ld.bfd/binutils linker first when available, otherwise you can + ld.bfd/binutils linker first when available, otherwise you can
+ try "-l:libqb.so.<digit>" link switch (right <digit> available, + try "-l:libqb.so.<digit>" link switch that bypasses said linker
+ for example, directly within libqb.so plaintext) that bypasses + script -- but beware, logging may be less efficient and may lack
+ said linker script -- but beware, logging problems may ensue. + possible future optimizations and extra features. Consequently,
+ That can be partially mitigated with QB_KILL_ATTRIBUTE_SECTION + logging issues (typically bound to QB_LOG_INIT_DATA macro) can be
+ macro defined when compiling, but testing remains a must. + mitigated with QB_KILL_ATTRIBUTE_SECTION macro defined for a build.
+ NOTE: When concerned about a warning coming from the build process like
+ warning: [...]libqb.so contains output sections; did you forget -T?
+ while it finishes OK, consider it merely a harmless side-effect.
+ */ + */
+SECTIONS { +SECTIONS {
+#ifdef QB_HAVE_ATTRIBUTE_SECTION +#ifdef QB_HAVE_ATTRIBUTE_SECTION
@ -744,5 +788,5 @@ index 0000000..f037fca
@@ -0,0 +1 @@ @@ -0,0 +1 @@
+/* this is an empty linker script having a role of a NO-OP link object */ +/* this is an empty linker script having a role of a NO-OP link object */
-- --
2.14.3 2.15.0

View File

@ -1,4 +1,4 @@
From 93ebd97659c51527b0dc4b98ba3e0a9070a1dfea Mon Sep 17 00:00:00 2001 From 8ae46f6c7a2e9c518fec635b8f7afb1b1dbc710f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com> From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200 Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 6/6] Low: fix internal object symbol's leak & expose run-time Subject: [PATCH 6/6] Low: fix internal object symbol's leak & expose run-time
@ -56,7 +56,7 @@ index c1852e1..9094dc7 100644
#undef QB_VER_MINOR #undef QB_VER_MINOR
#undef QB_VER_MICRO #undef QB_VER_MICRO
diff --git a/include/qb/qblog.h b/include/qb/qblog.h diff --git a/include/qb/qblog.h b/include/qb/qblog.h
index e0890a9..14f2a33 100644 index 00adb3a..059d633 100644
--- a/include/qb/qblog.h --- a/include/qb/qblog.h
+++ b/include/qb/qblog.h +++ b/include/qb/qblog.h
@@ -299,9 +299,11 @@ extern struct qb_log_callsite QB_ATTR_SECTION_STOP[]; @@ -299,9 +299,11 @@ extern struct qb_log_callsite QB_ATTR_SECTION_STOP[];
@ -97,7 +97,7 @@ index bfce349..b02ce8d 100644
#ifdef __cplusplus #ifdef __cplusplus
} }
diff --git a/lib/Makefile.am b/lib/Makefile.am diff --git a/lib/Makefile.am b/lib/Makefile.am
index ff5b3b4..a428975 100644 index 1572cff..6ca6b15 100644
--- a/lib/Makefile.am --- a/lib/Makefile.am
+++ b/lib/Makefile.am +++ b/lib/Makefile.am
@@ -30,7 +30,7 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include @@ -30,7 +30,7 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
@ -193,5 +193,5 @@ index 19fca2c..98df44c 100644
+[MAIN |debug] ../log_client.c:69:hello +[MAIN |debug] ../log_client.c:69:hello
[libqb|error] log_blackbox.c:196:qb_log_blackbox_print_from_file: [libqb|error] log_blackbox.c:196:qb_log_blackbox_print_from_file:
-- --
2.14.3 2.15.0

View File

@ -2,7 +2,7 @@
Name: libqb Name: libqb
Version: 1.0.2 Version: 1.0.2
Release: 13%{?dist} Release: 14%{?dist}
Summary: An IPC library for high performance servers Summary: An IPC library for high performance servers
Group: System Environment/Libraries Group: System Environment/Libraries
@ -10,7 +10,7 @@ License: LGPLv2+
URL: https://github.com/ClusterLabs/libqb URL: https://github.com/ClusterLabs/libqb
Source0: https://github.com/ClusterLabs/libqb/releases/download/v%{version}/%{name}-%{version}.tar.xz Source0: https://github.com/ClusterLabs/libqb/releases/download/v%{version}/%{name}-%{version}.tar.xz
Patch0: 01-Med-qblog.h-better-explanation-behaviour-of-QB_LOG_I.patch Patch0: 01-Med-qblog.h-better-explanation-behaviour-of-QB_LOG_I.patch
Patch1: 02-build-configure-run-attribute-section-test-through-r.patch Patch1: 02-build-configure-check-section-boundary-symbols-prese.patch
Patch2: 03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch Patch2: 03-tests-new-sort-of-tests-dubbed-functional-cover-link.patch
Patch3: 04-Med-add-extra-run-time-client-libqb-checks-that-logg.patch Patch3: 04-Med-add-extra-run-time-client-libqb-checks-that-logg.patch
Patch4: 05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch Patch4: 05-High-bare-fix-for-libqb-logging-not-working-with-ld..patch
@ -62,7 +62,8 @@ rm -rf $RPM_BUILD_ROOT/%{_docdir}/*
%package devel %package devel
Summary: Development files for %{name} Summary: Development files for %{name}
Group: Development/Libraries Group: Development/Libraries
Requires: %{name} = %{version}-%{release} pkgconfig Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig
%description devel %description devel
The %{name}-devel package contains libraries and header files for The %{name}-devel package contains libraries and header files for
@ -77,6 +78,10 @@ developing applications that use %{name}.
%{_mandir}/man3/qb*3* %{_mandir}/man3/qb*3*
%changelog %changelog
* Wed Nov 15 2017 Jan Pokorný <jpokorny+rpm-libqb@redhat.com> - 1.0.2-14
- Evolution of the previous (rhbz#1478089)
- Make -devel package dependency on the main package arch-qualified
* Tue Oct 31 2017 Jan Pokorný <jpokorny+rpm-libqb@redhat.com> - 1.0.2-13 * Tue Oct 31 2017 Jan Pokorný <jpokorny+rpm-libqb@redhat.com> - 1.0.2-13
- Evolution of the previous (rhbz#1478089) - Evolution of the previous (rhbz#1478089)