I have to 'squeeze' all the needed code to run ldaps on an embedded system. So the 3 MiB of lybcrypto and almost 700KiB of libssl are way too much.
I'm now experimenting on ldapsearch because reading from ldap is the most important goal.
I've checked with
ld ldapsearch which shared objects are used by ldapsearch and i found this:
670K /usr/local/lib64/libssl.so.1.1 ** 3,3M /usr/local/lib64/libcrypto.so.1.1 ** 40K /usr/lib64/libcrypt.so.1 -> libcrypt-2.17.so 104K /usr/lib64/libresolv.so.2 -> libresolv-2.17.so 2,1M /usr/lib64/libc.so.6 -> libc-2.17.so ** 19K /usr/lib64/libdl.so.2 -> libdl-2.17.so 139K /usr/lib64/libpthread.so.0 -> libpthread-2.17.so 12K usr/lib64/libfreebl3.so
so the ones marked
** are the most critical
Now I have absolutely no idea how to compile this stuff starting from downloaded source and what command should I give to gcc to compile optimizing size.
I also taught if it would give space save to static-link the shared-object. (I think, based on what I read, optimizer in this case could strip most of unused code while linking as so all the entry point would be compiled anyway)
I found the optimization I could try first is
-Os, I put it into
lib_cflags string in
Configurations/00-base-templates.conf but size is still the same
Another option I was suggested is to use
strip, but I don't know how to give it to