diff options
author | David Woodhouse <dwmw2@infradead.org> | 2005-05-05 19:15:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-05 19:36:31 -0400 |
commit | 075d6eb16d273dab7b7b4b83fcee8bce4ee387ed (patch) | |
tree | d5e2cfb21dd752410649a675f2bb2a7c0db05c8e | |
parent | becf3aec2608d6807a58d0677661cb23c388d67f (diff) |
[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>
-rw-r--r-- | arch/ppc/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | include/asm-generic/sections.h | 2 | ||||
-rw-r--r-- | kernel/kallsyms.c | 13 | ||||
-rw-r--r-- | scripts/kallsyms.c | 20 |
4 files changed, 28 insertions, 9 deletions
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S index 0c0e714b84de..9353584fb710 100644 --- a/arch/ppc/kernel/vmlinux.lds.S +++ b/arch/ppc/kernel/vmlinux.lds.S | |||
@@ -145,6 +145,7 @@ SECTIONS | |||
145 | __init_end = .; | 145 | __init_end = .; |
146 | 146 | ||
147 | . = ALIGN(4096); | 147 | . = ALIGN(4096); |
148 | _sextratext = .; | ||
148 | __pmac_begin = .; | 149 | __pmac_begin = .; |
149 | .pmac.text : { *(.pmac.text) } | 150 | .pmac.text : { *(.pmac.text) } |
150 | .pmac.data : { *(.pmac.data) } | 151 | .pmac.data : { *(.pmac.data) } |
@@ -171,6 +172,7 @@ SECTIONS | |||
171 | .openfirmware.data : { *(.openfirmware.data) } | 172 | .openfirmware.data : { *(.openfirmware.data) } |
172 | . = ALIGN(4096); | 173 | . = ALIGN(4096); |
173 | __openfirmware_end = .; | 174 | __openfirmware_end = .; |
175 | _eextratext = .; | ||
174 | 176 | ||
175 | __bss_start = .; | 177 | __bss_start = .; |
176 | .bss : | 178 | .bss : |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 976ac29598b7..195ccdc069e6 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -8,6 +8,8 @@ extern char _data[], _sdata[], _edata[]; | |||
8 | extern char __bss_start[], __bss_stop[]; | 8 | extern char __bss_start[], __bss_stop[]; |
9 | extern char __init_begin[], __init_end[]; | 9 | extern char __init_begin[], __init_end[]; |
10 | extern char _sinittext[], _einittext[]; | 10 | extern char _sinittext[], _einittext[]; |
11 | extern char _sextratext[] __attribute__((weak)); | ||
12 | extern char _eextratext[] __attribute__((weak)); | ||
11 | extern char _end[]; | 13 | extern char _end[]; |
12 | 14 | ||
13 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ | 15 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 1627f8d6e0cd..13bcec151b57 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -46,6 +46,14 @@ static inline int is_kernel_inittext(unsigned long addr) | |||
46 | return 0; | 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 | static inline int is_kernel_text(unsigned long addr) | 57 | static inline int is_kernel_text(unsigned long addr) |
50 | { | 58 | { |
51 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) | 59 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) |
@@ -169,8 +177,9 @@ const char *kallsyms_lookup(unsigned long addr, | |||
169 | namebuf[0] = 0; | 177 | namebuf[0] = 0; |
170 | 178 | ||
171 | if ((all_var && is_kernel(addr)) || | 179 | if ((all_var && is_kernel(addr)) || |
172 | (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) { | 180 | (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr) || |
173 | unsigned long symbol_end=0; | 181 | is_kernel_extratext(addr)))) { |
182 | unsigned long symbol_end = 0; | ||
174 | 183 | ||
175 | /* do a binary search on the sorted kallsyms_addresses array */ | 184 | /* do a binary search on the sorted kallsyms_addresses array */ |
176 | low = 0; | 185 | low = 0; |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index fe11df83d1fc..d3d2e5341051 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -67,7 +67,7 @@ struct sym_entry { | |||
67 | 67 | ||
68 | static struct sym_entry *table; | 68 | static struct sym_entry *table; |
69 | static int size, cnt; | 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 | static int all_symbols = 0; | 71 | static int all_symbols = 0; |
72 | static char symbol_prefix_char = '\0'; | 72 | static char symbol_prefix_char = '\0'; |
73 | 73 | ||
@@ -139,6 +139,10 @@ read_symbol(FILE *in, struct sym_entry *s) | |||
139 | _sinittext = s->addr; | 139 | _sinittext = s->addr; |
140 | else if (strcmp(sym, "_einittext") == 0) | 140 | else if (strcmp(sym, "_einittext") == 0) |
141 | _einittext = s->addr; | 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 | else if (toupper(s->type) == 'A') | 146 | else if (toupper(s->type) == 'A') |
143 | { | 147 | { |
144 | /* Keep these useful absolute symbols */ | 148 | /* Keep these useful absolute symbols */ |
@@ -194,16 +198,18 @@ symbol_valid(struct sym_entry *s) | |||
194 | * and inittext sections are discarded */ | 198 | * and inittext sections are discarded */ |
195 | if (!all_symbols) { | 199 | if (!all_symbols) { |
196 | if ((s->addr < _stext || s->addr > _etext) | 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 | return 0; | 203 | return 0; |
199 | /* Corner case. Discard any symbols with the same value as | 204 | /* Corner case. Discard any symbols with the same value as |
200 | * _etext or _einittext, they can move between pass 1 and 2 | 205 | * _etext _einittext or _eextratext; they can move between pass |
201 | * when the kallsyms data is added. If these symbols move then | 206 | * 1 and 2 when the kallsyms data are added. If these symbols |
202 | * they may get dropped in pass 2, which breaks the kallsyms | 207 | * move then they may get dropped in pass 2, which breaks the |
203 | * rules. | 208 | * kallsyms rules. |
204 | */ | 209 | */ |
205 | if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) || | 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 | return 0; | 213 | return 0; |
208 | } | 214 | } |
209 | 215 | ||