diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-01 01:37:14 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-10-01 09:29:14 +0300 |
commit | b1270a3331f68948b33581623dfdcadbf72a046b (patch) | |
tree | e824a4fd367957abca471b00fad9c9161becc638 /common.mk | |
parent | 7ef8be0c719b86a224896a9ce03b9ac9bcc45e60 (diff) |
mtd-utils: enable garbage collection of unused function/data sections
On my default build, this cumulatively shaves off ~100KiB of unused
code and data from the mtd-utils programs.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'common.mk')
-rw-r--r-- | common.mk | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3,6 +3,7 @@ AR := $(CROSS)ar RANLIB := $(CROSS)ranlib # Stolen from Linux build system +comma = , try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") cc-option = $(call try-run, $(CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2)) @@ -12,6 +13,8 @@ WFLAGS := -Wall \ $(call cc-option,-Wwrite-strings) \ $(call cc-option,-Wno-sign-compare) CFLAGS += $(WFLAGS) +SECTION_CFLAGS := $(call cc-option,-ffunction-sections -fdata-sections -Wl$(comma)--gc-sections) +CFLAGS += $(SECTION_CFLAGS) ifneq ($(WITHOUT_LARGEFILE), 1) CPPFLAGS += -D_FILE_OFFSET_BITS=64 |