Hello Xiang Xiao, On Monday 19 of July 2021 16:59:01 Xiang Xiao wrote: > > From: Pavel Pisa <ppisa4li...@pikron.com> > > Sent: Monday, July 19, 2021 10:46 PM ... > > # NuttX modules are ELF binaries. > > # Non-ELF platforms like macOS need to use a separate ELF toolchain. > > ifeq ($(CONFIG_HOST_MACOS),y) > > # eg. brew install x86_64-elf-gcc > > MODULECC = x86_64-elf-gcc > > MODULELD = x86_64-elf-ld > > How about we change to x86_64-elf-gcc too?
It would lead to unification which I like. It would be great is somebody working on MAC OS can try such change and do real tests. I have found cause for broken/empty LDENDGROUP and LDSTARTGROUP in exported Make.defs nuttx-export-10.1.0-RC1/scripts/Make.defs as LDENDGROUP = LDFLAGS = -nostartfiles -nodefaultlibs LDSTARTGROUP = The reason is that tools/mkexport.sh invokes ${MAKE} -C "${TOPDIR}/tools" -f Makefile.export TOPDIR="${TOPDIR}" tools/Makefile.export includes include $(TOPDIR)/.config include $(EXPORTDIR)/Make.defs and generates temporary ${EXPORTDIR}/makeinfo.sh" But LDENDGROUP and LDSTARTGROUP are defined in arch/{avr,hc,mips,misoc,or1k,renesas,risc-v,sim,x86,x86_64,xtensa}/src/Makefile which are not sourced by tools/Makefile.export. Only exception is arch/arm/src/rtl8720c/Toolchain.defs which could probably work. The question is if to try to source complete Makefile by export (probably would lead to other problems) or to change how architectures defines these options for toolchain. It can take more time to solve this problem clean way. May it be it solves if build system is switched. I would prefer meson + ninja above cmake or stay with GNU make, but cmake support is one of the most robust options today. As for temporal workaround I suggest to define some flag in each Make.defs setting LD=*-gcc to indicate that LINK_IS_DONE_BY_CC=y Or may it be set it in arch Kconfig then it can be used even during configuration or can be configurable, which would do probably more harm than proffit. Actual state is that LDENDGROUP and LDSTARTGROUP mustnot be used in builds using exported Make.defs directly. Use requires check that they are empty and workaround as has been hacked into pysimCoder. Best wishes, Pavel