Skip to content

Commit df453f0

Browse files
committed
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).
1 parent 332545b commit df453f0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

unix/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ifdef DEBUG
2828
CFLAGS += -g
2929
COPT = -O0
3030
else
31-
COPT = -Os #-DNDEBUG
31+
COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG
3232
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
3333
# security for detecting buffer overflows. Some distros (Ubuntu at the very least)
3434
# have it enabled by default.
@@ -68,7 +68,7 @@ else
6868
# Use gcc syntax for map file
6969
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref
7070
endif
71-
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
71+
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) -Wl,--gc-sections
7272

7373
ifeq ($(MICROPY_FORCE_32BIT),1)
7474
# Note: you may need to install i386 versions of dependency packages,

0 commit comments

Comments
 (0)