Skip to content

Instantly share code, notes, and snippets.

@doublec
Created August 28, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doublec/c2e3c0ab05d622de4de9fa389b0f9d78 to your computer and use it in GitHub Desktop.
Save doublec/c2e3c0ab05d622de4de9fa389b0f9d78 to your computer and use it in GitHub Desktop.
Static binaries in ATS using musl-libc
$ cat hello.dats
implement main0() = print!("Hello World\n")
$ patscc -atsccomp "/usr/local/musl/bin/musl-gcc" -static -I$PATSHOME/ccomp/runtime -I$PATSHOME hello.dats
$ ./a.out
Hello World
$ ldd ./a.out
not a dynamic executable
$ strip ./a.out
$ ls -l ./a.out
-rwxr-xr-x 1 user user 18080 Aug 28 18:29 a.out
$ file ./a.out
./a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment