Closed AAlon closed 5 years ago
For reference, the stock build of libdps_shared.so.0.9.0 on my EC2 instance weighs 3.0MB. With all the flags above it comes down to 599K.
https://github.com/intel/dps-for-iot/pull/102 has the following impact for me:
release:
$ ls -lh build/dist/lib/libdps_shared.so.0.9.0
-rwxr-xr-x. 1 tmalsbar lock 3.2M May 23 11:46 build/dist/lib/libdps_shared.so.0.9.0
$ size build/dist/lib/libdps_shared.so.0.9.0
text data bss dec hex filename
589324 9632 11121 610077 94f1d build/dist/lib/libdps_shared.so.0.9.0
min-size-release:
$ ls -lh build/dist/lib/libdps_shared.so.0.9.0
-rwxr-xr-x. 1 tmalsbar lock 255K May 23 11:47 build/dist/lib/libdps_shared.so.0.9.0
$ size build/dist/lib/libdps_shared.so.0.9.0
text data bss dec hex filename
252609 5440 9729 267778 41602 build/dist/lib/libdps_shared.so.0.9.0
Nice!
Currently, the build variants supported are
debug
andrelease
, the latter implies-O3
.It would be useful to add a min-size-release option (analogue to CMake's MinSizeRel) to better fit resource-constrained environments.
At the very least it should specify
-Os
. Additional relevant options might be-s
,-fdata-sections -ffunction-sections
,-flto
,-Wl,--gc-sections
,-Wl,--strip-all
.