curl/docs
Viktor Szakats 66ad54e46b
cmake: add CURL_DROP_UNUSED option to reduce binary sizes
To enable known linker options dropping unused, dead, code and data from
the executables built.

Useful to reduce binary sizes for curl, libcurl shared lib and apps
linking static libcurl. It's effective on both "unity" and non-unity
builds. Aligning "unity" build sizes with default, non-unity ones.

Supported platforms: Apple, MSVC, llvm/clang and GCC on all tested
platforms: Linux, BSDs, Windows, MSYS2/Cygwin, Android, MS-DOS.

Notes:
- Static libraries grow 20-30% with non-Apple toolchains.
  This effect is controlled by separate, optional compiler flags on
  non-Apple. This patch enables them automatically for public binaries
  (libcurl and curl tool), and leaves them off for internal/test ones.
- MSVC enables this option by default for 'Release' configurations.
  The curl build option has no effect on it.
- Observed effect on VS2010 is negligible. VS2012+ is recommended.
- Works with LTO, Fil-C.
- No observed/conclusive effect on build speed.
- On Windows with clang/gcc (mingw-w64/MSYS2/Cygwin) it also enables
  `-fno-asynchronous-unwind-tables` as a workaround to make
  the toolchain options actually work.
  Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=11539
  Thanks-to: Andarwinux

Also:
- GHA: enable in Linux and MinGW jobs to test it. Size changes:

  - linux aws-lc H3:
    curl: 2000000 -> 1937152, libcurl.a: 2065724 -> 2716532 bytes
  - macos clang HTTP-only:
    curl: 1364376 -> 128799 bytes, libcurl.a: unchanged
  - macos llvm MultiSSL:
    curl: 410056 -> 405720, libcurl.dylib: 1350336 -> 1348480 bytes
  - mingw schannel c-ares U:
    curl: 1588736 -> 1507328, libcurl-d.a: 3322040 -> 3884746 bytes
    bld: 34 -> 35MB

- GHA: enable in MSVC and Apple jobs to reduce disk footprint, with no
  obvious downside. Size changes:

  - AppVeyor CI VS2019:
    curl: 2339840 -> 1295872, libcurl-d.dll: 3155968 -> 1900544 bytes
    bld: 161 -> 97MB
  - AppVeyor CI VS2022 clang-cl:
    curl: 2933248 -> 2332160, libcurl-d.lib: 4762688 -> 5511330 bytes
    bld: 133 -> 121MB
  - AppVeyor CI VS2022 HTTP-only:
    curl: 3514368 -> 2177024, libcurl-d.lib: 2538420 -> 3151740 bytes
    bld: 137 -> 83MB
  - GHA intel:
    curl: 2629120 -> 2023424, libcurl-d.lib: 4366652 -> 5350670 bytes
    bld: 86 -> 69MB
  - GHA arm64:
    curl: 2832896 -> 2063872, libcurl-d.lib: 4690616 -> 5597250 bytes
    bld: 82 -> 66MB

Refs:
https://maskray.me/blog/2021-02-28-linker-garbage-collection
https://web.archive.org/web/20110811230637/msdn.microsoft.com/en-us/library/bxwfs976.aspx (VS2010)
https://learn.microsoft.com/cpp/build/reference/opt-optimizations
https://learn.microsoft.com/cpp/build/reference/gy-enable-function-level-linking

