summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-30 09:12:28 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-30 09:12:28 -0400
commitf36625eef934bcee24635ac76a520898881ffb9a (patch)
tree2b81954ef8c21e3fab0de4ede8ba57a373d1da0e
parentcd9dc06d21a57b8632da4d02a9f3c4eb7c8f25dd (diff)
tools: ksyms: Include header guards
This commit makes the output header from tools/ksyms contain header guards Signed-off-by: sigsegv7 <ian@vegaa.systems>
-rwxr-xr-xtools/ksyms5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/ksyms b/tools/ksyms
index c2b9008..643c3e1 100755
--- a/tools/ksyms
+++ b/tools/ksyms
@@ -1,9 +1,12 @@
#!/usr/bin/env bash
rm -f $1
-printf "#include <sys/types.h>\n\nstruct kernel_symbol" > $1
+printf "#ifndef _KSYMS_H_\n" > $1
+printf "#define _KSYMS_H_\n\n" >> $1
+printf "#include <sys/types.h>\n\nstruct kernel_symbol" >> $1
printf " {\n\tuint64_t addr;\n\tchar* name;\n};\n\n" >> $1
printf "const struct kernel_symbol g_ksym_table[] = {\n" >> $1
nm $2 | grep " [tT] " | awk '{ print " { .addr = 0x"$1", .name = \""$3"\" }," }' | sort >> $1
printf " { .addr = (size_t)-1, .name = \"\" }\n};\n\n" >> $1
printf "const int ksym_elem_count = sizeof(g_ksym_table) / sizeof(*g_ksym_table);\n" >> $1
+printf "\n#endif /* !_KSYMS_H_ */\n" >> $1