From df453f0652abbd96310d768ab4529286a76d9775 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 17 Jun 2016 02:38:20 +0300 Subject: [PATCH] unix: Time to build with --gc-sections. This actually saves "only" 6K for x86_64 build, as we're still more or less careful to #ifdef unneeded code. But relying on --gc-sections in a "lazy" manner would allow to make #ifdef'ing less pervasive (not suggested right away, but an option for the future). --- unix/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/Makefile b/unix/Makefile index 566c7a372b..37c7f6e844 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -28,7 +28,7 @@ ifdef DEBUG CFLAGS += -g COPT = -O0 else -COPT = -Os #-DNDEBUG +COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG # _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra # security for detecting buffer overflows. Some distros (Ubuntu at the very least) # have it enabled by default. @@ -68,7 +68,7 @@ else # Use gcc syntax for map file LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref endif -LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) +LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) -Wl,--gc-sections ifeq ($(MICROPY_FORCE_32BIT),1) # Note: you may need to install i386 versions of dependency packages,