examples/module. Module should not link with libc because it has out-of-range function calls

This commit is contained in:
Gregory Nutt 2015-12-12 14:00:34 -06:00
parent ad4bcac7a0
commit 052392f36c
3 changed files with 18 additions and 2 deletions

View File

@ -14,7 +14,7 @@ if EXAMPLES_MODULE
config EXAMPLES_MODULE_LIBC
bool "Link with LIBC"
default n
depends on !BUILD_KERNEL
depends on !BUILD_KERNEL && EXPERIMENTAL
---help---
Link with the C library (and also math library if it was built).
By default, all undefined symbols must be provided via a symbol
@ -26,6 +26,15 @@ config EXAMPLES_MODULE_LIBC
program greatly increasing the total code size. This option is
primarily intended only for testing.
WARNING: Libc will not be built with -mlong-calls and this may
result in runtime linking failures due to out-of-range functions
calls.
config EXAMPLES_MODULE_LIBGCC
bool "Link with LIBGCC"
default n
depends on !BUILD_KERNEL && EXPERIMENTAL
config EXAMPLES_MODULE_DEVMINOR
int "ROMFS Minor Device Number"
default 0

View File

@ -2,5 +2,4 @@
/romfs.h
/romfs.img
/symtab.c
/varlist.tmp

View File

@ -44,6 +44,14 @@ endif
KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__}
CFLAGS += $(KDEFINE)
ifeq ($(CONFIG_EXAMPLES_MODULE_LIBGCC),y)
LIBGCC = "${shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name 2>/dev/null}"
ifneq ($(LIBGCC),)
LDLIBPATH += -L "${shell dirname $(LIBGCC)}"
LDLIBS += -lgcc
endif
endif
ifeq ($(CONFIG_EXAMPLES_MODULE_LIBC),y)
LDMODULEFLAGS += -Bstatic
LDLIBPATH += -L $(NUTTXLIB)