summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Müller <mail@mueller-martin.net>2016-06-25 17:59:49 +0200
committerDamien George <damien.p.george@gmail.com>2016-06-27 22:31:55 +0100
commitf2892bd77da5f7adbad3d83bb6e0898af224975b (patch)
treec272b01ba48b1aa696ca86ce7243de88f64efd0d
parentab8a5d51999b5c9214004200a8e0528caf160cc6 (diff)
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.
-rw-r--r--unix/Makefile6
1 files changed, 3 insertions, 3 deletions
diff --git a/unix/Makefile b/unix/Makefile
index 23f7ea487..3e0d299d8 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -63,12 +63,12 @@ endif
ifeq ($(UNAME_S),Darwin)
CC = clang
# Use clang syntax for map file
-LDFLAGS_ARCH = -Wl,-map,$@.map
+LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip
else
# Use gcc syntax for map file
-LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref
+LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
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)
# Note: you may need to install i386 versions of dependency packages,