A static build linked with --gc-sections can drop the precomputed tables and code a program never calls, and the README does not say how. This adds a section on it, with the functions that use each table, the options that set the table sizes and the advice against -Os. It addresses the last open item of #1065.
text size in bytes of a program linked against the static library, built with the default modules and the section's flags (programs and commands):
| program | without gc | with gc | tables kept with gc |
|---|---|---|---|
ECDSA signing, secp256k1_context_create |
1341897 | 126952 | ecmult_gen |
ECDSA verification, secp256k1_context_static |
1342105 | 1124953 | ecmult |
ECDSA verification, secp256k1_context_create |
1342081 | 1229593 | both |
ECDH, secp256k1_context_static |
1342001 | 70740 | neither |
Measured with size and nm (Debian, aarch64, GCC 14.2, GNU ld 2.44). With gc, the CMake command gives the same sizes as the Autotools one for signing, verification with the static context and ECDH.