A 42 project: rewriting standard C library functions in 64-bit assembly.
| Arch |
OS |
Format |
Assembler |
| AMD |
macOS |
macho64 |
nasm |
| AMD |
Linux |
elf64 |
nasm |
| ARM |
macOS |
macho64 |
clang/as |
| ARM |
Linux |
elf64 |
clang/as |
The Makefile auto-detects architecture (uname -m) and OS (uname -s).
make # build libasm.a
make bonus # build with bonus functions
make test # build and link test binary
make clean # remove object files
make fclean # remove objects + library + test binary
make re # fclean + all
make test
./tests/test.exe # run all tests
./tests/test.exe ft_strlen # run a single test
| Function |
Description |
ft_strlen |
String length |
ft_strcpy |
String copy |
ft_strcmp |
String compare |
ft_write |
Write syscall with errno handling |
ft_read |
Read syscall with errno handling |
ft_strdup |
String duplicate (calls malloc) |
| Function |
Description |
ft_atoi_base |
String to int in arbitrary base |
ft_list_push_front |
Push node to front of linked list |
ft_list_size |
Count linked list elements |
ft_list_sort |
Sort linked list (bubble sort) |
ft_list_remove_if |
Remove matching nodes from list |
srcs/
├── amd/
│ ├── elf64/ # x86_64 Linux (nasm, Intel syntax)
│ └── macho64/ # x86_64 macOS (nasm, Intel syntax)
└── arm/
├── elf64/ # ARM64 Linux (GNU as)
└── macho64/ # ARM64 macOS (Apple as)