Created
September 8, 2020 16:26
-
-
Save menangen/e19a72b0fd090c551c2ac1c829a71de7 to your computer and use it in GitHub Desktop.
Musl static Hello-World
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SYS=/root/src/musl/musl-1.2.1/build/root | |
| MAIN=main.c | |
| OBJ=hello.c.o | |
| clang -std=c11 -nostdinc -nodefaultlibs --sysroot $SYS -isystem $SYS/include -c $MAIN -o $OBJ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # LLVM linker with mysl lib statically | |
| SYS=/root/src/musl/musl-1.2.1/build/root | |
| EXE=hello-musl-static | |
| OBJ=hello.c.o | |
| ld.lld -s /root/src/musl/musl-1.2.1/build/root/lib/crt1.o $OBJ -nostdlib -static --sysroot $SYS -L $SYS/lib -lc -o $EXE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Musl configure for Slackware Linux: | |
| # CC=/usr/bin/clang ../configure --prefix=root --disable-shared | |
| #include <stdio.h> | |
| int main() { | |
| printf("Hello, musl!! "); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment