Clang "Interface Stubs" Merged For Offering Interface Libraries To ELF Shared Objects
Written by Michael Larabel in LLVM on 18 June 2019 at 02:05 AM EDT. 13 Comments
LLVM --
In addition to Clang-Scan-Deps being merged a few days ago, another new feature for LLVM's Clang is called the Clang Interface Stubs and brings a concept from Windows/macOS over to Linux/ELF systems.

Clang Interface Stubs allows generating stub files/libraries containing the minimal information needed to build against that library. The Clang Interface Stubs can be used for limiting access to a library's internal systems or breaking up build dependencies thanks to the minimal approach.

Back from the RFC mailing a few months ago, the "clang-ifso" tool as it was called at the time explains, "On platforms such as Darwin and Windows, there exist library interface files that appear to the compile-time linker as just another library file but are in-fact only empty listings of symbols to interface functions that were intended for exposure by the library writer. These library interfaces can be used to both limit access to internals of a library at static compile time, and can be used to speedup link time in the case of linking with extremely large dynamic libraries. Aside from providing more controlled API exposure and reduced memory usage in linking, there is also the benefit of having a much smaller distribution size for development SDKs (in the case where you’ve got an SDK with applications that are built and linked on a PC but then deployed to run on a totally different device). Finally, these interface libraries can in many cases be used to break up build dependencies as well if they can be cached or generated quickly in some way prior to building all the different libraries in a build. clang-ifso is a tool that intends to bring the concept of interface libraries to ELF shared objects. We call it ifso as a shorthand for InterFace-Shared-Object: as in, we intend to support ELF by producing a .so that looks just like a regular .so file to the linker but has most of the .text and other contents dropped and has only the intended API interface symbols populated."

Now for the LLVM/Clang 9.0 release due out around September, this initial IFSO / Interface Stubs support is available. It will be interesting to see where this support leads.
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Related LLVM News
Popular News This Week