Skip to content

Commit 744432d

Browse files
committed
Build: add function sections.
This allows further reduction in binary sizes. Size of all user before: text data bss dec hex filename 64277932 904968 317576 65500476 3e7753c (TOTALS) After: 52443036 729560 271720 53444316 32f7edc (TOTALS) Some are dramatic, such as lightning-cli not pulling in libbacktrace: 174454 2880 296 177630 2b5de cli/lightning-cli 56633 2608 232 59473 e851 cli/lightning-cli But most things get a 25% trim: 3972339 363568 21760 4357667 427e23 lightningd/lightningd 3300337 247768 21664 3569769 367869 lightningd/lightningd Changelog-Changed: Build: most binaries are now about 20% smaller. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 01c1264 commit 744432d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ else
313313
LDLIBS = -L$(CPATH) -lm $(SQLITE3_LDLIBS) $(COVFLAGS)
314314
endif
315315

316+
ifeq ($(HAVE_FUNCTION_SECTIONS),1)
317+
LDLIBS += -Wl,--gc-sections
318+
endif
319+
316320
# If we have the postgres client library we need to link against it as well
317321
ifeq ($(HAVE_POSTGRES),1)
318322
LDLIBS += $(POSTGRES_LDLIBS)

0 commit comments

Comments
 (0)