Skip to content

New features for tools/mksymtab.sh#2581

Merged
xiaoxiang781216 merged 4 commits intoapache:masterfrom
JianyuWang0623:br_wjy_mksymtab_related_0917
Sep 18, 2024
Merged

New features for tools/mksymtab.sh#2581
xiaoxiang781216 merged 4 commits intoapache:masterfrom
JianyuWang0623:br_wjy_mksymtab_related_0917

Conversation

@JianyuWang0623
Copy link
Contributor

Summary

  • Exclude symbols that dynamic modules in bin/ call each other. - be3a91e (by @anjiahao1 )
    • Bugfix: Add check for sed expression. - 1973f15
  • Support adding additional symbols that are not in undefined list. - b4d995f
    • For apps to be built in the future, the required symbols may not be included in the symbol table, and you will need to rebuild the NuttX kernel to run it.
    • With this patch, you can add symbols may be used in the future manually to the symbol table.
    • Extended usage: - e3844a1
      • The lines start with "," make no effects(as comments)
      • Support symbol name overriding
    • See commit message for more details.

Impact

Build scripts that using mksymtab.sh to generate symbol tables.

Testing

$ 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);
$ cat exports.txt | grep atan2
atan2Override,atan2

$ /PATH/TO/APPS/tools/mksymtab.sh FOO BAR exports.txt | grep atan2
extern void *atan2Override;
{"atan2", &atan2Override},

anjiahao1 and others added 4 commits September 17, 2024 21:55
…dynamic modules in bin/ call each other.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
sed: -e expression apache#1, char 0: no previous regular expression

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
…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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants