sim: Fix nuttx.rel for macOS
* ld doesn't have --start-groupi/--end-group things. As far as I know, it works that way by default. * objcopy with Mach-O support is not widely available. (GNU binutils seem to claim the support but it didn't actually work for me. llvm-objcopy --redefine-syms explicitly rejects Mach-O.) Instead, use -unexported_symbols_list linker flag to hide symbols to avoid conflicts with host symbols.
This commit is contained in:
parent
b879b9b908
commit
b5573c5b51
@ -195,8 +195,15 @@ endif
|
|||||||
|
|
||||||
# Override in Make.defs if linker is not 'ld'
|
# Override in Make.defs if linker is not 'ld'
|
||||||
|
|
||||||
LDSTARTGROUP ?= --start-group
|
ifeq ($(HOSTOS),Darwin)
|
||||||
LDENDGROUP ?= --end-group
|
LDSTARTGROUP ?=
|
||||||
|
LDENDGROUP ?=
|
||||||
|
LDUNEXPORTSYMBOLS ?= -unexported_symbols_list $(HOSTOS)-names.dat
|
||||||
|
else
|
||||||
|
LDSTARTGROUP ?= --start-group
|
||||||
|
LDENDGROUP ?= --end-group
|
||||||
|
LDUNEXPORTSYMBOLS ?=
|
||||||
|
endif
|
||||||
|
|
||||||
EXTRA_LIBS ?=
|
EXTRA_LIBS ?=
|
||||||
EXTRA_LIBPATHS ?=
|
EXTRA_LIBPATHS ?=
|
||||||
@ -292,10 +299,15 @@ else
|
|||||||
$(Q) cp nuttx-names.dat $@
|
$(Q) cp nuttx-names.dat $@
|
||||||
endif
|
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)
|
nuttx.rel : libarch$(LIBEXT) board/libboard$(LIBEXT) $(HOSTOS)-names.dat $(LINKOBJS)
|
||||||
$(Q) echo "LD: nuttx.rel"
|
$(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 $@
|
$(Q) $(OBJCOPY) --redefine-syms=$(HOSTOS)-names.dat $@
|
||||||
|
endif
|
||||||
|
|
||||||
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
|
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
|
||||||
# specific objects (with munged names)
|
# specific objects (with munged names)
|
||||||
@ -327,7 +339,7 @@ export_startup: board/libboard$(LIBEXT) up_head.o $(HOSTOBJS)
|
|||||||
depend: .depend
|
depend: .depend
|
||||||
|
|
||||||
cleanrel:
|
cleanrel:
|
||||||
$(Q) rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat
|
$(Q) rm -f nuttx.rel $(HOSTOS)-names.dat
|
||||||
|
|
||||||
clean: cleanrel
|
clean: cleanrel
|
||||||
$(Q) if [ -e board/Makefile ]; then \
|
$(Q) if [ -e board/Makefile ]; then \
|
||||||
|
Loading…
Reference in New Issue
Block a user