diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-09 03:23:47 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-17 09:43:36 -0400 |
commit | 534c9f2ec4c92adbe8791125e7ba66d5023ad51f (patch) | |
tree | 1ba11a01c87ac3de0885391cfca63e6b9967af3c /scripts | |
parent | 74d9317161513b63ccb2f58eb866d6e91e13df98 (diff) |
kallsyms: remove symbol prefix support
CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX was selected by BLACKFIN, METAG.
They were removed by commit 4ba66a976072 ("arch: remove blackfin port"),
commit bb6fb6dfcc17 ("metag: Remove arch/metag/"), respectively.
No more architecture enables CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX,
hence the --symbol-prefix option is unnecessary.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kallsyms.c | 47 | ||||
-rwxr-xr-x | scripts/link-vmlinux.sh | 4 |
2 files changed, 11 insertions, 40 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 5abfbf1b8fe2..80417629b246 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -62,7 +62,6 @@ static struct sym_entry *table; | |||
62 | static unsigned int table_size, table_cnt; | 62 | static unsigned int table_size, table_cnt; |
63 | static int all_symbols = 0; | 63 | static int all_symbols = 0; |
64 | static int absolute_percpu = 0; | 64 | static int absolute_percpu = 0; |
65 | static char symbol_prefix_char = '\0'; | ||
66 | static int base_relative = 0; | 65 | static int base_relative = 0; |
67 | 66 | ||
68 | int token_profit[0x10000]; | 67 | int token_profit[0x10000]; |
@@ -75,7 +74,6 @@ unsigned char best_table_len[256]; | |||
75 | static void usage(void) | 74 | static void usage(void) |
76 | { | 75 | { |
77 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " | 76 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " |
78 | "[--symbol-prefix=<prefix char>] " | ||
79 | "[--base-relative] < in.map > out.S\n"); | 77 | "[--base-relative] < in.map > out.S\n"); |
80 | exit(1); | 78 | exit(1); |
81 | } | 79 | } |
@@ -113,28 +111,22 @@ static int check_symbol_range(const char *sym, unsigned long long addr, | |||
113 | 111 | ||
114 | static int read_symbol(FILE *in, struct sym_entry *s) | 112 | static int read_symbol(FILE *in, struct sym_entry *s) |
115 | { | 113 | { |
116 | char str[500]; | 114 | char sym[500], stype; |
117 | char *sym, stype; | ||
118 | int rc; | 115 | int rc; |
119 | 116 | ||
120 | rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); | 117 | rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, sym); |
121 | if (rc != 3) { | 118 | if (rc != 3) { |
122 | if (rc != EOF && fgets(str, 500, in) == NULL) | 119 | if (rc != EOF && fgets(sym, 500, in) == NULL) |
123 | fprintf(stderr, "Read error or end of file.\n"); | 120 | fprintf(stderr, "Read error or end of file.\n"); |
124 | return -1; | 121 | return -1; |
125 | } | 122 | } |
126 | if (strlen(str) > KSYM_NAME_LEN) { | 123 | if (strlen(sym) > KSYM_NAME_LEN) { |
127 | fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" | 124 | fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" |
128 | "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", | 125 | "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", |
129 | str, strlen(str), KSYM_NAME_LEN); | 126 | sym, strlen(sym), KSYM_NAME_LEN); |
130 | return -1; | 127 | return -1; |
131 | } | 128 | } |
132 | 129 | ||
133 | sym = str; | ||
134 | /* skip prefix char */ | ||
135 | if (symbol_prefix_char && str[0] == symbol_prefix_char) | ||
136 | sym++; | ||
137 | |||
138 | /* Ignore most absolute/undefined (?) symbols. */ | 130 | /* Ignore most absolute/undefined (?) symbols. */ |
139 | if (strcmp(sym, "_text") == 0) | 131 | if (strcmp(sym, "_text") == 0) |
140 | _text = s->addr; | 132 | _text = s->addr; |
@@ -155,7 +147,7 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
155 | is_arm_mapping_symbol(sym)) | 147 | is_arm_mapping_symbol(sym)) |
156 | return -1; | 148 | return -1; |
157 | /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ | 149 | /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ |
158 | else if (str[0] == '$') | 150 | else if (sym[0] == '$') |
159 | return -1; | 151 | return -1; |
160 | /* exclude debugging symbols */ | 152 | /* exclude debugging symbols */ |
161 | else if (stype == 'N' || stype == 'n') | 153 | else if (stype == 'N' || stype == 'n') |
@@ -163,14 +155,14 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
163 | 155 | ||
164 | /* include the type field in the symbol name, so that it gets | 156 | /* include the type field in the symbol name, so that it gets |
165 | * compressed together */ | 157 | * compressed together */ |
166 | s->len = strlen(str) + 1; | 158 | s->len = strlen(sym) + 1; |
167 | s->sym = malloc(s->len + 1); | 159 | s->sym = malloc(s->len + 1); |
168 | if (!s->sym) { | 160 | if (!s->sym) { |
169 | fprintf(stderr, "kallsyms failure: " | 161 | fprintf(stderr, "kallsyms failure: " |
170 | "unable to allocate required amount of memory\n"); | 162 | "unable to allocate required amount of memory\n"); |
171 | exit(EXIT_FAILURE); | 163 | exit(EXIT_FAILURE); |
172 | } | 164 | } |
173 | strcpy((char *)s->sym + 1, str); | 165 | strcpy((char *)s->sym + 1, sym); |
174 | s->sym[0] = stype; | 166 | s->sym[0] = stype; |
175 | 167 | ||
176 | s->percpu_absolute = 0; | 168 | s->percpu_absolute = 0; |
@@ -233,11 +225,6 @@ static int symbol_valid(struct sym_entry *s) | |||
233 | int i; | 225 | int i; |
234 | char *sym_name = (char *)s->sym + 1; | 226 | char *sym_name = (char *)s->sym + 1; |
235 | 227 | ||
236 | /* skip prefix char */ | ||
237 | if (symbol_prefix_char && *sym_name == symbol_prefix_char) | ||
238 | sym_name++; | ||
239 | |||
240 | |||
241 | /* if --all-symbols is not specified, then symbols outside the text | 228 | /* if --all-symbols is not specified, then symbols outside the text |
242 | * and inittext sections are discarded */ | 229 | * and inittext sections are discarded */ |
243 | if (!all_symbols) { | 230 | if (!all_symbols) { |
@@ -302,15 +289,9 @@ static void read_map(FILE *in) | |||
302 | 289 | ||
303 | static void output_label(char *label) | 290 | static void output_label(char *label) |
304 | { | 291 | { |
305 | if (symbol_prefix_char) | 292 | printf(".globl %s\n", label); |
306 | printf(".globl %c%s\n", symbol_prefix_char, label); | ||
307 | else | ||
308 | printf(".globl %s\n", label); | ||
309 | printf("\tALGN\n"); | 293 | printf("\tALGN\n"); |
310 | if (symbol_prefix_char) | 294 | printf("%s:\n", label); |
311 | printf("%c%s:\n", symbol_prefix_char, label); | ||
312 | else | ||
313 | printf("%s:\n", label); | ||
314 | } | 295 | } |
315 | 296 | ||
316 | /* uncompress a compressed symbol. When this function is called, the best table | 297 | /* uncompress a compressed symbol. When this function is called, the best table |
@@ -768,13 +749,7 @@ int main(int argc, char **argv) | |||
768 | all_symbols = 1; | 749 | all_symbols = 1; |
769 | else if (strcmp(argv[i], "--absolute-percpu") == 0) | 750 | else if (strcmp(argv[i], "--absolute-percpu") == 0) |
770 | absolute_percpu = 1; | 751 | absolute_percpu = 1; |
771 | else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) { | 752 | else if (strcmp(argv[i], "--base-relative") == 0) |
772 | char *p = &argv[i][16]; | ||
773 | /* skip quote */ | ||
774 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) | ||
775 | p++; | ||
776 | symbol_prefix_char = *p; | ||
777 | } else if (strcmp(argv[i], "--base-relative") == 0) | ||
778 | base_relative = 1; | 753 | base_relative = 1; |
779 | else | 754 | else |
780 | usage(); | 755 | usage(); |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 9045823c7be7..4bf811c09f59 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -121,10 +121,6 @@ kallsyms() | |||
121 | info KSYM ${2} | 121 | info KSYM ${2} |
122 | local kallsymopt; | 122 | local kallsymopt; |
123 | 123 | ||
124 | if [ -n "${CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX}" ]; then | ||
125 | kallsymopt="${kallsymopt} --symbol-prefix=_" | ||
126 | fi | ||
127 | |||
128 | if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then | 124 | if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then |
129 | kallsymopt="${kallsymopt} --all-symbols" | 125 | kallsymopt="${kallsymopt} --all-symbols" |
130 | fi | 126 | fi |