MELF: Multivariant Executables for a Heterogeneous World


Dominik Töllner, Leibniz Universität Hannover; Christian Dietrich, Hamburg University of Technology; Illia Ostapyshyn, Florian Rommel, and Daniel Lohmann, Leibniz Universität Hannover


Compilers today provide a plethora of options to optimize and instrument the code for specific processor extensions, safety features and compatibility settings. Application programmers often provide further instrumented variants of their code for similar purposes, controlled again at compiletime by means of preprocessor macros and dead-code elimination. However, the global once-for-all character of compile-time decisions regarding performance-, debugging-, and safety/security-critical features limits their usefulness in heterogeneous execution settings, where available processor features or security requirements may evolve over time or even differ on a per-client level. Our Multivariant ELF (MELF) approach makes it possible to provide multiple per-function compile-time variants within the same binary and flexibly switch between them at run-time, optionally on a per-thread granularity. As MELFs are implemented on binary level (linker, loader), they do not depend on specific language features or compilers and can be easily applied to existing projects. In our case studies with SQLite, memcached, MariaDB and a benchmark for heterogeneous architectures with overlapping ISAs, we show how MELFs can be employed to provide per-client performance isolation of expensive compile time security or debugging features and adapt to extended instruction sets, when they are actually available.

Open Access Media

USENIX is committed to Open Access to the research presented at our events. Papers and proceedings are freely available to everyone once the event begins. Any video, audio, and/or slides that are posted after the event are also free and open to everyone. Support USENIX and our commitment to Open Access.

This content is available to:

@inproceedings {288811,
author = {Dominik T{\"o}llner and Christian Dietrich and Illia Ostapyshyn and Florian Rommel and Daniel Lohmann},
title = {{MELF}: Multivariant Executables for a Heterogeneous World},
booktitle = {2023 USENIX Annual Technical Conference (USENIX ATC 23)},
year = {2023},
isbn = {978-1-939133-35-9},
address = {Boston, MA},
pages = {257--273},
url = {},
publisher = {USENIX Association},
month = jul