doc: describe dropping unused tables from static builds #1973

pull fametrano wants to merge 1 commits into bitcoin-core:master from fametrano:docs-gc-sections changing 1 files +12 −0
  1. fametrano commented at 8:21 PM on October 21, 2026: contributor

    doc: describe dropping unused tables from static builds

    Adds a short README section: compile with -ffunction-sections -fdata-sections and link with -Wl,--gc-sections, so a static build drops the precomputed tables and code a program never calls. A verification-only program should use secp256k1_context_static, because a context from secp256k1_context_create keeps the signing table linked in.

    Addresses the last open item of #1065 (the other items are checked). real-or-random agreed to a docs PR in the thread.

    Size of text in bytes, static library built with the default modules and CFLAGS="-g -O2", plus the section flags in the last column:

    program no flags sections + gc
    signing only (ECDSA + Schnorr) 1340145 131364
    verifying only, context_static 1340313 1128701
    verifying only, context_create 1340281 1234429

    Measured with size and nm on the linked binaries (Debian trixie, aarch64, GCC 14.2, GNU ld 2.44); Autotools and CMake give identical sizes.

  2. doc: describe dropping unused tables from static builds
    Compiling with -ffunction-sections -fdata-sections and linking with
    -Wl,--gc-sections lets the linker drop the precomputed tables and code
    that a program never calls. Document it in the README, with the sizes
    measured for a signing-only and a verification-only program.
    
    Addresses the last open item of #1065.
    
    Assisted-by: Claude Opus 5.5
    2e5529f275

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-23 03:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me