You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/03/09 08:17:55 UTC

[incubator-nuttx] 02/03: tools/mkallsyms: add support to generate the symbol table without const

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 99ba405535adea6327bf1e326ab1733649e1f85d
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Mar 9 00:50:52 2022 +0800

    tools/mkallsyms: add support to generate the symbol table without const
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 tools/mkallsyms.sh | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/tools/mkallsyms.sh b/tools/mkallsyms.sh
index 8cc3138..10921f3 100755
--- a/tools/mkallsyms.sh
+++ b/tools/mkallsyms.sh
@@ -21,7 +21,7 @@
 
 export LC_ALL=C
 
-usage="Usage: $0 <ELFBIN> <CROSSDEV>"
+usage="Usage: $0 [noconst] <ELFBIN> <CROSSDEV>"
 
 # Get the symbol table
 
@@ -33,6 +33,12 @@ usage="Usage: $0 <ELFBIN> <CROSSDEV>"
 # 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 "};"