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'
|
||||
|
||||
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 \
|
||||
|
Loading…
Reference in New Issue
Block a user