Skip to content

Commit bd3cf4c

Browse files
committed
auto merge of #20218 : alexcrichton/rust/jemalloc-sections, r=luqmana
It's quite possible that small programs don't use all of jemalloc, and building with -ffunction-sections and -fdata-sections allows the linker (via --gc-sections) to strip out all unused code at link time. This decreases the size of a "hello world" executable for me from 716K to 482K with no measurable impact on link time. After this patch jemalloc is still the largest portion of our hello world executables, but this helps cut down on the size at least somewhat!
2 parents c43efee + 58d808f commit bd3cf4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ $$(JEMALLOC_LOCAL_$(1)): $$(JEMALLOC_DEPS) $$(MKFILE_DEPS)
180180
AR="$$(AR_$(1))" \
181181
RANLIB="$$(AR_$(1)) s" \
182182
CPPFLAGS="-I $(S)src/rt/" \
183-
EXTRA_CFLAGS="-g1"
183+
EXTRA_CFLAGS="-g1 -ffunction-sections -fdata-sections"
184184
$$(Q)$$(MAKE) -C "$$(JEMALLOC_BUILD_DIR_$(1))" build_lib_static
185185

186186
ifeq ($$(CFG_DISABLE_JEMALLOC),)

0 commit comments

Comments
 (0)