-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP 5: Experimental fix for libqb logging not working with ld.bfd 2.29
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?) * 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 longer need to worry to use a new flag for compilation with the affected ld version, as semantically the same is already contained in libqb.so itself (it's now a linker script instead of a common 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). 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 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) Deficiencies that are not solvable as long as we use the linker script to participate in restoring boundary section symbols being global again: - /usr/bin/ld: warning: ../lib/qblog_script.ld contains output sections; did you forget -T? 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ý <[email protected]>
- Loading branch information
Showing
6 changed files
with
159 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <qb/qblog.h> | ||
/* GNU ld script | ||
This atypical arrangement enforces global visibility of boundary symbols | ||
(QB_ATTR_SECTION_START, QB_ATTR_SECTION_STOP) for the custom section | ||
QB_ATTR_SECTION used for compile-time offloading of the logging call sites | ||
tracking. While libqb relies on these being global, default linker from | ||
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 | ||
} |