mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Optional canned symtab inclusion to the build. When option CONFIG_LIBC_SYMTAB is selected and symbol table file libc/symtab/canned_symtab.inc is prepared then application can use system provided complete symbol table. The option has substantial effect on system image size. Mainly code/text. If loading of applications at runtime is not planned do not select this. From Pavel Pisa.
This commit is contained in:
@@ -195,6 +195,8 @@ config EXECFUNCS_NSYMBOLS
|
||||
symbols in that table. This selection provides the number of
|
||||
symbols in the symbol table.
|
||||
|
||||
source libc/symtab/Kconfig
|
||||
|
||||
endif # EXECFUNCS_HAVE_SYMTAB
|
||||
endif # LIBC_EXECFUNCS
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ include queue/Make.defs
|
||||
include wqueue/Make.defs
|
||||
include misc/Make.defs
|
||||
include audio/Make.defs
|
||||
include symtab/Make.defs
|
||||
|
||||
# REVISIT: Backslash causes problems in $(COBJS) target
|
||||
DELIM := $(strip /)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config LIBC_SYMTAB
|
||||
bool "Include canned symtab for applications and shell"
|
||||
default n
|
||||
depends on EXECFUNCS_HAVE_SYMTAB
|
||||
---help---
|
||||
Build and include default symbol table in the NuttX library.
|
||||
The symbol table is selected by call canned_symtab_initialize().
|
||||
The table libc/symtab/canned_symtab.inc has to be generated
|
||||
by mksymtab manually before this option is selected.
|
||||
@@ -0,0 +1,45 @@
|
||||
############################################################################
|
||||
# libc/symtab/Make.defs
|
||||
#
|
||||
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_LIBC_SYMTAB),y)
|
||||
|
||||
# Include canned symtab to the build
|
||||
|
||||
CSRCS += lib_symtab.c
|
||||
|
||||
DEPPATH += --dep-path symtab
|
||||
VPATH += :symtab
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,19 @@
|
||||
symtab
|
||||
======
|
||||
|
||||
This directory provide support for canned symbol table which provides
|
||||
all/most of system and libc services/functions to the application and NSH.
|
||||
|
||||
The support is selected by CONFIG_LIBC_SYMTAB option and table has to be
|
||||
prepared in advance manually.
|
||||
|
||||
It can be prepared from NuttX top level directory by next commands
|
||||
|
||||
cat syscall/syscall.csv libc/libc.csv | sort >libc/symtab/canned_symtab.csv
|
||||
tools/mksymtab libc/symtab/canned_symtab.csv libc/symtab/canned_symtab.inc
|
||||
|
||||
Next code selectes canned symtab from application:
|
||||
|
||||
#include <nuttx/binfmt/canned_symtab.h>
|
||||
...
|
||||
canned_symtab_initialize();
|
||||
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
* libc/symtab/lib_symtab.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Canned symtab implemented by Pavel Pisa <ppisa@pikron.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_SYMTAB
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
#include <nuttx/binfmt/symtab.h>
|
||||
#include <nuttx/binfmt/canned_symtab.h>
|
||||
|
||||
#include "canned_symtab.inc"
|
||||
|
||||
/************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************/
|
||||
|
||||
void canned_symtab_initialize(void)
|
||||
{
|
||||
exec_setsymtab(g_symtab, NSYMBOLS);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIBC_SYMTAB */
|
||||
Reference in New Issue
Block a user