diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index 02b76288b7c2b..b7f5196a57c6a 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -195,15 +195,8 @@ endif # Override in Make.defs if linker is not 'ld' -ifeq ($(HOSTOS),Darwin) - LDSTARTGROUP ?= - LDENDGROUP ?= - LDUNEXPORTSYMBOLS ?= -unexported_symbols_list $(HOSTOS)-names.dat -else - LDSTARTGROUP ?= --start-group - LDENDGROUP ?= --end-group - LDUNEXPORTSYMBOLS ?= -endif +LDSTARTGROUP ?= --start-group +LDENDGROUP ?= --end-group EXTRA_LIBS ?= EXTRA_LIBPATHS ?= @@ -299,15 +292,10 @@ 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) $(LDUNEXPORTSYMBOLS) -ifneq ($(HOSTOS),Darwin) + $(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o $@ $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP) $(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) @@ -318,6 +306,7 @@ nuttx$(EXEEXT): cleanrel nuttx.rel $(HOSTOBJS) $(Q) $(NM) $(TOPDIR)/$@ | \ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ sort > $(TOPDIR)/System.map + $(Q) rm -f nuttx.rel # This is part of the top-level export target @@ -338,7 +327,7 @@ export_startup: board/libboard$(LIBEXT) up_head.o $(HOSTOBJS) depend: .depend cleanrel: - $(Q) rm -f nuttx.rel $(HOSTOS)-names.dat + $(Q) rm -f nuttx.rel GNU/Linux-names.dat Cygwin-names.dat clean: cleanrel $(Q) if [ -e board/Makefile ]; then \ diff --git a/arch/sim/src/sim/up_initialstate.c b/arch/sim/src/sim/up_initialstate.c index 129d3be8ee43e..3ddb1128d7947 100644 --- a/arch/sim/src/sim/up_initialstate.c +++ b/arch/sim/src/sim/up_initialstate.c @@ -67,6 +67,6 @@ void up_initial_state(struct tcb_s *tcb) { memset(&tcb->xcp, 0, sizeof(struct xcptcontext)); - tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t); + tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr; tcb->xcp.regs[JB_PC] = (xcpt_reg_t)tcb->start; } diff --git a/arch/sim/src/sim/up_setjmp32.S b/arch/sim/src/sim/up_setjmp32.S index 13b202e63c76d..15880cbf7393c 100644 --- a/arch/sim/src/sim/up_setjmp32.S +++ b/arch/sim/src/sim/up_setjmp32.S @@ -46,12 +46,8 @@ #ifdef __CYGWIN__ # define SYMBOL(s) _##s #else -#ifdef __ELF__ -# define SYMBOL(s) _##s -#else # define SYMBOL(s) s #endif -#endif /************************************************************************** * Public Functions @@ -59,7 +55,7 @@ .text .globl SYMBOL(up_setjmp) -#ifdef __ELF__ +#ifndef __CYGWIN__ .type SYMBOL(up_setjmp), @function #endif SYMBOL(up_setjmp): @@ -90,11 +86,11 @@ SYMBOL(up_setjmp): xorl %eax, %eax ret -#ifdef __ELF__ +#ifndef __CYGWIN__ .size SYMBOL(up_setjmp), . - SYMBOL(up_setjmp) #endif .globl SYMBOL(up_longjmp) -#ifdef __ELF__ +#ifndef __CYGWIN__ .type SYMBOL(up_longjmp), @function #endif SYMBOL(up_longjmp): @@ -116,7 +112,7 @@ SYMBOL(up_longjmp): /* Jump to saved PC. */ jmp *%edx -#ifdef __ELF__ +#ifndef __CYGWIN__ .size SYMBOL(up_longjmp), . - SYMBOL(up_longjmp) #endif diff --git a/arch/sim/src/sim/up_setjmp64.S b/arch/sim/src/sim/up_setjmp64.S index 0e1063ba63760..92cc866523603 100644 --- a/arch/sim/src/sim/up_setjmp64.S +++ b/arch/sim/src/sim/up_setjmp64.S @@ -81,11 +81,7 @@ //# define SYMBOL(s) _##s # define SYMBOL(s) s #else -#ifdef __ELF__ # define SYMBOL(s) s -#else -# define SYMBOL(s) _##s -#endif #endif /************************************************************************** @@ -95,7 +91,7 @@ .text .align 4 .globl SYMBOL(up_setjmp) -#ifdef __ELF__ +#ifndef __CYGWIN__ .type SYMBOL(up_setjmp), @function #endif SYMBOL(up_setjmp): @@ -132,13 +128,13 @@ SYMBOL(up_setjmp): ret -#ifdef __ELF__ +#ifndef __CYGWIN__ .size SYMBOL(up_setjmp), . - SYMBOL(up_setjmp) #endif .align 4 .globl SYMBOL(up_longjmp) -#ifdef __ELF__ +#ifndef __CYGWIN__ .type SYMBOL(up_longjmp), @function #endif SYMBOL(up_longjmp): @@ -161,7 +157,7 @@ SYMBOL(up_longjmp): jmp *JB_RSI(REGS) /* Save 8: rsi */ -#ifdef __ELF__ +#ifndef __CYGWIN__ .size SYMBOL(up_longjmp), . - SYMBOL(up_longjmp) #endif diff --git a/arch/sim/src/sim/up_stackframe.c b/arch/sim/src/sim/up_stackframe.c index 887de5c70347a..eecb3668af412 100644 --- a/arch/sim/src/sim/up_stackframe.c +++ b/arch/sim/src/sim/up_stackframe.c @@ -124,7 +124,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Reset the initial state */ - tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t); + tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr; /* And return a pointer to the allocated memory */ diff --git a/binfmt/binfmt_globals.c b/binfmt/binfmt_globals.c index 94f98f13d49b4..ea01ab025b257 100644 --- a/binfmt/binfmt_globals.c +++ b/binfmt/binfmt_globals.c @@ -56,7 +56,7 @@ * protection to simply disable pre-emption when accessing this list. */ -FAR struct binfmt_s *g_binfmts = NULL; +FAR struct binfmt_s *g_binfmts; /**************************************************************************** * Private Functions diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt index 18a352e869ade..31091845a8658 100644 --- a/boards/sim/sim/sim/README.txt +++ b/boards/sim/sim/sim/README.txt @@ -153,12 +153,12 @@ The simulation build is a two pass build: created called nuttx.rel. This includes all of the files that are part of the NuttX "domain." - 2. On the second pass, the files which are in the host OS domain are build + 2. On the second pass, the files are are in the host OS domain are build and then linked with nuttx.rel to generate the simulation program. NuttX is a POSIX compliant RTOS and is normally build on a POSIX compliant host environment (like Linux or Cygwin). As a result, the same symbols are -exported by both the NuttX domain and the host domain. How can we keep them +exported by both the NuttX doman and the host domain. How can we keep them separate? This is done using the special file nuttx-name.dat. This file just contains @@ -181,10 +181,6 @@ which version of strlen() you call. Other times, it can cause subtle, mysterious errors. Usually, however, callng the wrong function in the wrong OS results in a fatal crash. -On macOS, instead of objcopy, -unexported_symbols_list linker option is -used to hide symbols in the NuttX domain, using the same list of symbols -from nuttx-name.dat. - Networking Issues ----------------- I never did get networking to work on the sim target. It tries to use the @@ -491,17 +487,6 @@ Common Configuration Information CONFIG_SIM_X8664_SYSTEMV=n CONFIG_SIM_M32=n - g. macOS, 64-bit, 64-bit build - - CONFIG_HOST_LINUX=n - CONFIG_HOST_MACOS=y - CONFIG_HOST_WINDOWS=n - CONFIG_HOST_X86=n - CONFIG_HOST_X86_64=y - CONFIG_SIM_X8664_MICROSOFT=n - CONFIG_SIM_X8664_SYSTEMV=y - CONFIG_SIM_M32=n - Configuration Sub-Directories ----------------------------- diff --git a/boards/sim/sim/sim/configs/cxxtest/Make.defs b/boards/sim/sim/sim/configs/cxxtest/Make.defs index 53fe2d56dc41e..7146e1ad7128d 100644 --- a/boards/sim/sim/sim/configs/cxxtest/Make.defs +++ b/boards/sim/sim/sim/configs/cxxtest/Make.defs @@ -36,7 +36,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATION = -g @@ -116,7 +116,9 @@ EXTRA_LIBPATHS = -L "${shell dirname "$(LIBSUPXX)"}" EXTRA_LIBS = -lsupc++ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g CCLINKFLAGS += -g + LDFLAGS += -g endif ifeq ($(CONFIG_SIM_M32),y) diff --git a/boards/sim/sim/sim/configs/nsh2/Make.defs b/boards/sim/sim/sim/configs/nsh2/Make.defs index b00ada0bfbca9..e329be3f6d141 100644 --- a/boards/sim/sim/sim/configs/nsh2/Make.defs +++ b/boards/sim/sim/sim/configs/nsh2/Make.defs @@ -36,7 +36,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATION = -g @@ -108,7 +108,9 @@ CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g CCLINKFLAGS += -g + LDFLAGS += -g endif ifeq ($(CONFIG_SIM_M32),y) diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 9eb3d13c2eaa7..94d53bb87263e 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -37,7 +37,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} ifeq ($(CONFIG_WINDOWS_MSYS),y) DIRLINK = $(TOPDIR)/tools/copydir.sh @@ -115,7 +115,9 @@ CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g CCLINKFLAGS += -g + LDFLAGS += -g endif ifeq ($(CONFIG_SIM_M32),y) diff --git a/boards/sim/sim/sim/src/Makefile b/boards/sim/sim/sim/src/Makefile index 7f4bbfa517849..0b01b424b474b 100644 --- a/boards/sim/sim/sim/src/Makefile +++ b/boards/sim/sim/sim/src/Makefile @@ -35,10 +35,8 @@ include $(TOPDIR)/Make.defs -# Add dummy.c to ensure that we have at least one object. -# On some platforms like macOS, we can't create an empty archive. ASRCS = -CSRCS = dummy.c +CSRCS = ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) CSRCS += sim_boot.c diff --git a/boards/sim/sim/sim/src/dummy.c b/boards/sim/sim/sim/src/dummy.c deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/boards/x86/qemu/qemu-i486/scripts/Make.defs b/boards/x86/qemu/qemu-i486/scripts/Make.defs index df4c8799b7f7b..e153be8967eec 100644 --- a/boards/x86/qemu/qemu-i486/scripts/Make.defs +++ b/boards/x86/qemu/qemu-i486/scripts/Make.defs @@ -36,7 +36,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATION = -g diff --git a/mm/umm_heap/umm_globals.c b/mm/umm_heap/umm_globals.c index a00ce3c4ec672..012aac76315d9 100644 --- a/mm/umm_heap/umm_globals.c +++ b/mm/umm_heap/umm_globals.c @@ -64,5 +64,5 @@ #else /* Otherwise, the user heap data structures are in common .bss */ -struct mm_heap_s g_mmheap = {}; +struct mm_heap_s g_mmheap; #endif diff --git a/tools/Makefile.host b/tools/Makefile.host index 71e87e59c6d56..07ebe9ea3b52e 100644 --- a/tools/Makefile.host +++ b/tools/Makefile.host @@ -43,7 +43,7 @@ include ${TOPDIR}/tools/Config.mk # Define HOSTCC on the make command line if it differs from these defaults # Define HOSTCFLAGS with -g on the make command line to build debug versions -HOSTOS = ${shell uname -o 2>/dev/null || uname -s 2>/dev/null || echo "Other"} +HOSTOS = ${shell uname -o || echo "Other"} ifeq ($(HOSTOS),MinGW) diff --git a/tools/sethost.sh b/tools/sethost.sh index 2983095dd893f..2cd63ff0647bd 100755 --- a/tools/sethost.sh +++ b/tools/sethost.sh @@ -244,9 +244,9 @@ echo " Refreshing..." cd $nuttx || { echo "ERROR: failed to cd to $nuttx"; exit 1; } make clean_context 1>/dev/null 2>&1 if [ "X${debug}" = "Xy" ]; then - make olddefconfig V=1 || { echo "ERROR: failed to refresh"; exit 1; } + make olddefconfig V=1 else - make olddefconfig 1>/dev/null || { echo "ERROR: failed to refresh"; exit 1; } + make olddefconfig 1>/dev/null 2>&1 fi # Move config file to correct location and restore any previous .config