apps/examples/elf: Add configuration optionst o support building the hello++4 example that depends upon having uClibc++ available. From Leo aloe3132.
This commit is contained in:
parent
fe2c662ee8
commit
5f6b3276a2
@ -16,7 +16,7 @@ config EXAMPLES_ELF_SYSCALL
|
||||
default n
|
||||
depends on LIB_SYSCALL && !BUILD_KERNEL
|
||||
---help---
|
||||
Link with the SYCALL library. By default, all undefined symbols
|
||||
Link with the SYSCALL library. By default, all undefined symbols
|
||||
must be provided via a symbol table. But if this option is
|
||||
selected, then each ELF test program will link with the SYSCALL
|
||||
library and will interface with the OS system calls. In this case,
|
||||
@ -54,4 +54,23 @@ config EXAMPLES_ELF_DEVPATH
|
||||
Used for registering the RAM block driver that will hold the ROMFS file system
|
||||
containing the ELF executables to be tested. Default: "/dev/ram0"
|
||||
|
||||
config EXAMPLES_ELF_CXXINITIALIZE
|
||||
bool "C++ Initialization"
|
||||
default y
|
||||
depends on HAVE_CXX && HAVE_CXXINITIALIZE
|
||||
---help---
|
||||
By default, if CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE are
|
||||
defined, then this example will call the NuttX function to
|
||||
initialize static C++ constructors. This option may be disabled,
|
||||
however, if that static initialization was performed elsewhere.
|
||||
|
||||
config EXAMPLES_ELF_UCLIBCXX
|
||||
bool "uClibc++ is installed"
|
||||
default n
|
||||
depends on UCLIBCXX
|
||||
---help---
|
||||
By default, uClibc++ is not installed and configured. If the
|
||||
user installs and configures the C++ standard library, this
|
||||
example will compile the demos using it.
|
||||
|
||||
endif
|
||||
|
@ -225,6 +225,12 @@ int elf_main(int argc, char *argv[])
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
/* Call all C++ static constructors */
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_ELF_CXXINITIALIZE)
|
||||
up_cxxinitialize();
|
||||
#endif
|
||||
|
||||
/* Initialize the memory monitor */
|
||||
|
||||
mm_initmonitor();
|
||||
|
@ -67,8 +67,10 @@ BIN1 = hello++1
|
||||
BIN2 = hello++2
|
||||
ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
|
||||
BIN3 = hello++3
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
|
||||
BIN4 = hello++4
|
||||
endif
|
||||
endif
|
||||
#BIN4 = hello++4
|
||||
ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4)
|
||||
|
||||
SRCS1 = $(BIN1).c
|
||||
@ -80,10 +82,12 @@ OBJS2 = $(SRCS2:.c=$(OBJEXT))
|
||||
ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
|
||||
SRCS3 = $(BIN3).c
|
||||
OBJS3 = $(SRCS3:.c=$(OBJEXT))
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
|
||||
SRCS4 = $(BIN4).c
|
||||
OBJS4 = $(SRCS4:.c=$(OBJEXT))
|
||||
endif
|
||||
endif
|
||||
|
||||
#SRCS4 = $(BIN4).c
|
||||
#OBJS4 = $(SRCS4:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4)
|
||||
OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4)
|
||||
@ -122,15 +126,17 @@ ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
|
||||
$(BIN3): $(OBJS3)
|
||||
@echo "LD: $<"
|
||||
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
|
||||
endif
|
||||
|
||||
# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++
|
||||
#
|
||||
# NOTE: libstdc++ is not available for NuttX as of this writing
|
||||
#
|
||||
#$(BIN4): $(OBJS4)
|
||||
# @echo "LD: $<"
|
||||
# $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
|
||||
$(BIN4): $(OBJS4)
|
||||
@echo "LD: $<"
|
||||
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $@ $(ARCHCRT0OBJ) $^ $(LDLIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(call DELFILE, $(BIN1))
|
||||
@ -145,8 +151,10 @@ install: $(ALL_BIN)
|
||||
$(Q) install $(BIN2) $(ROMFS_DIR)/$(BIN2)
|
||||
ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y)
|
||||
$(Q) install $(BIN3) $(ROMFS_DIR)/$(BIN3)
|
||||
ifeq ($(CONFIG_EXAMPLES_ELF_UCLIBCXX),y)
|
||||
$(Q) install $(BIN4) $(ROMFS_DIR)/$(BIN4)
|
||||
endif
|
||||
endif
|
||||
# $(Q) install $(BIN4) $(ROMFS_DIR)/$(BIN4)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user