kallsyms does not consider SYMBOL_PREFIX of C.
Consequently do not work in architecture using prefix character (h8300, v850) really.
Because I can want to use this, I made a patch.
Please comment.
[...]
@@ -177,6 +184,11 @@
"_SDA2_BASE_", /* ppc */
NULL };
int i;
+ int offset = 1;
+
+ /* skip prefix char */
+ if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char)
+ offset++;
/* if --all-symbols is not specified, then symbols outside the text
* and inittext sections are discarded */
@@ -190,17 +202,17 @@
* they may get dropped in pass 2, which breaks the kallsyms
* rules.
*/
- if ((s->addr == _etext && strcmp(s->sym + 1, "_etext")) ||
- (s->addr == _einittext && strcmp(s->sym + 1, "_einittext")))
+ if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) ||
+ (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")))
return 0;
}
/* Exclude symbols which vary between passes. */
- if (strstr(s->sym + 1, "_compiled."))
+ if (strstr(s->sym + offset, "_compiled."))
return 0;
for (i = 0; special_symbols[i]; i++)
- if( strcmp(s->sym + 1, special_symbols[i]) == 0 )
+ if( strcmp(s->sym + offset, special_symbols[i]) == 0 )
return 0;
return 1;
@@ -225,9 +237,15 @@
[...]
/* uncompress a compressed symbol. When this function is called, the best table
@@ -665,6 +683,13 @@
insert_real_symbols_in_table();
+ /* When valid symbol is not registered, exit to error */
+ if (good_head.left == good_head.right &&
+ bad_head.left == bad_head.right) {
+ fprintf(stderr, "No valid symbol.\n");
+ exit(1);
+ }
+
optimize_result();
}
@@ -672,9 +697,21 @@
int
main(int argc, char **argv)
{
- if (argc == 2 && strcmp(argv[1], "--all-symbols") == 0)
- all_symbols = 1;
- else if (argc != 1)
+ if (argc >= 2) {
+ int i;
+ for (i = 1; i < argc; i++) { + if(strcmp(argv[i], "--all-symbols") == 0)
+ all_symbols = 1;
+ else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) {
+ char *p = &argv[i][16];
+ /* skip quote */
+ if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
+ p++;
+ symbol_prefix_char = *p;
+ } else
+ usage();
+ }
+ } else if (argc != 1)
usage();
read_map(stdin);
@@ -683,4 +720,3 @@
return 0;
}