build: Remove the duplicated mksymtab.sh
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
69f013e74e
commit
d03ff1bde6
2
Makefile
2
Makefile
@ -94,7 +94,7 @@ else
|
||||
|
||||
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
|
||||
$(Q) $(MAKE) install TOPDIR="$(TOPDIR)"
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) $@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
$(SYMTABOBJ): %$(OBJEXT): %.c
|
||||
|
@ -124,7 +124,7 @@ $(DIRLIST_SRC): install
|
||||
# Create the exported symbol table
|
||||
|
||||
$(SYMTAB_SRC): install
|
||||
$(Q) $(TESTS_DIR)/mksymtab.sh $(FSIMG_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSIMG_DIR) g_elf >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Clean each subdirectory
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 <test-dir-path>"
|
||||
|
||||
# Check for the required ROMFS directory path
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract all of the undefined symbols from the ELF files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
varlist=`find ${dir} -type f -perm -a=x | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_elf_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for var in $varlist; do
|
||||
echo " {\"${var}\", &${var}},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo ""
|
||||
echo "const int g_elf_nexports = sizeof(g_elf_exports) / sizeof(struct symtab_s);"
|
@ -107,7 +107,7 @@ endif
|
||||
# Create the exported symbol table
|
||||
|
||||
$(SYMTAB_SRC): install
|
||||
$(Q) $(DRIVER_DIR)/mksymtab.sh $(FSROOT_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSROOT_DIR) g_mod >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Copy the symbol table into the kernel pass1/ build directory
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 <test-dir-path>"
|
||||
|
||||
# Check for the required ROMFS directory path
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract all of the undefined symbols from the MODULE files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
varlist=`find ${dir} -type f -perm -a=x | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_mod_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for var in $varlist; do
|
||||
echo " {\"${var}\", &${var}},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo ""
|
||||
echo "const int g_mod_nexports = sizeof(g_mod_exports) / sizeof(struct symtab_s);"
|
@ -88,7 +88,7 @@ $(DIRLIST_SRC): install
|
||||
# Create the exported symbol table list from the derived *-thunk.S files
|
||||
|
||||
$(SYMTAB_SRC): install
|
||||
$(Q) $(TESTS_DIR)/mksymtab.sh $(ROMFS_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(ROMFS_DIR) g_nxflat >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Clean each subdirectory
|
||||
|
@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 <test-dir-path>"
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_nxflat_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for string in $varlist; do
|
||||
var=`echo $string | sed -e "s/\"//g"`
|
||||
echo " {$string, $var},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo ""
|
||||
echo "const int g_nxflat_nexports = sizeof(g_nxflat_exports) / sizeof(struct symtab_s);"
|
@ -73,7 +73,7 @@ $(ROMFS_SRC): $(ROMFS_IMG)
|
||||
# Create the exported symbol table
|
||||
|
||||
$(SYMTAB_SRC): $(ROMFS_IMG)
|
||||
$(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(ROMFS_DIR) g_spawn >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Clean each subdirectory
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 <test-dir-path>"
|
||||
|
||||
# Check for the required ROMFS directory path
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract all of the undefined symbols from the ELF files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
varlist=`find ${dir} -type f -perm -a=x | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_spawn_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for var in $varlist; do
|
||||
echo " {\"${var}\", &${var}},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo ""
|
||||
echo "const int g_spawn_nexports = sizeof(g_spawn_exports) / sizeof(struct symtab_s);"
|
@ -84,7 +84,7 @@ endif
|
||||
# Create the exported symbol table
|
||||
|
||||
$(SYMTAB_SRC): install
|
||||
$(Q) $(LIB_DIR)/mksymtab.sh $(FSROOT_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(FSROOT_DIR) g_sot | sed "/modprint/d" >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Clean each subdirectory
|
||||
|
@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# set -x
|
||||
|
||||
usage="Usage: $0 <test-dir-path>"
|
||||
|
||||
# Check for the required ROMFS directory path
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract all of the undefined symbols from the SOTEST files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
tmplist=`find ${dir} -type f -perm -a=x | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
|
||||
# Remove the special symbol 'modprint'. It it is not exported by the
|
||||
# base firmware, but rather in this test from one shared library to another.
|
||||
|
||||
varlist=`echo $tmplist | sed -e "s/modprint//g"`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# fail
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_sot_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for var in $varlist; do
|
||||
echo " {\"${var}\", &${var}},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo ""
|
||||
echo "const int g_sot_nexports = sizeof(g_sot_exports) / sizeof(struct symtab_s);"
|
@ -76,7 +76,7 @@ $(ROMFS_SRC): $(ROMFS_IMG)
|
||||
# Create the exported symbol table list from the derived *-thunk.S files
|
||||
|
||||
$(SYMTAB_SRC): install
|
||||
$(Q) $(CONTENT_DIR)/mksymtab.sh $(CONTENT_DIR) >$@.tmp
|
||||
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(CONTENT_DIR) g_thttpd >$@.tmp
|
||||
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
||||
|
||||
# Nothing special needs to be done during the context phase
|
||||
|
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: %0 <test-dir-path>"
|
||||
|
||||
dir=$1
|
||||
if [ -z "$dir" ]; then
|
||||
echo "ERROR: Missing <test-dir-path>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "ERROR: Directory $dir does not exist"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq`
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
# undefined symbols are declared as void* types. If the toolchain does
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "const struct symtab_s g_thttpd_exports[] = "
|
||||
echo "{"
|
||||
|
||||
for string in $varlist; do
|
||||
var=`echo $string | sed -e "s/\"//g"`
|
||||
echo " {$string, $var},"
|
||||
done
|
||||
|
||||
echo "};"
|
||||
echo "const int g_thttpd_nexports = sizeof(g_thttpd_exports) / sizeof(struct symtab_s);"
|
@ -36,7 +36,7 @@
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
usage="Usage: $0 <imagedirpath> <outfilepath>"
|
||||
usage="Usage: $0 <imagedirpath> [symtabprefix]"
|
||||
|
||||
# Check for the required directory path
|
||||
|
||||
@ -48,29 +48,19 @@ if [ -z "$dir" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the output file name
|
||||
# Get the symbol table prefix
|
||||
|
||||
outfile=$2
|
||||
if [ -z "$outfile" ]; then
|
||||
echo "ERROR: Missing <outfilepath>"
|
||||
echo ""
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f $outfile
|
||||
prefix=$2
|
||||
|
||||
# Extract all of the undefined symbols from the ELF files and create a
|
||||
# list of sorted, unique undefined variable names.
|
||||
|
||||
execlist=`find ${dir} -type f 2>/dev/null`
|
||||
if [ ! -z "${execlist}" ]; then
|
||||
for exec in ${execlist}; do
|
||||
nm $exec | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 >>_tmplist
|
||||
done
|
||||
|
||||
varlist=`cat _tmplist | sort - | uniq -`
|
||||
rm -f _tmplist
|
||||
varlist=`find $dir -name *-thunk.S 2>/dev/null | xargs grep -h asciz | cut -f3 | sort | uniq`
|
||||
if [ -z "$varlist" ]; then
|
||||
execlist=`find $dir -type f -perm -a=x 2>/dev/null`
|
||||
if [ ! -z "$execlist" ]; then
|
||||
varlist=`nm $execlist | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now output the symbol table as a structure in a C source file. All
|
||||
@ -78,34 +68,42 @@ fi
|
||||
# any kind of checking for function vs. data objects, then this could
|
||||
# failed
|
||||
|
||||
echo "#include <nuttx/compiler.h>" >$outfile
|
||||
echo "#include <nuttx/symtab.h>" >>$outfile
|
||||
echo "" >>$outfile
|
||||
echo "#include <nuttx/compiler.h>"
|
||||
echo "#include <nuttx/symtab.h>"
|
||||
echo ""
|
||||
|
||||
for var in $varlist; do
|
||||
echo "extern void *${var};" >>$outfile
|
||||
echo "extern void *${var};"
|
||||
done
|
||||
|
||||
echo "" >>$outfile
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)" >>$outfile
|
||||
echo "const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] = " >>$outfile
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)" >>$outfile
|
||||
echo "const struct symtab_s CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME[] = " >>$outfile
|
||||
echo "#else" >>$outfile
|
||||
echo "const struct symtab_s dummy_symtab[] = " >>$outfile
|
||||
echo "#endif" >>$outfile
|
||||
echo "{" >>$outfile
|
||||
echo ""
|
||||
if [ -z "$prefix" ]; then
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)"
|
||||
echo "const struct symtab_s CONFIG_EXECFUNCS_SYMTAB_ARRAY[] = "
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)"
|
||||
echo "const struct symtab_s CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME[] = "
|
||||
echo "#else"
|
||||
echo "const struct symtab_s dummy_symtab[] = "
|
||||
echo "#endif"
|
||||
else
|
||||
echo "const struct symtab_s ${prefix}_exports[] = "
|
||||
fi
|
||||
echo "{"
|
||||
|
||||
for var in $varlist; do
|
||||
echo " {\"${var}\", &${var}}," >>$outfile
|
||||
echo " {\"${var}\", &${var}},"
|
||||
done
|
||||
|
||||
echo "};" >>$outfile
|
||||
echo "" >>$outfile
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)" >>$outfile
|
||||
echo "const int CONFIG_EXECFUNCS_NSYMBOLS_VAR = sizeof(CONFIG_EXECFUNCS_SYMTAB_ARRAY) / sizeof(struct symtab_s);" >>$outfile
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)" >>$outfile
|
||||
echo "const int CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME = sizeof(CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME) / sizeof(struct symtab_s);" >>$outfile
|
||||
echo "#else" >>$outfile
|
||||
echo "const int dummy_nsymtabs = sizeof(dummy_symtab) / sizeof(struct symtab_s);" >>$outfile
|
||||
echo "#endif" >>$outfile
|
||||
echo "};"
|
||||
echo ""
|
||||
if [ -z "$prefix" ]; then
|
||||
echo "#if defined(CONFIG_EXECFUNCS_HAVE_SYMTAB)"
|
||||
echo "const int CONFIG_EXECFUNCS_NSYMBOLS_VAR = sizeof(CONFIG_EXECFUNCS_SYMTAB_ARRAY) / sizeof(struct symtab_s);"
|
||||
echo "#elif defined(CONFIG_SYSTEM_NSH_SYMTAB)"
|
||||
echo "const int CONFIG_SYSTEM_NSH_SYMTAB_COUNTNAME = sizeof(CONFIG_SYSTEM_NSH_SYMTAB_ARRAYNAME) / sizeof(struct symtab_s);"
|
||||
echo "#else"
|
||||
echo "const int dummy_nsymtabs = sizeof(dummy_symtab) / sizeof(struct symtab_s);"
|
||||
echo "#endif"
|
||||
else
|
||||
echo "const int ${prefix}_nexports = sizeof(${prefix}_exports) / sizeof(struct symtab_s);"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user