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@
This commit is contained in:
ajacoutot 2020-07-19 09:03:05 +00:00
parent 0a1c2cffad
commit fe75777481
3 changed files with 36 additions and 2 deletions

View File

@ -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}

View File

@ -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"

View File

@ -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