Put each function in its own section so ICF can fold more - #6550
Merged
Conversation
--icf=safe only sees COMDAT functions without this: plain out-of-line functions share one .text per translation unit and never fold. CUDA is excluded -- nvcc does not take -ffunction-sections.
This was referenced Aug 7, 2026
Grantim
approved these changes
Aug 7, 2026
Fedr
added a commit
that referenced
this pull request
Aug 7, 2026
The linux-vcpkg tar.xz was the last artifact shipping unstripped libraries: the wheels (#6525) and the AppImage (linuxdeploy strips unless NO_STRIP is set) have always been stripped. `.symtab`/`.strtab` are not SEC_ALLOC, are never loaded at runtime, and linking against the package needs only `.dynsym`, which strip keeps. The archive shrinks 1,504,076 B on x64 (-2.19%) and 2,131,340 B on arm64 (-3.26%); an unpacked install shrinks by the full 16.3 MB / 17.6 MB of symbol tables. This also removes the only place where `-ffunction-sections` (#6550) inflated `.symtab` visibly. Third-party libraries copied from vcpkg are left alone: blanket-stripping that tree would hit `.a` archives, where it breaks linking. Backtraces inside the shipped libraries now lose the names of non-exported functions, as is already the case for every wheel and AppImage we publish.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #6547.
--icf=safecan only fold what the compiler put in its own section: template instantiations and inlines get COMDAT sections automatically, but plain out-of-line functions share one.textper translation unit and are invisible to folding.-ffunction-sectionsgives each of them its own section.Same gate as the ICF flag — inside the
MESHLIB_HAVE_LLDblock, non-Debug only — so nothing changes for GCC rows, macOS, emscripten or Debug builds. Restricted to C/C++ via$<COMPILE_LANGUAGE:C,CXX>, becauseadd_compile_optionswould otherwise hand-ffunction-sectionsto nvcc, which does not accept it.-fdata-sectionsis deliberately absent: lld's ELF ICF folds executable sections only.Sizes: −2.0% once stripped, on both arches
Release/Clang 21/ lld, all 14.so, baseline = master (--icf=safealready in):-ffunction-sectionsThe arm64 growth in unstripped builds is entirely symbol tables — per-function sections mean per-function section symbols:
libMeshLibC2.so.symtab.strtab.gcc_except_table.symtab/.strtabare notSEC_ALLOC: never loaded at runtime, and removed bystrip. Everything we ship is stripped — wheels via #6525, the AppImage by linuxdeploy (which strips unlessNO_STRIPis set) — so the +2.70% never reaches a user.Where the win comes from
Not
.text. Summed over all.so(x64 / arm64):.gcc_except_table.text.eh_frame+.eh_frame_hdrThe folding is mostly exception-handling tables.
libMeshLibC2.soalone drops.gcc_except_tablefrom 1,045,892 to 220,576 — −79% — while its.textis byte-identical: the generated C bindings are thousands of near-identicaltry/catchwrappers, so their LSDAs are duplicates even where the surrounding code is not.Caveat before merging
scripts/distribution_vcpkg.shdoes not strip (cmake --installwithout--strip), so thelinux-vcpkgtar.xzis the one artifact that would carry the extra symbol tables. Its compressed delta is unmeasured and could go either way: the added.symtaband the removed.gcc_except_tableboth compress well. Two ways to settle it — measure the package both ways, or strip in the packaging script, which makes the question moot and shrinks that artifact regardless of this PR.Testing
Linux legs only; Windows and macOS disabled as unreachable behind
UNIX AND NOT APPLE. All fourlinux-vcpkglegs green across every measurement run.