incubator-nuttx/tools
yinshengkai 97096bed83 libs: fix the problem that the address obtained in thumb mode cannot be executed.
The lowest bit of the thumb instruction is 1 by default, which is used to distinguish arm instructions and thumb instructions.
Fixed the problem of misalignment of symbol table when performing binary search

In arm, the lowest bit of the instruction is 1, which is a thumb instruction, and 0, which is an arm instruction.
The nm command was used in mkallsym.sh before, and the result it will return will set the lowest bit of the thumb instruction to 0. There will be a one-byte deviation during binary search, so mkallsyms.py will also set the lowest bit to 0 according to the previous format.
```sh
arm-none-eabi-nm -Cn nuttx | grep hello
0801c384 T hello_main
arm-none-eabi-objdump nuttx -t |grep hello
0801c384 g F .text 0000004c hello_main
arm-none-eabi-readelf nuttx -s |grep hello
4558: 0801c385 76 FUNC GLOBAL DEFAULT 1 hello_main
```

However, in the following case, when you need to find the function address according to the symbol name and execute the corresponding function, the lowest address obtained is 0. It will follow the arm instruction, causing an exception.
```c
void sym_test(void)
{
   printf("call sym_test\n");
}

int main(int argc, FAR char *argv[])
{
   FAR void *addr = sym_test;
   printf("sym_test:%p %pS\n",addr, addr);
   printf("sym_test - 1: %pS\n", (char *)addr - 1);
   printf("sym_test + 1: %pS\n", (char *)addr + 1);

   size_t size;
   void (*func)(void);
   const struct symtab_s *sym = allsyms_findbyname("sym_test", &size);
   printf("sym_test:%p %pS\n",sym, sym);
   func = sym->sym_value;
   func();

   return 0;
}
```

