Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/santerijps/small-c-executables
Tutorial: How to generate small C executables
https://github.com/santerijps/small-c-executables
Last synced: 2 days ago
JSON representation
Tutorial: How to generate small C executables
- Host: GitHub
- URL: https://github.com/santerijps/small-c-executables
- Owner: santerijps
- Created: 2023-09-09T16:41:25.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-09T12:34:47.000Z (about 1 year ago)
- Last Synced: 2023-10-10T12:44:35.586Z (about 1 year ago)
- Language: C
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tutorial: Small C Executables
1. Provide optimizing flags to your C compiler
2. Use a nexecutable compressor (`UPX` used in these examples)or if possible, use `TCC`.
## Cross platform compilation
```shell
gcc -Os -s -fno-ident -fno-asynchronous-unwind-tables -o out.exe hello_crossplatform.c
upx --best --lzma --ultra-brute -f --compress-icons=3 --8-bit --no-reloc --no-align -q -o out.compressed.exe out.exe
```### With `TCC`
```shell
tcc -o out.exe hello_crossplatform.c
```## Native compilation (Windows)
```shell
gcc -Os -s -fno-ident -fno-asynchronous-unwind-tables -nostdlib -o out.exe C:\Windows\System32\kernel32.dll hello_native.c
```