genode/os/tool/dde_kit_find_initcalls
2011-12-22 16:19:25 +01:00

25 lines
567 B
Bash
Executable File

#!/bin/sh
#
# usage: dde_kit_find_initcalls <list of object files>
#
tempfile="/tmp/dde_kit-$(date +%s)"
nm -C "$@" | grep "dde_kit_initcall_" > $tempfile
sed -i "s/^.* \(dde_kit_initcall_.*\)/\1/" $tempfile
echo "/*"
echo " * Automatically generated by \"os/tool/dde_kit_find_initcalls $@\"."
echo " */"
cat $tempfile | sed "s/\(.*\)/extern int (*\1)(void);/" | sort | uniq
echo
echo "void do_initcalls(void)"
echo "{"
cat $tempfile | sed "s/\(.*\)/ \1();/" | sort | uniq
echo "}"
echo "/*"
echo " * End of automatically generated code."
echo " */"
rm $tempfile