anjiahao
63e2650487
elf:avoid interference between different ELFs generated by symtab
...
if defined CONFIG_EXAMPLES_ELF and CONFIG_EXAMPLES_MODLUE,
elf will generated BINDIR, so generated symtab will interference.
It supports inputting multiple specified files in mksymtab.sh to
avoid interference.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2026-01-16 21:07:56 +08:00
Niccolò Maggioni
056f04d170
tools/mksymtab: Replace deprecated fgrep usages
...
In most modern distros, fgrep is deprecated in favor of "grep -F"
Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-13 22:09:20 +08:00
chao an
27846ffec7
libc/elf: rename modlib to libelf
...
Renaming "modlib" to "libelf" is more in line with the implementation content,
which makes it easier for individual developers to understand the capabilities of this module.
CONFIG_LIBC_MODLIB -> CONFIG_LIBC_ELF
Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-04-11 09:43:07 +08:00
Alin Jerpelea
d921170a02
tools: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-30 18:02:50 +08:00
wangjianyu3
98427f67f1
tools/mksymtab.sh: Add symbol table for modlib
...
Configs:
+CONFIG_MODLIB_HAVE_SYMTAB=y
CONFIG_MODLIB_SYMTAB_ARRAY="g_mod_symtab"
CONFIG_MODLIB_NSYMBOLS_VAR="g_mod_nsymbols"
Link error:
LD: nuttx
aarch64-none-elf-ld: /workspace/nuttx/staging/libc.a(modlib_symtab.o): in function `modlib_getsymtab':
/workspace/nuttx/libs/libc/modlib/modlib_symtab.c:97:(.text.modlib_getsymtab+0xa0): undefined reference to `g_mod_symtab'
aarch64-none-elf-ld: /workspace/nuttx/libs/libc/modlib/modlib_symtab.c:97:(.text.modlib_getsymtab+0xa4): undefined reference to `g_mod_symtab'
aarch64-none-elf-ld: /workspace/nuttx/libs/libc/modlib/modlib_symtab.c:98:(.text.modlib_getsymtab+0xa8): undefined reference to `g_mod_nsymbols'
aarch64-none-elf-ld: /workspace/nuttx/libs/libc/modlib/modlib_symtab.c:98:(.text.modlib_getsymtab+0xac): undefined reference to `g_mod_nsymbols'
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-10-09 12:15:24 +08:00
wangjianyu3
266049bd11
tools/mksymtab.sh: Using getopts to parse parameters
...
Use the "-a" option to specify additional lists
Examples
- The basic.txt
$ cat basic.txt
basic_func0
basic_func1
basic_func2
- The additional.txt
$ cat additional.txt
additional_func0
additional_func1
additional_func2
1. Get symbols from directory "EMPTY_DIR" and additional list basic.txt
./tools/mksymtab.sh ./EMPTY_DIR -a basic.txt
#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)
const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] =
#elif defined(CONFIG_NSH_SYMTAB)
const struct symtab_s CONFIG_NSH_SYMTAB_ARRAYNAME[] =
#else
const struct symtab_s dummy_symtab[] =
#endif
{
{"basic_func0", &basic_func0},
{"basic_func1", &basic_func1},
{"basic_func2", &basic_func2},
};
2. Get symbols from directory "EMPTY_DIR" and two additional lists basic.txt, additional.txt
./tools/mksymtab.sh ./EMPTY_DIR -a basic.txt -a additional.txt
#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)
const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] =
#elif defined(CONFIG_NSH_SYMTAB)
const struct symtab_s CONFIG_NSH_SYMTAB_ARRAYNAME[] =
#else
const struct symtab_s dummy_symtab[] =
#endif
{
{"additional_func0", &additional_func0},
{"additional_func1", &additional_func1},
{"additional_func2", &additional_func2},
{"basic_func0", &basic_func0},
{"basic_func1", &basic_func1},
{"basic_func2", &basic_func2},
};
3. Set prefix and get symbols from directory "EMPTY_DIR" and two additional lists basic.txt, additional.txt
./tools/mksymtab.sh ./EMPTY_DIR PREFIX_TEST -a basic.txt -a additional.txt
const struct symtab_s PREFIX_TEST_exports[] =
{
{"additional_func0", &additional_func0},
{"additional_func1", &additional_func1},
{"additional_func2", &additional_func2},
{"basic_func0", &basic_func0},
{"basic_func1", &basic_func1},
{"basic_func2", &basic_func2},
};
4. Error: Missing <imagedirpath>
$ ./tools/mksymtab.sh
ERROR: Missing <imagedirpath>
Usage: ./tools/mksymtab.sh <imagedirpath> [symtabprefix] [-a additionalsymbolspath]
UNSUPPORTED usage examples
# `getopt` supports these, but the usage in GNU and macOS is incompatible.
- ./tools/mksymtab.sh ./EMPTY_DIR -a basic.txt PREFIX_TEST -a additional.txt
- ./tools/mksymtab.sh -a basic.txt ./EMPTY_DIR PREFIX_TEST -a additional.txt
References
BASH(1) -- getopts
GETOPT(1) -- getopt
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-10-07 18:55:06 +08:00
wangjianyu3
c9223afe7e
tools/mksymtab.sh: Support multiple additional symbols` file
...
Test
```
$ cat basic.txt
test_a
test_b
test_c
$ cat math.txt
acosf
asinf
atan2f
ceilf
cosf
expf
$ ./mksymtab.sh ./ g_TEST basic.txt
#include <nuttx/compiler.h>
#include <nuttx/symtab.h>
extern void *test_a;
extern void *test_b;
extern void *test_c;
const struct symtab_s g_TEST_exports[] =
{
{"test_a", &test_a},
{"test_b", &test_b},
{"test_c", &test_c},
};
const int g_TEST_nexports = sizeof(g_TEST_exports) / sizeof(struct symtab_s);
$ ./mksymtab.sh ./ g_TEST basic.txt math.txt
#include <nuttx/compiler.h>
#include <nuttx/symtab.h>
extern void *acosf;
extern void *asinf;
extern void *atan2f;
extern void *ceilf;
extern void *cosf;
extern void *expf;
extern void *test_a;
extern void *test_b;
extern void *test_c;
const struct symtab_s g_TEST_exports[] =
{
{"acosf", &acosf},
{"asinf", &asinf},
{"atan2f", &atan2f},
{"ceilf", &ceilf},
{"cosf", &cosf},
{"expf", &expf},
{"test_a", &test_a},
{"test_b", &test_b},
{"test_c", &test_c},
};
const int g_TEST_nexports = sizeof(g_TEST_exports) / sizeof(struct symtab_s);
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-29 22:20:30 +02:00
wangjianyu3
d1fc46d978
tools/mksymtab.sh: Support symbol name overriding
...
The lines start with "," make no effects(as comments)
e.g.
$ cat exports.txt | grep atan2
atan2Override,atan2
$ /PATH/TO/APPS/tools/mksymtab.sh FOO BAR exports.txt | grep atan2
extern void *atan2Override;
{"atan2", &atan2Override},
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:46:46 +08:00
wangjianyu3
7f7ff8c7d4
tools/mksymtab.sh: Support adding additional symbols that are not in undefined list
...
e.g. For CHRE dynamic nanoapps, pre-saving symbols that may be used later, no need recompiling.
Test: (unique & sorted)
$ nm ./hello_world.o | grep " U "
U __aeabi_unwind_cpp_pr1
U chreGetTime
U chreGetVersion
U chreLog
U __stack_chk_fail
U __stack_chk_guard
$ cat additional.txt -n
1 test_symbol
2 test_symbol
$ /PATH/TO/APPS/tools/mksymtab.sh ./hello_world.o MY_PREFIX -a additional.txt
#include <nuttx/compiler.h>
#include <nuttx/symtab.h>
extern void *__aeabi_unwind_cpp_pr1;
extern void *__stack_chk_fail;
extern void *__stack_chk_guard;
extern void *chreGetTime;
extern void *chreGetVersion;
extern void *chreLog;
extern void *test_symbol;
const struct symtab_s MY_PREFIX_exports[] =
{
{"__aeabi_unwind_cpp_pr1", &__aeabi_unwind_cpp_pr1},
{"__stack_chk_fail", &__stack_chk_fail},
{"__stack_chk_guard", &__stack_chk_guard},
{"chreGetTime", &chreGetTime},
{"chreGetVersion", &chreGetVersion},
{"chreLog", &chreLog},
{"test_symbol", &test_symbol},
};
const int MY_PREFIX_nexports = sizeof(MY_PREFIX_exports) / sizeof(struct symtab_s);
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:46:46 +08:00
wangjianyu3
da83fa8ab2
tools/mksymtab.sh: Check sed expression
...
sed: -e expression #1 , char 0: no previous regular expression
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:46:46 +08:00
anjiahao
ddaec5f188
apps/tools/mksymtab.sh:When generating symbols, exclude symbols that dynamic modules in bin/ call each other.
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:46:46 +08:00
Xiang Xiao
0d2ef47192
nshlib: Rename CONFIG_SYSTEM_NSH_SYMTAB to CONFIG_NSH_SYMTAB
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 22:18:38 +02:00
YAMAMOTO Takashi
6a25898568
Revert "tools/mksymtab.sh: Disable the mismatch warning of builtin declaration"
...
This reverts commit a6773a8412 .
Unnecessary after "Use -fno-builtin for SYMTABOBJ"
2022-05-12 23:12:39 +08:00
Xiang Xiao
a6773a8412
tools/mksymtab.sh: Disable the mismatch warning of builtin declaration
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-18 09:04:57 +01:00
baggio63446333
562239ecb2
tools/mksymtab.sh: Fix issue to generate symtab_apps.c for MSYS
...
The file permission is used to get the execlist, but the file permission
cannot be changed for MSYS environment. As a result, symtab_apps.c cannot
be generated correctly. This commit removes the permission match.
2021-10-05 06:23:29 -07:00
Alin Jerpelea
54f47f3168
tools: update licenses to Apache
...
Gregory Nutt is has submitted the SGA
Michal Lyszczek has submitted the ICLA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-06-10 08:49:24 -05:00
liuhaitao
68c89e8485
tools/mksymtab.sh: remove the quotes in varlist entry coming from *-thunk.S
...
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-06-10 21:31:51 +08:00
Xiang Xiao
d03ff1bde6
build: Remove the duplicated mksymtab.sh
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:26:55 -06:00
liuhaitao
994af95576
tools/mksymtab.sh: suppress 'find apps/bin' No such file or directory error msg
...
Suppress apache nightly build find error msg as below:
find: '/home/jenkins/jenkins-slave/workspace/NuttX-Nightly-Build/apps/bin': No such file or directory
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-05-15 07:29:37 -06:00
Xiang Xiao
f074d7f376
Makefile: let install depend on the target binary
...
to ensure the binary get built and install once
2020-03-22 22:42:13 +00:00
Xiang Xiao
41d88f06e7
Run codespell -w with the latest dictonary again
2020-02-23 07:10:14 -06:00
Xiang Xiao
b75e7bc32e
tools/mksymtab.sh: Include nuttx/symtab.h instead of nuttx/binfmt/symtab.h.
2019-10-01 08:04:06 -06:00
Manuel Stühn
88d47e469f
Merged in manuelstuehn/nuttx-apps/feature/bsd-portable (pull request #190 )
...
change all occurences of /bin/(ba)sh to /usr/bin/env bash which appears more portable
Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-10 17:16:33 +00:00
anchao
2771205bc3
apps/tools/mksymtab.sh: 'export LC_ALL=C' to get the traditional sort order
2019-01-27 07:42:49 -06:00
Masayuki Ishikawa
c229c14ded
Merged in masayuki2009/nuttx.apps/fix_mksymtab (pull request #154 )
...
apps/tools: Fix to generate CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME in mksymtab.sh
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: GregoryN <gnutt@nuttx.org>
2018-09-07 11:23:31 +00:00
Gregory Nutt
6f6bc758cc
Application.mk: Add module install logic. Possibly only needed in KERNEL build mode? Makefile: Simplify import target for KERNEL build. A symbol table is not needed because the KERNEL-mode programs are completely linked. Also fix missing deletion in clean and distclean targets. tools/mksymtab.sh: Fix a typo introduced in previous commit.
2018-09-04 16:04:25 -06:00
Gregory Nutt
0d7067936a
Makefile: Fix more places where attempts to use Unix-style paths with native Windows toolchain. tools/mksymtab.sh: Add a check just to prevent 'cat' of an empty file list from failing. Right not the root problem is that the are not executables being built or installed in the exe/ directory. That needs to be done by 'make import' but is not happening.
2018-09-04 11:20:19 -06:00
anchao
b5cfd93444
apps/: Modification to build system: Unified application compilation rules
2018-09-03 09:29:56 -06:00
anchao
220653f21c
Squashed commit of the following:
...
Author: anchao <anchao@pinecone.net>
apps/, most main() function: Correct CONFIG_BUILD_LOADABLE usage
Loadable apps/: Correct loadable symbol table generate
apps/system/ubloxmodem: Fix build break
apps/examples/ostest: start restart/waitpid/user test from main loop
apps/nshlib: Expand reboot and poweroff commands to include a second, optional mode argument
Author: Gregory Nutt <gnutt@nuttx.org>
An attempt to fix build issues. Does not work.
apps/examples/ostest: Fix some inappropriate renaming of static functions introduced with recent patches.
apps/builtin/exec_builtin.c: Fix a error introduced by recent comments. Found in build testing.
Author: anchao <anchao@pinecone.net>
apps/builtin/exec_builtin.c: Try posix_spawn if builtin apps do not have have an entry point.
apps/Application.mk: introduce MODULE config to simplify tristate(m)
apps/nsh: Change the nuttx shell module type to tristate
apps: Add loadable application support
script/mksymtab: Generate symbol table name by default
apps/builtin: Allow loadable applications can register with apps/builtin.
2018-08-23 11:06:15 -06:00
Gregory Nutt
2f982e9c77
Revert "Squashed commit of the following:"
...
This reverts commit 25b92edd9f .
2018-08-22 12:06:32 -06:00
anchao
25b92edd9f
Squashed commit of the following:
...
apps/builtin/exec_builtin.c: Try posix_spawn if builtin apps do not have have an entry point.
apps/Application.mk: introduce MODULE config to simplify tristate(m)
apps/nsh: Change the nuttx shell module type to tristate
apps: Add loadable application support
script/mksymtab: Generate symbol table name by default
apps/builtin: Allow loadable applications can register with apps/builtin.
2018-08-22 09:30:38 -06:00
Masayuki Ishikawa
1030ea7c80
Merged in masayuki2009/nuttx.apps/fix_mksymtab (pull request #147 )
...
apps/tools: Fix an error in mksymtab.sh
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: GregoryN <gnutt@nuttx.org>
2018-07-19 00:31:26 +00:00
Gregory Nutt
cb9e9510d9
apps/Make.defs: Improve the symtab target. tools/mksymtab.sh: Fix a typo.
2018-07-17 11:42:23 -06:00
Gregory Nutt
272bdc0d6e
apps Makesystem: Fix an error when building apps/ withtout nuttx/, using only the NuttX export package only and assuming that the nuttx/ directory in not even present. In this case, the problem fixed where the apps/Make.defs file was selecting tools from the /tools directory which does not exist because TOPDIR=apps/import. Instead, for this build case, I have not thought of any option but to duplicate scripts as necessary in the apps/tools directory. Also added a top-level target to compile the symbol table. Misc fixes: quoting in scripts, some errors in script syntax.
2018-07-17 10:42:15 -06:00
Masayuki Ishikawa
9240ef5536
Merged in masayuki2009/nuttx.apps/fix_symtab_related (pull request #146 )
...
Fix symtab related
* apps/tools: Add +x to mksymtab.sh
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* apps/examples/nsh: Fix compile errors with CONFIG_EXAMPLES_NSH_SYMTAB=y
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: GregoryN <gnutt@nuttx.org>
2018-07-17 03:51:44 +00:00
Gregory Nutt
878fa8afd5
Squashed commit of the following:
...
cosmetic
import/: Add Makefile.symtab which can be used to compile the dynamically created symbol table C file.
Add tools/mksymtab.sh
2018-07-15 11:21:53 -06:00