[Clr-dev] RFC: Proposal to create a libSuperX11

Arjan van de Ven arjan at linux.intel.com
Sun Jan 6 10:10:09 PST 2019

Problem description:
The client library set for X11 contains a set of small libraries, one for each protocol extension.
Any graphical application will as a result link to a dozen+ small libraries.
Each small library linked has a cost in terms of memory (in addition to the few shared pages) and
startup time. This cost is in the order of 32Kb per library per using application.
When the X11 stack was actively developed, this small split made sense in terms of distributing development
and at that time graphical applications did not tend to use rich toolkits like GTK and Qt. We're now in 2019,
the X11 stack has been mature and stable for quite some time now, and really only gets security fixes and small

Proposed solution:
Create one superset library that consolidates most (if not all) of these small libraries into one
superset .so file that applications will link to.

Addition benefits:
By having one library, we can achieve cross-library Link Time Optimization and the runtime code
will avoid the PLT for calls between these libraries

Compatibility implications:
Compatibility with existing binaries will be retained by making a small stub library for each consolidated
library (example: libSM.so.6) that just pulls in the consolidated library but is otherwise empty

Source/Compile compatibility will be achieved by making the ".so" file (example: libSM.so) a linker script
that will cause the link to happen to the consolidated library. .pc files and all others will just
remain working as expected because of this, as will directly putting the .so filename on the gcc/ld command line.

Additional cost:
Some of the low level X tools (example: xrandr) will now link to a larger library than they would before.
Anything using gtk or Qt or similar toolkits already always pulls in all the small libraries and will not have
this additional cost

If one of the component libraries needs to do an ABI incompatible break (and change SONAME) this model breaks down
unless we figure out how to either stay compatible or do a distro wide flag day.
The maturity of the X11 stack makes this unlikely; it would also cause massive issues in the ecosystem.
Where the X11 stack needed to really change things, they added a 2nd library instead of doing a compat break
(examples, Input and Fonts)

More information about the Dev mailing list