https://github.com/pfnet/sold
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pfnet/sold
- Owner: pfnet
- License: gpl-3.0
- Created: 2023-06-30T06:57:09.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-27T08:14:27.000Z (about 1 year ago)
- Last Synced: 2025-07-13T13:43:41.156Z (12 months ago)
- Language: C++
- Size: 550 KB
- Stars: 8
- Watchers: 61
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sold
`sold` is a linker software which links a shared objects and its depending
shared objects. For example,
```bash
% ldd libhoge.so
libfuga.so (0x00007fb6550b2000)
% sold -i libhoge.so -o libhoge2.so
% ldd libhoge2.so
%
```
`sold` works only for shared objects not for executables. Sorry.
## Branches
- `master`: I am developing on this branch.
- `stable`: Stable version of master for our internal use.
## Requirements
`sold` works only on Linux on x86-64 and aarch64 architectures.
## How to build
```bash
git clone https://github.com/akawashiro/sold.git
cd sold
mkdir -p build
cd build
cmake ..
make
```
Now you can see the `sold` in `build` directory.
## How to use
```bash
sold -i [INPUT] -o [OUTPUT]
```
Options
- `--section-headers`: Emit section headers. Output shared objects work without section headers but they are useful for debugging.
- `--check-output`: Check integrity of the output by parsing it again.
- `--exclude-so`: Specify a shared object not to combine.
# Renamer
`renamer` is software to rename symbols in shared objects. You can rename symbols in shared objects like the following.
```
% cat mapping
hoge fugafuga
% renamer libhoge_original.so --output libhoge_renamed.so --rename-mapping-file mapping
```
## Requirements & How to build
Just same as `sold`.
## How to use
```bash
renamer [INPUT] --output [OUTPUT] --rename-mapping-file [MAPPING]
```
All lines in [MAPPING] must be a space separated pair of the old name of a symbol and the new name.
# For developers
Please run "./run-format.sh" before merging to master branch.
## TODO
- Executables
- TLS in executables
- Initial exec and local exec
- x86-32
- Test Fedora linux in CI
## Integration test with practical libraries
### pybind test
The purpose of this test is to check `sold` can preserve the complex ABI.
```bash
git clone https://github.com/akawashiro/sold.git
cd sold
mkdir -p build
cmake -S . -B build -DSOLD_PYBIND_TEST=ON -G Ninja
cmake --build build
ctest --test-dir build
```
## libtorch test
Note: You can generate libtorch using `./build-pytorch.sh`. This script install libtorch to `sold/pytorch-install`.
```
git clone https://github.com/akawashiro/sold.git
cd sold
mkdir -p build
cmake -B build -S . -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch/dir -DSOLD_LIBTORCH_TEST=ON -GNinja
cmake --build build
ctest --test-dir build
```
## pybind + libtorch test
Note: You can generate libtorch using `./build-pytorch.sh`. This script install libtorch to `sold/pytorch-install`.
```
git clone https://github.com/akawashiro/sold.git
cd sold
cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch/dir -DSOLD_LIBTORCH_TEST=ON -DSOLD_PYBIND_TEST=ON -GNinja -B build -S .
cmake --build build
ctest --test-dir build
```
## Test with Docker
```
sudo docker build -f ubuntu18.04.Dockerfile .
sudo docker build -f ubuntu20.04.Dockerfile .
sudo docker build -f ubuntu22.04.Dockerfile .
sudo docker build -f fedora-latest.Dockerfile .
```