Therefore, you need to change mkallsyms.py back to the correct result and correct the binary search.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-01-04 09:22:57 -08:00
..
bl602
ci tools/ci:enable arm64 CMake ci build 2023-12-27 07:27:17 -08:00
cxd56 mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
esp32 xtensa/esp32: Add support for Protected Mode 2022-07-14 14:57:57 +08:00
esp32c3
esp32c6 risc-v/esp32c6: Add ESP32-C6 basic support 2023-02-10 17:38:41 -03:00
esp32s2
esp32s3 esp32s3: Enhance protected build linker scripts and memory layout 2023-08-02 21:38:44 +02:00
espressif arch/espressif: Add MCUboot support for ESP32-C3 2023-08-04 10:30:57 -07:00
gdb tcbinfo:remove total_num form tcbinfo. 2023-11-21 21:52:24 -08:00
licensing Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00
lwl Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00
mpfs mpfs: Remove the ddrstorage section from the OpenSBI package 2022-08-10 10:01:47 +03:00
pic32 tools: Fix an error of make -C tools -f Makefile.host clean 2022-11-09 13:50:15 +08:00
rp2040 nuttx: Use MIN/MAX definitions from "sys/param.h" 2023-02-01 23:47:44 +08:00
simwifi simwifi: host wlan0 obtains ip and set dns for wlan0 in the defwan wlan0 2023-10-27 22:28:01 +08:00
zds
.gitignore build: add initial cmake build system 2023-07-08 13:50:48 +08:00
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Config.mk tool/Config.mk:use bash with or without verbosity enabled 2023-12-21 03:45:52 -08:00
Directories.mk libc: Move math library from libs/libc/math to libs/libm/libm 2023-02-23 10:40:07 +02:00
Export.mk tools/export: Add LDELFFLAGS to mkexport.sh. 2023-03-24 15:02:59 -03:00
FlatLibs.mk libc: Move math library from libs/libc/math to libs/libm/libm 2023-02-23 10:40:07 +02:00
KernelLibs.mk libc: Move math library from libs/libc/math to libs/libm/libm 2023-02-23 10:40:07 +02:00
LibTargets.mk libc: Move math library from libs/libc/math to libs/libm/libm 2023-02-23 10:40:07 +02:00
Makefile.host Added -fPIC option when building jlink-nuttx.so. 2022-06-29 13:16:54 +03:00
ProtectedLibs.mk libc: Move math library from libs/libc/math to libs/libm/libm 2023-02-23 10:40:07 +02:00
Rust.defs tools: Move Rust relative settings to Rust.defs 2023-04-01 16:45:11 +03:00
Unix.mk tools/Unix.mk:change `incdir` to a Make target 2023-12-28 10:56:01 -08:00
Win.mk tools/Unix.mk:change `incdir` to a Make target 2023-12-28 10:56:01 -08:00
Zig.defs tools/Zig: Simplify compile flags handling 2023-03-31 16:55:15 -03:00
b16.c tools/b16.c: Fix usage text 2022-09-13 14:53:42 +08:00
bdf-converter.c
build-globals.sh Fix loading of ET_DYN type of shared objects 2023-09-20 09:35:28 -04:00
callstack.py tools: Add script to parse callstack 2023-06-27 10:10:12 -03:00
cfgdefine.c tools/cfgdefine.c: Resolve compile warning array subscript has type ‘char’ 2023-10-26 00:10:57 +08:00
cfgdefine.h
cfgparser.c mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
cfgparser.h
checkpatch.sh tools: checkpach supports python files 2023-09-12 16:25:45 +08:00
checkrelease.sh Remove incubat.* from the code base 2022-12-13 21:21:27 +02:00
cmpconfig.c
cnvwindeps.c
configure.bat Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00
configure.c tools/Unix.mk:Security Checks and Windows Native Compilation Enhancements 2023-12-04 07:07:08 -08:00
configure.sh sh:Enhanced compilation system 2023-12-04 07:07:08 -08:00
configure_completion.bash
convert-comments.c
copydir.bat
copydir.sh
coredump.py tools/coredump: add coredump python parser 2023-05-25 20:42:04 +08:00
csvparser.c
csvparser.h
define.bat tools/define.bat: sync design of define.bat with define.sh to uniform usage 2022-12-03 19:22:17 +08:00
define.sh
detab.c
discover.py Updated python scripts interpreter invocation in `tools/`. 2023-02-19 14:15:27 +08:00
flash_writer.py
gcov.sh
gencromfs.c Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
ide_exporter.py Updated python scripts interpreter invocation in `tools/`. 2023-02-19 14:15:27 +08:00
incdir.bat tools/incdir.bat 2022-11-09 01:38:12 +08:00
incdir.c mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
incdir.sh
indent.sh
initialconfig.c
jlink-nuttx.c tcbinfo:remove total_num form tcbinfo. 2023-11-21 21:52:24 -08:00
kconfig.bat
kconfig2html.c Update kconfig2html.c 2023-12-14 20:02:52 -08:00
link.bat
link.sh
lowhex.c
macar-qcs.sh change Mac sim archive operate from replace to quick insertion 2023-09-12 16:15:19 +03:00
merge_config.py tools: add support for merge_config 2023-09-14 14:33:30 +08:00
minidumpserver.py tools/minudumpserver: support auto start GDB and execute some commands 2023-09-23 15:19:20 +08:00
mkallsyms.py libs: fix the problem that the address obtained in thumb mode cannot be executed. 2024-01-04 09:22:57 -08:00
mkallsyms.sh
mkconfig.c
mkconfigvars.sh
mkctags.sh
mkdeps.c tools/mkdeps: increase MAX_BUFFER/MAX_EXPAND/MAX_SHQUOTE to 16384 2023-09-09 00:47:59 +08:00
mkexport.sh tools/mkexport: copy full library directly if library without path 2023-09-08 22:52:35 +08:00
mkfsdata.pl
mknulldeps.sh
mkromfsimg.sh
mksymtab.c tools/mksymtab: Fix a compilation warning 2023-04-23 12:22:19 +08:00
mksyscall.c tools/syscall: Resolve compile time warning on address validation. 2023-06-28 08:47:07 +08:00
mkversion.c
mkwindeps.sh
netusb.sh script: support IPv6 in simhostroute.sh 2023-01-05 23:36:43 +08:00
noteinfo.c
nxstyle.c Update kconfig2html.c 2023-12-14 20:02:52 -08:00
parsecallstack.py Updated python scripts interpreter invocation in `tools/`. 2023-02-19 14:15:27 +08:00
parsememdump.py parsememdump.py: support the sequence number parse 2023-09-23 15:13:00 +08:00
parsetrace.py tools/prasetrace: remvoe function name filter 2023-09-08 15:37:55 +03:00
pre-commit tools: add git pre-commit hook based on checkpatch.sh 2023-05-03 14:42:34 +02:00
process_config.sh tools: defconfig supports the include command 2023-09-14 14:33:30 +08:00
refresh.sh sh:Enhanced compilation system 2023-12-04 07:07:08 -08:00
rmcr.c
sethost.sh Add CONFIG_EXPERIMENTAL for configure windows native 2023-10-31 09:03:02 +08:00
showsize.sh
showstack.sh tools/showstack: add configurable rank parameters 2023-09-12 16:23:20 +08:00
simbridge.sh
simhostroute.sh script: support IPv6 in simhostroute.sh 2023-01-05 23:36:43 +08:00
size_report.py fix: TreeNode has same attribute with NodeMixin 2023-10-09 17:51:01 -04:00
stm32_pinmap_tool.py tools:Add STM32 Pin migration tool 2023-04-19 09:58:11 +02:00
testbuild.sh tools/testbuild: restore the original toolchain configuration before refresh 2023-07-20 09:09:32 +02:00
toolchain.cmake.export Do not let CMake check the compiler with en executable as the entry point is not always main() 2023-09-12 01:17:30 +08:00
uncrustify.cfg
unlink.bat
unlink.sh
version.sh tools/version: generate dummy version without breakout 2023-01-28 12:10:15 -03:00
xmlrpc_test.py Updated python scripts interpreter invocation in `tools/`. 2023-02-19 14:15:27 +08:00
zipme.sh tools: zipme: remove incubator from releases 2022-12-13 17:19:06 +08:00