Bartleby 0.1.0
A symbol renaming toolkit
Loading...
Searching...
No Matches
Bartleby

Introduction

Bartleby is a library and tool designed to help developers avoid symbol name collisions across object files and static libraries.

Name collisions can occur at link time when several objects or static libraries define the same symbol names.

Based on LLVM, Bartleby aims to provide an efficient and easy-to-use solution to this problem by filtering and renaming symbols across a given set of libraries.

$ clang -r -o lib.o 1.o 2.o
usr/bin/ld: 2.o: in function `SSL_CTX_new':
2.c:(.text+0x0): multiple definition of `SSL_CTX_new'; 1.o:1.c:(.text+0x0): first defined here

Example of an output from clang when pre-linking two objects together that both define the SSL_CTX_new symbol.

Getting Started

Bartleby can be compiled using Bazel or CMake.

See also
Building from source
Bazel integration

Why not using objcopy?

objcopy is a great tool for manipulating object files and libraries. Through its --prefix-symbols options, it already offers a way to rename all the symbols defined in a target by prefixing their name.

However, this solution doesn't work well: --prefix-symbols also applies to symbols pointing to external (i.e. undefined) functions, such as the ones from the libc.

See also
Why not objcopy?

Command Guide

See also
Bartleby Command Guide

References