From 99ba405535adea6327bf1e326ab1733649e1f85d Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 9 Mar 2022 00:50:52 +0800 Subject: [PATCH] tools/mkallsyms: add support to generate the symbol table without const Signed-off-by: chao.an --- tools/mkallsyms.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/mkallsyms.sh b/tools/mkallsyms.sh index 8cc313885e..10921f34ea 100755 --- a/tools/mkallsyms.sh +++ b/tools/mkallsyms.sh @@ -21,7 +21,7 @@ export LC_ALL=C -usage="Usage: $0 " +usage="Usage: $0 [noconst] " # Get the symbol table @@ -33,6 +33,12 @@ usage="Usage: $0 " # any kind of checking for function vs. data objects, then this could # failed +CONST=const +if [ $1 == 'noconst' ]; then + CONST= + shift +fi + nm="${2}nm" filt="${2}c++filt" if [ -f "${1}" ];then @@ -48,24 +54,24 @@ echo "#if defined(__GNUC__) && !defined(__clang__)" echo "# pragma GCC diagnostic ignored \"-Wbuiltin-declaration-mismatch\"" echo "#endif" echo "" -echo "const int g_nallsyms = ${count} + 2;" -echo "const struct symtab_s g_allsyms[${count} + 2] = " +echo "${CONST} int g_nallsyms = ${count} + 2;" +echo "${CONST} struct symtab_s g_allsyms[${count} + 2] = " echo "{" # Add start address boundary -echo " { \"Unknown\", (FAR const void *)0x00000000 }," +echo " { \"Unknown\", (FAR ${CONST} void *)0x00000000 }," if [ -f "${1}" ];then ${nm} -n ${1} | grep -E " [T|t] " | uniq | \ while read addr type name do - echo " { \"`${filt} -p $name`\", (FAR const void *)0x$addr }," + echo " { \"`${filt} -p $name`\", (FAR ${CONST} void *)0x$addr }," done fi # Add end address boundary -echo " { \"Unknown\", (FAR const void *)0xffffffff }," +echo " { \"Unknown\", (FAR ${CONST} void *)0xffffffff }," echo "};"