Closes #20357
2026-01-22 17:08:20 +01:00
..
cmdline-opts build: merge TrackMemory (CURLDEBUG) into debug-enabled option 2026-01-19 18:43:17 +01:00
examples build: update to not need _CRT_NONSTDC_NO_DEPRECATE with MSVC 2026-01-20 23:19:54 +01:00
internals build: update to not need _CRT_NONSTDC_NO_DEPRECATE with MSVC 2026-01-20 23:19:54 +01:00
libcurl socket: check result of SO_NOSIGPIPE 2026-01-20 16:38:49 +01:00
tests build: merge TrackMemory (CURLDEBUG) into debug-enabled option 2026-01-19 18:43:17 +01:00
.gitignore docs: add RELEASE-TOOLS.md.dist to .gitignore 2024-07-01 22:49:55 +02:00
ALTSVC.md docs: fold long lines 2025-12-11 11:42:28 +01:00
BINDINGS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
BUG-BOUNTY.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
BUGS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
CIPHERS-TLS12.md docs: update CIPHERS.md 2024-08-12 23:35:56 +02:00
CIPHERS.md tidy-up: update MS links, allow long URLs via checksrc 2025-09-20 11:49:23 +02:00
CMakeLists.txt tests: move test docs into /docs 2025-05-28 15:00:03 +02:00
CODE_OF_CONDUCT.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
CODE_REVIEW.md docs: fix broken link in CODE_REVIEW.md 2025-06-21 10:32:06 +02:00
CONTRIBUTE.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
curl-config.md docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
CURL-DISABLE.md build: add build-level CURL_DISABLE_TYPECHECK options 2025-11-21 13:48:35 +01:00
CURLDOWN.md misc: fix typos 2025-07-12 08:59:44 +02:00
DEPRECATE.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
DISTROS.md tidy-up: URLs 2025-12-09 00:19:10 +01:00
EARLY-RELEASE.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
ECH.md tidy-up: URLs 2025-12-09 00:19:10 +01:00
EXPERIMENTAL.md docs/EXPERIMENTAL.md: add a mention of HTTPSRR as experimental 2025-01-16 19:41:42 +01:00
FAQ.md mqtt: initial support for MQTTS 2026-01-17 22:43:36 +01:00
FEATURES.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
GOVERNANCE.md GOVERNANCE.md: Post-Daniel BDFL 2026-01-15 17:49:29 +01:00
HELP-US.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
HISTORY.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
HSTS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
HTTP-COOKIES.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
HTTP3.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
HTTPSRR.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
INFRASTRUCTURE.md GHA/checkdocs: re-enable proselint, update setup, fix issues found 2025-12-11 11:42:28 +01:00
INSTALL INSTALL: converted to markdown => INSTALL.md 2016-10-21 15:57:29 +02:00
INSTALL-CMAKE.md cmake: add CURL_DROP_UNUSED option to reduce binary sizes 2026-01-22 17:08:20 +01:00
INSTALL.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
INTERNALS.md windows: bump minimum to Vista (from XP) 2026-01-17 11:41:49 +01:00
IPFS.md IPFS.md: wrap long lines 2025-12-08 17:28:43 +01:00
KNOWN_BUGS.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
KNOWN_RISKS.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
MAIL-ETIQUETTE.md docs: remove dead URLs 2025-12-05 23:41:41 +01:00
Makefile.am tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
MANUAL.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
mk-ca-bundle.md mk-ca-bundle.md: the file format docs URL is permaredirected 2025-12-08 22:07:32 +01:00
options-in-versions tool_getparam: add --knownhosts 2025-10-06 13:41:22 +02:00
README.md reuse: add copyright + license info to individual docs/*.md files 2024-03-31 12:01:18 +02:00
RELEASE-PROCEDURE.md RELEASE-PROCEDURE.md: drop the _newslog edit mention 2025-09-08 11:12:47 +02:00
ROADMAP.md CI: add whitespace checker 2024-06-27 13:33:30 +02:00
runtests.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
RUSTLS.md tidy-up: URLs 2025-09-23 00:34:46 +02:00
SECURITY-ADVISORY.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
SPONSORS.md SPONSORS.md: clarify that we don't promise goods or services 2025-02-05 23:40:24 +01:00
SSL-PROBLEMS.md badwords: catch and fix more variants of NN-bit 2026-01-14 02:35:00 +01:00
SSLCERTS.md tidy-up: miscellaneous 2025-12-12 04:18:48 +01:00
testcurl.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
THANKS THANKS: add contributors from 8.18.0 2026-01-07 07:56:22 +01:00
THANKS-filter RELEASE-NOTES: synced 2025-11-05 14:12:23 +01:00
TheArtOfHttpScripting.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
TODO.md TODO: add point about improving SIGPIPE handling 2026-01-15 22:42:28 +01:00
URL-SYNTAX.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
VERSIONS.md tidy-up: miscellaneous 2026-01-20 12:37:56 +01:00
VULN-DISCLOSURE-POLICY.md tidy-up: miscellaneous 2026-01-15 13:06:13 +01:00
wcurl.md wcurl: import v2026.01.05 2026-01-06 10:12:31 +01:00

curl logo

Documentation

You find a mix of various documentation in this directory and subdirectories, using several different formats. Some of them are not ideal for reading directly in your browser.

If you would rather see the rendered version of the documentation, check out the curl website's documentation section for general curl stuff or the libcurl section for libcurl related documentation.