Commit 534c9f2e authored by Masahiro Yamada's avatar Masahiro Yamada

kallsyms: remove symbol prefix support

CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX was selected by BLACKFIN, METAG.
They were removed by commit 4ba66a97 ("arch: remove blackfin port"),
commit bb6fb6df ("metag: Remove arch/metag/"), respectively.

No more architecture enables CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX,
hence the --symbol-prefix option is unnecessary.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 74d93171
...@@ -62,7 +62,6 @@ static struct sym_entry *table; ...@@ -62,7 +62,6 @@ static struct sym_entry *table;
static unsigned int table_size, table_cnt; static unsigned int table_size, table_cnt;
static int all_symbols = 0; static int all_symbols = 0;
static int absolute_percpu = 0; static int absolute_percpu = 0;
static char symbol_prefix_char = '\0';
static int base_relative = 0; static int base_relative = 0;
int token_profit[0x10000]; int token_profit[0x10000];
...@@ -75,7 +74,6 @@ unsigned char best_table_len[256]; ...@@ -75,7 +74,6 @@ unsigned char best_table_len[256];
static void usage(void) static void usage(void)
{ {
fprintf(stderr, "Usage: kallsyms [--all-symbols] " fprintf(stderr, "Usage: kallsyms [--all-symbols] "
"[--symbol-prefix=<prefix char>] "
"[--base-relative] < in.map > out.S\n"); "[--base-relative] < in.map > out.S\n");
exit(1); exit(1);
} }
...@@ -113,28 +111,22 @@ static int check_symbol_range(const char *sym, unsigned long long addr, ...@@ -113,28 +111,22 @@ static int check_symbol_range(const char *sym, unsigned long long addr,
static int read_symbol(FILE *in, struct sym_entry *s) static int read_symbol(FILE *in, struct sym_entry *s)
{ {
char str[500]; char sym[500], stype;
char *sym, stype;
int rc; int rc;
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, sym);
if (rc != 3) { if (rc != 3) {
if (rc != EOF && fgets(str, 500, in) == NULL) if (rc != EOF && fgets(sym, 500, in) == NULL)
fprintf(stderr, "Read error or end of file.\n"); fprintf(stderr, "Read error or end of file.\n");
return -1; return -1;
} }
if (strlen(str) > KSYM_NAME_LEN) { if (strlen(sym) > KSYM_NAME_LEN) {
fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n"
"Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
str, strlen(str), KSYM_NAME_LEN); sym, strlen(sym), KSYM_NAME_LEN);
return -1; return -1;
} }
sym = str;
/* skip prefix char */
if (symbol_prefix_char && str[0] == symbol_prefix_char)
sym++;
/* Ignore most absolute/undefined (?) symbols. */ /* Ignore most absolute/undefined (?) symbols. */
if (strcmp(sym, "_text") == 0) if (strcmp(sym, "_text") == 0)
_text = s->addr; _text = s->addr;
...@@ -155,7 +147,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) ...@@ -155,7 +147,7 @@ static int read_symbol(FILE *in, struct sym_entry *s)
is_arm_mapping_symbol(sym)) is_arm_mapping_symbol(sym))
return -1; return -1;
/* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
else if (str[0] == '$') else if (sym[0] == '$')
return -1; return -1;
/* exclude debugging symbols */ /* exclude debugging symbols */
else if (stype == 'N' || stype == 'n') else if (stype == 'N' || stype == 'n')
...@@ -163,14 +155,14 @@ static int read_symbol(FILE *in, struct sym_entry *s) ...@@ -163,14 +155,14 @@ static int read_symbol(FILE *in, struct sym_entry *s)
/* include the type field in the symbol name, so that it gets /* include the type field in the symbol name, so that it gets
* compressed together */ * compressed together */
s->len = strlen(str) + 1; s->len = strlen(sym) + 1;
s->sym = malloc(s->len + 1); s->sym = malloc(s->len + 1);
if (!s->sym) { if (!s->sym) {
fprintf(stderr, "kallsyms failure: " fprintf(stderr, "kallsyms failure: "
"unable to allocate required amount of memory\n"); "unable to allocate required amount of memory\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
strcpy((char *)s->sym + 1, str); strcpy((char *)s->sym + 1, sym);
s->sym[0] = stype; s->sym[0] = stype;
s->percpu_absolute = 0; s->percpu_absolute = 0;
...@@ -233,11 +225,6 @@ static int symbol_valid(struct sym_entry *s) ...@@ -233,11 +225,6 @@ static int symbol_valid(struct sym_entry *s)
int i; int i;
char *sym_name = (char *)s->sym + 1; char *sym_name = (char *)s->sym + 1;
/* skip prefix char */
if (symbol_prefix_char && *sym_name == symbol_prefix_char)
sym_name++;
/* if --all-symbols is not specified, then symbols outside the text /* if --all-symbols is not specified, then symbols outside the text
* and inittext sections are discarded */ * and inittext sections are discarded */
if (!all_symbols) { if (!all_symbols) {
...@@ -302,15 +289,9 @@ static void read_map(FILE *in) ...@@ -302,15 +289,9 @@ static void read_map(FILE *in)
static void output_label(char *label) static void output_label(char *label)
{ {
if (symbol_prefix_char) printf(".globl %s\n", label);
printf(".globl %c%s\n", symbol_prefix_char, label);
else
printf(".globl %s\n", label);
printf("\tALGN\n"); printf("\tALGN\n");
if (symbol_prefix_char) printf("%s:\n", label);
printf("%c%s:\n", symbol_prefix_char, label);
else
printf("%s:\n", label);
} }
/* uncompress a compressed symbol. When this function is called, the best table /* uncompress a compressed symbol. When this function is called, the best table
...@@ -768,13 +749,7 @@ int main(int argc, char **argv) ...@@ -768,13 +749,7 @@ int main(int argc, char **argv)
all_symbols = 1; all_symbols = 1;
else if (strcmp(argv[i], "--absolute-percpu") == 0) else if (strcmp(argv[i], "--absolute-percpu") == 0)
absolute_percpu = 1; absolute_percpu = 1;
else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) { else if (strcmp(argv[i], "--base-relative") == 0)
char *p = &argv[i][16];
/* skip quote */
if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
p++;
symbol_prefix_char = *p;
} else if (strcmp(argv[i], "--base-relative") == 0)
base_relative = 1; base_relative = 1;
else else
usage(); usage();
......
...@@ -121,10 +121,6 @@ kallsyms() ...@@ -121,10 +121,6 @@ kallsyms()
info KSYM ${2} info KSYM ${2}
local kallsymopt; local kallsymopt;
if [ -n "${CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX}" ]; then
kallsymopt="${kallsymopt} --symbol-prefix=_"
fi
if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
kallsymopt="${kallsymopt} --all-symbols" kallsymopt="${kallsymopt} --all-symbols"
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment