This release is a pre-release and may not be stable for production use.
symbolpilot
An interactive, human-in-the-loop object file symbol resolver.
Motivation
Traditional symbol resolvers (e.g., linkers such as ld, lld, or gold) operate as black boxes: they resolve symbols
and dependencies in a fully automatic fashion, either silently resolve or entirely fail on complex symbol situations
such as One Definition Rule (ODR) violations, giving little visibility and virtually no control to developers during the
process.
This tool offers a new, interactive, and transparent approach to symbol resolution and object file dependency analysis. It is designed for human-in-the-loop workflows, where developers can step through symbol closures, explicitly see (and resolve) ambiguities, and gain detailed insight into which object files provide which symbols. All symbol names are handled verbatim, with no demangling or reinterpretation.
This approach is, to our knowledge, novel - no other tool provides this level of programmably accessible, step-wise, and ambiguity-exposing symbol resolution. It fills a gap left by traditional development toolchains, serving as both an educational resource and a practical utility. It is especially useful for:
- Teaching or researching real-world linking and symbol resolution
- Exploring and debugging complex or non-standard builds
- Diagnosing ODR violations and dependency tangling in large or legacy codebases
- Manually assembling symbol closure for small systems or embedded targets
Key Features & Characteristics
- Interactive, human-in-the-loop: The tool is intended for iterative and supervised symbol resolution, not automated, "black-box" full program linking.
- No name demangling: All symbols are handled as is, exactly as reported by
nm; C++ or Fortran mangled names are not demangled at any stage. - Strict ODR handling: If multiple object files provide the same symbol (One Definition Rule violation), the tool cannot resolve the repeated symbol and will treat it as unresolvable.
Usage Example
Suppose you have a directory of object files: lib/*.o, and you want to analyze and resolve symbols in main.o:
from glob import glob
from symbolpilot import construct_o_file_database, resolve_symbols, get_symbols_in_o_file
# Step 1: Build databases and dependency graph
(
o_file_paths_to_symbol_types_to_symbol_names,
symbol_types_to_symbol_names_to_o_file_paths,
) = construct_o_file_database(glob('lib/*.o'), nm_command=('nm',))
# Step 2: Prepare lists of symbols to resolve
# Here, for demonstration, we aggregate all undefined ('U') and defined ('T') symbols found
symbols_in_main_o = get_symbols_in_o_file(
'main.o',
nm_command=('nm',)
)
u_symbols = symbols_in_main_o.get('U', [])
t_symbols = symbols_in_main_o.get('T', [])
# Step 3: Attempt to resolve undefined symbols to object files
resolved, ambiguous, unresolved = resolve_symbols(
u_symbols,
t_symbols,
o_file_paths_to_symbol_types_to_symbol_names,
symbol_types_to_symbol_names_to_o_file_paths
)
print("Resolved symbols and their providing object files:")
for symbol, objfile in resolved.items():
print(f" {symbol} -> {objfile}")
print("Ambiguous symbols and their providing object files:")
for symbol, objfiles in ambiguous.items():
print(f" {symbol} -> {objfiles}")
print("Symbols that could not be resolved:")
for symbol in unresolved:
print(f" {symbol}")
Output Serialization
All outputs produced by this tool are standard Python lists and dicts, making them very easy to serialize and deserialize using JSON. This allows seamless integration with other development tools and scripting environments.
For example, you can save your data structures with:
import json
with open('symbol_index.json', 'w') as f:
json.dump(o_file_paths_to_symbol_types_to_symbol_names, f, indent=2)
with open('inverse_symbol_index.json', 'w') as f:
json.dump(symbol_types_to_symbol_names_to_o_file_paths, f, indent=2)
And restore them in another session with:
import json
with open('symbol_index.json', 'r') as f:
o_file_paths_to_symbol_types_to_symbol_names = json.load(f)
with open('inverse_symbol_index.json', 'r') as f:
symbol_types_to_symbol_names_to_o_file_paths = json.load(f)
This makes it simple to:
- Export and share symbol databases and dependency graphs,
- Store analysis results,
- Pipe data between tools,
- Or use your own post-processing scripts.
No custom classes or obscure data structures are used, ensuring maximal portability and ease of use with common JSON tools.
Installation
pip install symbolpilot
Requirements
- Unix system with
nmor compatible command
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Release files for symbolpilot 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| symbolpilot-0.1.0a0.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| symbolpilot-0.1.0a0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / symbolpilot-0.1.0a0.tar.gz
| Download URL | symbolpilot-0.1.0a0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b18267b87bcad4f7904e7504692bf8c09cc1f5b0b9f599c38263043e9e00b942
|
|
BLAKE2b-256 checksum How to use checksums |
d415a9505ea47757e585c0c53ce8d8d74665f31cd058005e4fed2b801642b48f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / symbolpilot-0.1.0a0-py2.py3-none-any.whl
| Download URL | symbolpilot-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ad3992596e526dc01bbb7969dc2ff6762b734fd2a93356e8116463edc3d59962
|
|
BLAKE2b-256 checksum How to use checksums |
344d21f18c157eb49dbc5fca142bb3136ac65fe9fb40ab873bbb0c5f3d711822
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|