ref: c7b87cd259f6acdfb2e312ca20f0b78fa3821119
parent: 1c96e3985e0fab5b288830deb44054bd3e5f0590
parent: 6f00a46d44d7440bb1f45886135af939d0aeec81
author: Johann <[email protected]>
date: Mon Jan 27 07:13:59 EST 2014
Merge "Ouput symbols as c header file."
--- a/build/make/obj_int_extract.c
+++ b/build/make/obj_int_extract.c
@@ -21,6 +21,7 @@
OUTPUT_FMT_PLAIN,
OUTPUT_FMT_RVDS,
OUTPUT_FMT_GAS,
+ OUTPUT_FMT_C_HEADER,
} output_fmt_t;
int log_msg(const char *fmt, ...) {
@@ -46,6 +47,9 @@
case OUTPUT_FMT_GAS:
printf(".set %-40s, %5d\n", name, val);
return 0;
+ case OUTPUT_C_HEADER:
+ printf("#define %-40s %5d\n", name, val);
+ return 0;
default:
log_msg("Unsupported mode: %d", mode);
return 1;
@@ -491,6 +495,13 @@
sym.st_name),
val);
break;
+ case OUTPUT_FMT_C_HEADER:
+ printf("#define %-40s %5d\n",
+ parse_elf_string_table(&elf,
+ shdr.sh_link,
+ sym.st_name),
+ val);
+ break;
default:
printf("%s = %d\n",
parse_elf_string_table(&elf,
@@ -762,6 +773,7 @@
fprintf(stderr, "Output Formats:\n");
fprintf(stderr, " gas - compatible with GNU assembler\n");
fprintf(stderr, " rvds - compatible with armasm\n");
+ fprintf(stderr, " cheader - c/c++ header file\n");
goto bail;
}
@@ -771,6 +783,8 @@
mode = OUTPUT_FMT_RVDS;
else if (!strcmp(argv[1], "gas"))
mode = OUTPUT_FMT_GAS;
+ else if (!strcmp(argv[1], "cheader"))
+ mode = OUTPUT_FMT_C_HEADER;
else
f = argv[1];