diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index b7f5196a57..8bd1f72748 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -195,8 +195,15 @@ endif # Override in Make.defs if linker is not 'ld' -LDSTARTGROUP ?= --start-group -LDENDGROUP ?= --end-group +ifeq ($(HOSTOS),Darwin) + LDSTARTGROUP ?= + LDENDGROUP ?= + LDUNEXPORTSYMBOLS ?= -unexported_symbols_list $(HOSTOS)-names.dat +else + LDSTARTGROUP ?= --start-group + LDENDGROUP ?= --end-group + LDUNEXPORTSYMBOLS ?= +endif EXTRA_LIBS ?= EXTRA_LIBPATHS ?= @@ -292,10 +299,15 @@ else $(Q) cp nuttx-names.dat $@ endif +Darwin-names.dat: nuttx-names.dat + $(Q) cat $^ | sed -e "s/^\([^[:space:]][^[:space:]]*\)[[:space:]].*/_\1/g" >$@ + nuttx.rel : libarch$(LIBEXT) board/libboard$(LIBEXT) $(HOSTOS)-names.dat $(LINKOBJS) $(Q) echo "LD: nuttx.rel" - $(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o $@ $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP) + $(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o $@ $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP) $(LDUNEXPORTSYMBOLS) +ifneq ($(HOSTOS),Darwin) $(Q) $(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@ +endif # Generate the final NuttX binary by linking the host-specific objects with the NuttX # specific objects (with munged names) @@ -327,7 +339,7 @@ export_startup: board/libboard$(LIBEXT) up_head.o $(HOSTOBJS) depend: .depend cleanrel: - $(Q) rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat + $(Q) rm -f nuttx.rel $(HOSTOS)-names.dat clean: cleanrel $(Q) if [ -e board/Makefile ]; then \