Commit 075d6eb16d273dab7b7b4b83fcee8bce4ee387ed
Committed by
Linus Torvalds
1 parent
becf3aec26
Exists in
master
and in
7 other branches
[PATCH] ppc32: platform-specific functions missing from kallsyms.
The PPC32 kernel puts platform-specific functions into separate sections so that unneeded parts of it can be freed when we've booted and actually worked out what we're running on today. This makes kallsyms ignore those functions, because they're not between _[se]text or _[se]inittext. Rather than teaching kallsyms about the various pmac/chrp/etc sections, this patch adds '_[se]extratext' markers for kallsyms. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 4 changed files with 28 additions and 9 deletions Side-by-side Diff
arch/ppc/kernel/vmlinux.lds.S
... | ... | @@ -145,6 +145,7 @@ |
145 | 145 | __init_end = .; |
146 | 146 | |
147 | 147 | . = ALIGN(4096); |
148 | + _sextratext = .; | |
148 | 149 | __pmac_begin = .; |
149 | 150 | .pmac.text : { *(.pmac.text) } |
150 | 151 | .pmac.data : { *(.pmac.data) } |
... | ... | @@ -171,6 +172,7 @@ |
171 | 172 | .openfirmware.data : { *(.openfirmware.data) } |
172 | 173 | . = ALIGN(4096); |
173 | 174 | __openfirmware_end = .; |
175 | + _eextratext = .; | |
174 | 176 | |
175 | 177 | __bss_start = .; |
176 | 178 | .bss : |
include/asm-generic/sections.h
... | ... | @@ -8,6 +8,8 @@ |
8 | 8 | extern char __bss_start[], __bss_stop[]; |
9 | 9 | extern char __init_begin[], __init_end[]; |
10 | 10 | extern char _sinittext[], _einittext[]; |
11 | +extern char _sextratext[] __attribute__((weak)); | |
12 | +extern char _eextratext[] __attribute__((weak)); | |
11 | 13 | extern char _end[]; |
12 | 14 | |
13 | 15 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |
kernel/kallsyms.c
... | ... | @@ -46,6 +46,14 @@ |
46 | 46 | return 0; |
47 | 47 | } |
48 | 48 | |
49 | +static inline int is_kernel_extratext(unsigned long addr) | |
50 | +{ | |
51 | + if (addr >= (unsigned long)_sextratext | |
52 | + && addr <= (unsigned long)_eextratext) | |
53 | + return 1; | |
54 | + return 0; | |
55 | +} | |
56 | + | |
49 | 57 | static inline int is_kernel_text(unsigned long addr) |
50 | 58 | { |
51 | 59 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) |
... | ... | @@ -169,8 +177,9 @@ |
169 | 177 | namebuf[0] = 0; |
170 | 178 | |
171 | 179 | if ((all_var && is_kernel(addr)) || |
172 | - (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) { | |
173 | - unsigned long symbol_end=0; | |
180 | + (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr) || | |
181 | + is_kernel_extratext(addr)))) { | |
182 | + unsigned long symbol_end = 0; | |
174 | 183 | |
175 | 184 | /* do a binary search on the sorted kallsyms_addresses array */ |
176 | 185 | low = 0; |
scripts/kallsyms.c
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | |
68 | 68 | static struct sym_entry *table; |
69 | 69 | static int size, cnt; |
70 | -static unsigned long long _stext, _etext, _sinittext, _einittext; | |
70 | +static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext; | |
71 | 71 | static int all_symbols = 0; |
72 | 72 | static char symbol_prefix_char = '\0'; |
73 | 73 | |
... | ... | @@ -139,6 +139,10 @@ |
139 | 139 | _sinittext = s->addr; |
140 | 140 | else if (strcmp(sym, "_einittext") == 0) |
141 | 141 | _einittext = s->addr; |
142 | + else if (strcmp(sym, "_sextratext") == 0) | |
143 | + _sextratext = s->addr; | |
144 | + else if (strcmp(sym, "_eextratext") == 0) | |
145 | + _eextratext = s->addr; | |
142 | 146 | else if (toupper(s->type) == 'A') |
143 | 147 | { |
144 | 148 | /* Keep these useful absolute symbols */ |
145 | 149 | |
146 | 150 | |
... | ... | @@ -194,16 +198,18 @@ |
194 | 198 | * and inittext sections are discarded */ |
195 | 199 | if (!all_symbols) { |
196 | 200 | if ((s->addr < _stext || s->addr > _etext) |
197 | - && (s->addr < _sinittext || s->addr > _einittext)) | |
201 | + && (s->addr < _sinittext || s->addr > _einittext) | |
202 | + && (s->addr < _sextratext || s->addr > _eextratext)) | |
198 | 203 | return 0; |
199 | 204 | /* Corner case. Discard any symbols with the same value as |
200 | - * _etext or _einittext, they can move between pass 1 and 2 | |
201 | - * when the kallsyms data is added. If these symbols move then | |
202 | - * they may get dropped in pass 2, which breaks the kallsyms | |
203 | - * rules. | |
205 | + * _etext _einittext or _eextratext; they can move between pass | |
206 | + * 1 and 2 when the kallsyms data are added. If these symbols | |
207 | + * move then they may get dropped in pass 2, which breaks the | |
208 | + * kallsyms rules. | |
204 | 209 | */ |
205 | 210 | if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) || |
206 | - (s->addr == _einittext && strcmp(s->sym + offset, "_einittext"))) | |
211 | + (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) || | |
212 | + (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext"))) | |
207 | 213 | return 0; |
208 | 214 | } |
209 | 215 |