You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMO zig cc should also be tried with both Glibc (dynamic linking) and musl, but without all the os:any/useMalloc/posix stuff, basically same as other options.
For example:
nim c -d:release --opt:size --cc=clang --clang.exe='/home/dian/Projects/NimExperiments/binary-size/zigcc' --clang.linkerexe='/home/dian/Projects/NimExperiments/binary-size/zigcc' --passC:'-flto -target x86_64-linux-gnu' --passL:'-flto -target x86_64-linux-gnu' -o:helooo --gc:arc hello.nim
after sstrip results in a 16KB glibc-linked binary (8KB smaller than the same with GCC), which is really interesting
And yeah, any reason you're not testing with -d:danger as well?
ghost
changed the title
Use sstrip for better stripping
Use sstrip for better stripping and other notes
Apr 24, 2023
I recently discovered an interesting tool -
sstrip
, see https://man.archlinux.org/man/community/elfkickers/sstrip.1.enhttps://www.muppetlabs.com/~breadbox/software/elfkickers.html
sudo pacman -S elfkickers
It's a better
strip
that strips everything that isn't needed for the binary to run.Also, FYI,
-s
for the C compiler is worse than usingstrip
, so it should always be done.Default repo (I don't have musl-* stuff):
Use the
strip
command in the code for all compilers, not justzig cc
:Use
sstrip -z {filename}
instead:As you can see, it saves ~1KB for
zig cc
and ~2KB for other compilers, for free :)The text was updated successfully, but these errors were encountered: