mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:05:56 +08:00
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 |
||
|---|---|---|
| .. | ||
| cmdline-opts | ||
| examples | ||
| internals | ||
| libcurl | ||
| tests | ||
| .gitignore | ||
| ALTSVC.md | ||
| BINDINGS.md | ||
| BUG-BOUNTY.md | ||
| BUGS.md | ||
| CIPHERS-TLS12.md | ||
| CIPHERS.md | ||
| CMakeLists.txt | ||
| CODE_OF_CONDUCT.md | ||
| CODE_REVIEW.md | ||
| CONTRIBUTE.md | ||
| curl-config.md | ||
| CURL-DISABLE.md | ||
| CURLDOWN.md | ||
| DEPRECATE.md | ||
| DISTROS.md | ||
| EARLY-RELEASE.md | ||
| ECH.md | ||
| EXPERIMENTAL.md | ||
| FAQ.md | ||
| FEATURES.md | ||
| GOVERNANCE.md | ||
| HELP-US.md | ||
| HISTORY.md | ||
| HSTS.md | ||
| HTTP3.md | ||
| HTTP-COOKIES.md | ||
| HTTPSRR.md | ||
| INFRASTRUCTURE.md | ||
| INSTALL | ||
| INSTALL-CMAKE.md | ||
| INSTALL.md | ||
| INTERNALS.md | ||
| IPFS.md | ||
| KNOWN_BUGS.md | ||
| KNOWN_RISKS.md | ||
| MAIL-ETIQUETTE.md | ||
| Makefile.am | ||
| MANUAL.md | ||
| mk-ca-bundle.md | ||
| options-in-versions | ||
| README.md | ||
| RELEASE-PROCEDURE.md | ||
| ROADMAP.md | ||
| runtests.md | ||
| RUSTLS.md | ||
| SECURITY-ADVISORY.md | ||
| SPONSORS.md | ||
| SSL-PROBLEMS.md | ||
| SSLCERTS.md | ||
| testcurl.md | ||
| THANKS | ||
| THANKS-filter | ||
| TheArtOfHttpScripting.md | ||
| TODO.md | ||
| URL-SYNTAX.md | ||
| VERSIONS.md | ||
| VULN-DISCLOSURE-POLICY.md | ||
| wcurl.md | ||
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.