* [PATCH] ppc32: platform-specific functions missing from kallsyms.
@ 2005-05-02 7:57 David Woodhouse
2005-05-02 8:28 ` David Woodhouse
2005-05-03 1:37 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: David Woodhouse @ 2005-05-02 7:57 UTC (permalink / raw)
To: akpm, linuxppc-dev
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>
--- linux-2.6.11/arch/ppc/kernel/vmlinux.lds~ 2005-05-01 10:43:10.000000000 +0100
+++ linux-2.6.11/arch/ppc/kernel/vmlinux.lds 2005-05-02 08:06:52.000000000 +0100
@@ -147,6 +147,7 @@ SECTIONS
__init_end = .;
. = ALIGN(4096);
+ _sextratext = .;
__pmac_begin = .;
.pmac.text : { *(.pmac.text) }
.pmac.data : { *(.pmac.data) }
@@ -173,6 +174,7 @@ SECTIONS
.openfirmware.data : { *(.openfirmware.data) }
. = ALIGN(4096);
__openfirmware_end = .;
+ _eextratext = .;
__bss_start = .;
.bss :
--- linux-2.6.11/include/asm-generic/sections.h~ 2005-03-02 07:37:31.000000000 +0000
+++ linux-2.6.11/include/asm-generic/sections.h 2005-05-02 08:43:04.000000000 +0100
@@ -8,6 +8,8 @@ extern char _data[], _sdata[], _edata[];
extern char __bss_start[], __bss_stop[];
extern char __init_begin[], __init_end[];
extern char _sinittext[], _einittext[];
+extern char _sextratext[] __attribute__((weak));
+extern char _eextratext[] __attribute__((weak));
extern char _end[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */
--- linux-2.6.11/scripts/kallsyms.c~ 2005-03-02 07:38:33.000000000 +0000
+++ linux-2.6.11/scripts/kallsyms.c 2005-05-02 08:09:11.000000000 +0100
@@ -67,7 +67,7 @@ struct sym_entry {
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext, _sinittext, _einittext;
+static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
static int all_symbols = 0;
struct token {
@@ -132,6 +132,10 @@ read_symbol(FILE *in, struct sym_entry *
_sinittext = s->addr;
else if (strcmp(str, "_einittext") == 0)
_einittext = s->addr;
+ else if (strcmp(str, "_sextratext") == 0)
+ _sextratext = s->addr;
+ else if (strcmp(str, "_eextratext") == 0)
+ _eextratext = s->addr;
else if (toupper(s->type) == 'A')
{
/* Keep these useful absolute symbols */
@@ -182,16 +186,18 @@ symbol_valid(struct sym_entry *s)
* and inittext sections are discarded */
if (!all_symbols) {
if ((s->addr < _stext || s->addr > _etext)
- && (s->addr < _sinittext || s->addr > _einittext))
+ && (s->addr < _sinittext || s->addr > _einittext)
+ && (s->addr < _sextratext || s->addr > _eextratext))
return 0;
/* Corner case. Discard any symbols with the same value as
- * _etext or _einittext, they can move between pass 1 and 2
- * when the kallsyms data is added. If these symbols move then
- * they may get dropped in pass 2, which breaks the kallsyms
- * rules.
+ * _etext _einittext or _eextratext; they can move between pass
+ * 1 and 2 when the kallsyms data is added. If these symbols
+ * move then 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")))
+ (s->addr == _einittext && strcmp(s->sym + 1, "_einittext")) ||
+ (s->addr == _eextratext && strcmp(s->sym + 1, "_eextratext")))
return 0;
}
--- linux-2.6.11/kernel/kallsyms.c~ 2005-05-01 10:37:45.000000000 +0100
+++ linux-2.6.11/kernel/kallsyms.c 2005-05-02 08:42:59.000000000 +0100
@@ -46,6 +46,14 @@ static inline int is_kernel_inittext(uns
return 0;
}
+static inline int is_kernel_extratext(unsigned long addr)
+{
+ if (addr >= (unsigned long)_sextratext
+ && addr <= (unsigned long)_eextratext)
+ return 1;
+ return 0;
+}
+
static inline int is_kernel_text(unsigned long addr)
{
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
@@ -169,7 +177,7 @@ const char *kallsyms_lookup(unsigned lon
namebuf[0] = 0;
if ((all_var && is_kernel(addr)) ||
- (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) {
+ (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr) || is_kernel_extratext(addr)))) {
unsigned long symbol_end=0;
/* do a binary search on the sorted kallsyms_addresses array */
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc32: platform-specific functions missing from kallsyms.
2005-05-02 7:57 [PATCH] ppc32: platform-specific functions missing from kallsyms David Woodhouse
@ 2005-05-02 8:28 ` David Woodhouse
2005-05-03 1:37 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2005-05-02 8:28 UTC (permalink / raw)
To: akpm; +Cc: linuxppc-dev
On Mon, 2005-05-02 at 08:57 +0100, David Woodhouse wrote:
> 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>
>
> --- linux-2.6.11/arch/ppc/kernel/vmlinux.lds~ 2005-05-01 10:43:10.000000000 +0100
> +++ linux-2.6.11/arch/ppc/kernel/vmlinux.lds 2005-05-02 08:06:52.000000000 +0100
Bah. s/vmlinux.lds/vmlinux.lds.S/
--- linux-2.6.11/arch/ppc/kernel/vmlinux.lds.S~ 2005-05-01 10:43:10.000000000 +0100
+++ linux-2.6.11/arch/ppc/kernel/vmlinux.lds.S 2005-05-02 08:06:52.000000000 +0100
@@ -147,6 +147,7 @@ SECTIONS
__init_end = .;
. = ALIGN(4096);
+ _sextratext = .;
__pmac_begin = .;
.pmac.text : { *(.pmac.text) }
.pmac.data : { *(.pmac.data) }
@@ -173,6 +174,7 @@ SECTIONS
.openfirmware.data : { *(.openfirmware.data) }
. = ALIGN(4096);
__openfirmware_end = .;
+ _eextratext = .;
__bss_start = .;
.bss :
--- linux-2.6.11/include/asm-generic/sections.h~ 2005-03-02 07:37:31.000000000 +0000
+++ linux-2.6.11/include/asm-generic/sections.h 2005-05-02 08:43:04.000000000 +0100
@@ -8,6 +8,8 @@ extern char _data[], _sdata[], _edata[];
extern char __bss_start[], __bss_stop[];
extern char __init_begin[], __init_end[];
extern char _sinittext[], _einittext[];
+extern char _sextratext[] __attribute__((weak));
+extern char _eextratext[] __attribute__((weak));
extern char _end[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */
--- linux-2.6.11/scripts/kallsyms.c~ 2005-03-02 07:38:33.000000000 +0000
+++ linux-2.6.11/scripts/kallsyms.c 2005-05-02 08:09:11.000000000 +0100
@@ -67,7 +67,7 @@ struct sym_entry {
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext, _sinittext, _einittext;
+static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
static int all_symbols = 0;
struct token {
@@ -132,6 +132,10 @@ read_symbol(FILE *in, struct sym_entry *
_sinittext = s->addr;
else if (strcmp(str, "_einittext") == 0)
_einittext = s->addr;
+ else if (strcmp(str, "_sextratext") == 0)
+ _sextratext = s->addr;
+ else if (strcmp(str, "_eextratext") == 0)
+ _eextratext = s->addr;
else if (toupper(s->type) == 'A')
{
/* Keep these useful absolute symbols */
@@ -182,16 +186,18 @@ symbol_valid(struct sym_entry *s)
* and inittext sections are discarded */
if (!all_symbols) {
if ((s->addr < _stext || s->addr > _etext)
- && (s->addr < _sinittext || s->addr > _einittext))
+ && (s->addr < _sinittext || s->addr > _einittext)
+ && (s->addr < _sextratext || s->addr > _eextratext))
return 0;
/* Corner case. Discard any symbols with the same value as
- * _etext or _einittext, they can move between pass 1 and 2
- * when the kallsyms data is added. If these symbols move then
- * they may get dropped in pass 2, which breaks the kallsyms
- * rules.
+ * _etext _einittext or _eextratext; they can move between pass
+ * 1 and 2 when the kallsyms data is added. If these symbols
+ * move then 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")))
+ (s->addr == _einittext && strcmp(s->sym + 1, "_einittext")) ||
+ (s->addr == _eextratext && strcmp(s->sym + 1, "_eextratext")))
return 0;
}
--- linux-2.6.11/kernel/kallsyms.c~ 2005-05-01 10:37:45.000000000 +0100
+++ linux-2.6.11/kernel/kallsyms.c 2005-05-02 08:42:59.000000000 +0100
@@ -46,6 +46,14 @@ static inline int is_kernel_inittext(uns
return 0;
}
+static inline int is_kernel_extratext(unsigned long addr)
+{
+ if (addr >= (unsigned long)_sextratext
+ && addr <= (unsigned long)_eextratext)
+ return 1;
+ return 0;
+}
+
static inline int is_kernel_text(unsigned long addr)
{
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
@@ -169,7 +177,7 @@ const char *kallsyms_lookup(unsigned lon
namebuf[0] = 0;
if ((all_var && is_kernel(addr)) ||
- (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) {
+ (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr) || is_kernel_extratext(addr)))) {
unsigned long symbol_end=0;
/* do a binary search on the sorted kallsyms_addresses array */
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc32: platform-specific functions missing from kallsyms.
2005-05-02 7:57 [PATCH] ppc32: platform-specific functions missing from kallsyms David Woodhouse
2005-05-02 8:28 ` David Woodhouse
@ 2005-05-03 1:37 ` Andrew Morton
2005-05-03 7:59 ` David Woodhouse
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-05-03 1:37 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev
David Woodhouse <dwmw2@infradead.org> wrote:
>
> 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.
>
Current kernels have fixes in exactly this area. Please redo, retest, resend.
>
> --- linux-2.6.11/arch/ppc/kernel/vmlinux.lds~ 2005-05-01 10:43:10.000000000 +0100
> +++ linux-2.6.11/arch/ppc/kernel/vmlinux.lds 2005-05-02 08:06:52.000000000 +0100
2.6.11? Wow.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc32: platform-specific functions missing from kallsyms.
2005-05-03 1:37 ` Andrew Morton
@ 2005-05-03 7:59 ` David Woodhouse
0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2005-05-03 7:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: linuxppc-dev
On Mon, 2005-05-02 at 18:37 -0700, Andrew Morton wrote:
> 2.6.11? Wow.
Actually 2.6.11-1.1283_FC4; the Fedora kernel. It's at least 2.6.12-rc3,
and Dave had been tracking Linus' tree fairly actively -- but I suspect
he may have fallen behind in the absence of nightly git snapshots. Must
fix that now we have tags.
Here it is updated to the current git tree and compile-tested.
Index: arch/ppc/kernel/vmlinux.lds.S
===================================================================
--- 226896c455d8a4996527c4a0ec5699956c657ec3/arch/ppc/kernel/vmlinux.lds.S (mode:100644 sha1:0c0e714b84de74febf1f4dcb59eb1a859902deac)
+++ uncommitted/arch/ppc/kernel/vmlinux.lds.S (mode:100644)
@@ -145,6 +145,7 @@
__init_end = .;
. = ALIGN(4096);
+ _sextratext = .;
__pmac_begin = .;
.pmac.text : { *(.pmac.text) }
.pmac.data : { *(.pmac.data) }
@@ -171,6 +172,7 @@
.openfirmware.data : { *(.openfirmware.data) }
. = ALIGN(4096);
__openfirmware_end = .;
+ _eextratext = .;
__bss_start = .;
.bss :
Index: include/asm-generic/sections.h
===================================================================
--- 226896c455d8a4996527c4a0ec5699956c657ec3/include/asm-generic/sections.h (mode:100644 sha1:976ac29598b78d0b2c0c90516480e93434d8f506)
+++ uncommitted/include/asm-generic/sections.h (mode:100644)
@@ -8,6 +8,8 @@
extern char __bss_start[], __bss_stop[];
extern char __init_begin[], __init_end[];
extern char _sinittext[], _einittext[];
+extern char _sextratext[] __attribute__((weak));
+extern char _eextratext[] __attribute__((weak));
extern char _end[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */
Index: kernel/kallsyms.c
===================================================================
--- 226896c455d8a4996527c4a0ec5699956c657ec3/kernel/kallsyms.c (mode:100644 sha1:1627f8d6e0cdd5f918c30666f4434407df25c293)
+++ uncommitted/kernel/kallsyms.c (mode:100644)
@@ -46,6 +46,14 @@
return 0;
}
+static inline int is_kernel_extratext(unsigned long addr)
+{
+ if (addr >= (unsigned long)_sextratext
+ && addr <= (unsigned long)_eextratext)
+ return 1;
+ return 0;
+}
+
static inline int is_kernel_text(unsigned long addr)
{
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
@@ -169,7 +177,7 @@
namebuf[0] = 0;
if ((all_var && is_kernel(addr)) ||
- (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr)))) {
+ (!all_var && (is_kernel_text(addr) || is_kernel_inittext(addr) || is_kernel_extratext(addr)))) {
unsigned long symbol_end=0;
/* do a binary search on the sorted kallsyms_addresses array */
Index: scripts/kallsyms.c
===================================================================
--- 226896c455d8a4996527c4a0ec5699956c657ec3/scripts/kallsyms.c (mode:100644 sha1:fe11df83d1fc91b3e6de8a7bdc4a06e25f3d0e2f)
+++ uncommitted/scripts/kallsyms.c (mode:100644)
@@ -67,7 +67,7 @@
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext, _sinittext, _einittext;
+static unsigned long long _stext, _etext, _sinittext, _einittext, _sextratext, _eextratext;
static int all_symbols = 0;
static char symbol_prefix_char = '\0';
@@ -139,6 +139,10 @@
_sinittext = s->addr;
else if (strcmp(sym, "_einittext") == 0)
_einittext = s->addr;
+ else if (strcmp(sym, "_sextratext") == 0)
+ _sextratext = s->addr;
+ else if (strcmp(sym, "_eextratext") == 0)
+ _eextratext = s->addr;
else if (toupper(s->type) == 'A')
{
/* Keep these useful absolute symbols */
@@ -194,16 +198,18 @@
* and inittext sections are discarded */
if (!all_symbols) {
if ((s->addr < _stext || s->addr > _etext)
- && (s->addr < _sinittext || s->addr > _einittext))
+ && (s->addr < _sinittext || s->addr > _einittext)
+ && (s->addr < _sextratext || s->addr > _eextratext))
return 0;
/* Corner case. Discard any symbols with the same value as
- * _etext or _einittext, they can move between pass 1 and 2
- * when the kallsyms data is added. If these symbols move then
- * they may get dropped in pass 2, which breaks the kallsyms
- * rules.
+ * _etext _einittext or _eextratext; they can move between pass
+ * 1 and 2 when the kallsyms data are added. If these symbols
+ * move then they may get dropped in pass 2, which breaks the
+ * kallsyms rules.
*/
if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) ||
- (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")))
+ (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) ||
+ (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext")))
return 0;
}
--
dwmw2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-03 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-02 7:57 [PATCH] ppc32: platform-specific functions missing from kallsyms David Woodhouse
2005-05-02 8:28 ` David Woodhouse
2005-05-03 1:37 ` Andrew Morton
2005-05-03 7:59 ` David Woodhouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).