From 796cbca68d1f711df7fcddda6cd9df43632a6b6a Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Thu, 6 Aug 2026 18:19:30 +0300 Subject: [PATCH 1/3] Enable lld ICF for Python bindings on Linux Folds byte-identical template instantiations: mrmeshpy.so -11% unpacked, -2.3 MB compressed per wheel; full distro test matrix passed on an ICF build. --- scripts/mrbind/generate.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/mrbind/generate.mk b/scripts/mrbind/generate.mk index 5ab102f44d41..cfdf8e2acc4c 100644 --- a/scripts/mrbind/generate.mk +++ b/scripts/mrbind/generate.mk @@ -314,6 +314,13 @@ MODE := release ifeq ($(MODE),release) override EXTRA_CFLAGS += -Oz -flto=thin -DNDEBUG override EXTRA_LDFLAGS += -Oz -flto=thin $(if $(IS_MACOS),-Wl$(comma)-x,-s)# Apple's ld rejects `-s`; `-Wl,-x` drops local Mach-O symbols (most of __LINKEDIT) instead. +ifneq ($(IS_LINUX),) +# Fold byte-identical functions: the bindings are ~190k tiny near-duplicate template +# instantiations, and ICF removes 11% of mrmeshpy.so (7 MB unpacked, 2.3 MB compressed). +# Linux-only until lld-link (Windows) and ld64.lld (macOS) get their own measurements. +override EXTRA_CFLAGS += -ffunction-sections -fdata-sections +override EXTRA_LDFLAGS += -Wl,--icf=all +endif else ifeq ($(MODE),debug) override EXTRA_CFLAGS += -g override EXTRA_LDFLAGS += -g From d0802e75518ade8c879703a4136f52931768e981 Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Thu, 6 Aug 2026 19:34:02 +0300 Subject: [PATCH 2/3] Drop redundant compile flags: lld LTO codegen always emits per-function sections --- scripts/mrbind/generate.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mrbind/generate.mk b/scripts/mrbind/generate.mk index cfdf8e2acc4c..a1124c3f6ba9 100644 --- a/scripts/mrbind/generate.mk +++ b/scripts/mrbind/generate.mk @@ -318,7 +318,7 @@ ifneq ($(IS_LINUX),) # Fold byte-identical functions: the bindings are ~190k tiny near-duplicate template # instantiations, and ICF removes 11% of mrmeshpy.so (7 MB unpacked, 2.3 MB compressed). # Linux-only until lld-link (Windows) and ld64.lld (macOS) get their own measurements. -override EXTRA_CFLAGS += -ffunction-sections -fdata-sections +# No -ffunction-sections needed: lld's LTO codegen always emits per-function sections. override EXTRA_LDFLAGS += -Wl,--icf=all endif else ifeq ($(MODE),debug) From 69b6847b5b0dbcb20e30c228c2d2ede88fa157a6 Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Fri, 7 Aug 2026 10:10:21 +0300 Subject: [PATCH 3/3] Update mrbind: table-driven Python bindings registration Points thirdparty/mrbind at MeshInspector/mrbind#42 (branch table-driven-py-registration); to be re-pointed at the merged master commit once that PR lands. --- thirdparty/mrbind | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/mrbind b/thirdparty/mrbind index cd7665092b62..8f8b1b6f7423 160000 --- a/thirdparty/mrbind +++ b/thirdparty/mrbind @@ -1 +1 @@ -Subproject commit cd7665092b625dfcc7c846bf0a1c3b2682e0fe76 +Subproject commit 8f8b1b6f742367f949d2b01e7d778e3575f18751