unix: Fix Makefile to handle gc-sections linker flags on Mac OS.

The linker flag --gc-sections is not available on the linker used on
Mac OS X which results in an error when linking micropython on Mac OS X.
Therefore move this option to the LDFLAGS_ARCH variable on non Darwin
systems. According to http://stackoverflow.com/a/17710056 the equivalent
to --gc-sections is -dead_strip thus this option is used for the
LDFLAGS_ARCH on Darwin systems.
This commit is contained in:
Martin Müller 2016-06-25 17:59:49 +02:00 committed by Damien George
parent ab8a5d5199
commit f2892bd77d
1 changed files with 3 additions and 3 deletions

View File

@ -63,12 +63,12 @@ endif
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
CC = clang CC = clang
# Use clang syntax for map file # Use clang syntax for map file
LDFLAGS_ARCH = -Wl,-map,$@.map LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
else else
# Use gcc syntax for map file # Use gcc syntax for map file
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif endif
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA) -Wl,--gc-sections LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
ifeq ($(MICROPY_FORCE_32BIT),1) ifeq ($(MICROPY_FORCE_32BIT),1)
# Note: you may need to install i386 versions of dependency packages, # Note: you may need to install i386 versions of dependency packages,