From fe75777481ec7ccc602d016ea1ffa4a26753df94 Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Sun, 19 Jul 2020 09:03:05 +0000 Subject: [PATCH] libxml2 has an internal mechanism to use strong aliases to make internal calls to public interfaces of the library get resolved directly, rather than go through the plt, when libxml is build as a shared library. This is similar to what is done in libc and a few other libraries. This logic is made conditional and currently only enabled under linux when building with a compiler advertizing itself as gcc >= 3.3.. By enabling it on OpenBSD, the number of relocations in libxml2.so.16.1 (as computed from objdump -R /usr/local/lib/libxml2.so.16.1 | wc -l) decreases from 4350 (4357 lines of output) to 3484 (3491 lines of output). from Miod, thanks++ survived a bulk runtime tested with a full blown GNOME Desktop, Libreoffice, Chromium... ok jasper@ --- textproc/libxml/Makefile | 4 ++-- textproc/libxml/patches/patch-elfgcchack_h | 17 +++++++++++++++++ textproc/libxml/patches/patch-libxml_h | 17 +++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 textproc/libxml/patches/patch-elfgcchack_h create mode 100644 textproc/libxml/patches/patch-libxml_h diff --git a/textproc/libxml/Makefile b/textproc/libxml/Makefile index 2221b69af3a..84324f447ac 100644 --- a/textproc/libxml/Makefile +++ b/textproc/libxml/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.183 2020/07/03 21:13:13 sthen Exp $ +# $OpenBSD: Makefile,v 1.184 2020/07/19 09:03:05 ajacoutot Exp $ COMMENT-main= XML parsing library COMMENT-python= Python bindings for libxml VERSION= 2.9.10 -REVISION-main= 1 +REVISION-main= 2 REVISION-python= 3 DISTNAME= libxml2-${VERSION} PKGNAME-main= libxml-${VERSION} diff --git a/textproc/libxml/patches/patch-elfgcchack_h b/textproc/libxml/patches/patch-elfgcchack_h new file mode 100644 index 00000000000..97595c8956d --- /dev/null +++ b/textproc/libxml/patches/patch-elfgcchack_h @@ -0,0 +1,17 @@ +$OpenBSD: patch-elfgcchack_h,v 1.1 2020/07/19 09:03:05 ajacoutot Exp $ + +Enable internal symbol aliases in order to not perform internal calls to +public interfaces through the plt within libxml.so. + +Index: elfgcchack.h +--- elfgcchack.h.orig ++++ elfgcchack.h +@@ -11,7 +11,7 @@ + #ifdef IN_LIBXML + #ifdef __GNUC__ + #ifdef PIC +-#ifdef __linux__ ++#if defined(__linux__) || defined(__OpenBSD__) + #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) + + #include "libxml/c14n.h" diff --git a/textproc/libxml/patches/patch-libxml_h b/textproc/libxml/patches/patch-libxml_h new file mode 100644 index 00000000000..da39cc14214 --- /dev/null +++ b/textproc/libxml/patches/patch-libxml_h @@ -0,0 +1,17 @@ +$OpenBSD: patch-libxml_h,v 1.1 2020/07/19 09:03:05 ajacoutot Exp $ + +Enable internal symbol aliases in order to not perform internal calls to +public interfaces through the plt within libxml.so. + +Index: libxml.h +--- libxml.h.orig ++++ libxml.h +@@ -120,7 +120,7 @@ int xmlInputReadCallbackNop(void *context, char *buffe + #ifdef IN_LIBXML + #ifdef __GNUC__ + #ifdef PIC +-#ifdef __linux__ ++#if defined(__linux__) || defined(__OpenBSD__) + #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) + #include "elfgcchack.h" + #endif