MiniLibC is a minimalistic C-runtime library built from scratch in x86-64 NASM assembly. It allows you to replace—or override—standard libc functions via dynamic linking (LD_PRELOAD), offering insights into low-level implementations and performance characteristics.
- Educational: Deepen understanding of common libc routines by reimplementing them in assembly.
- Portable: Produce a standalone dynamic ELF library (
libasm.so) compatible with x86-64 Linux. - Lightweight: Focus on clarity and minimal dependencies, avoiding any external C runtime requirements.
strlenstrchrstrrchrmemsetmemcpystrcmpmemmovestrncmpstrcasecmpstrstrstrpbrkstrcspn
All the library handle in 32 bitsindex/rindex
Feel free to extend with your own additional routines (e.g., strtok, printf), architectures (ARM, RISC-V), or other creative enhancements.
-
Clone the repository
git clone https://github.com/yourusername/minilibc.git cd minilibc -
Build
make # Assemble all .asm files and link into libasm.so make re # Rebuild from scratch (clean + build) make clean # Remove object files and temporary artifacts make fclean # Remove everything including libasm.so
-
Test / Run Use
LD_PRELOADto override libc functions:LD_PRELOAD=$(pwd)/libasm.so ./your_program
Contributions, issues, and feature requests are welcome!
- Fork the repository.
- Create your feature branch (
git checkout -b feature/foo). - Commit your changes (
git commit -am 'Add foo feature'). - Push to the branch (
git push origin feature/foo). - Open a Pull Request.
Please stick to NASM syntax for new assembly routines and include tests where applicable.
This project is licensed under the MIT License. See the LICENSE file for details.