summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-04-12 13:01:17 -0700
committerJames Bottomley <jejb@raven.il.steeleye.com>2003-04-12 13:01:17 -0700
commit4b4bd81a64ff2826bd964b78753172591df34612 (patch)
treec04aea1ef99bb3040a8af085fabe36a571452ab7
parent77a9874a1428dc2c0abd4bf8ed3c892d9d92ba6f (diff)
[PATCH] Put all functions in kallsyms
From: Rusty Russell <rusty@rustcorp.com.au> Introduce _sinittext and _einittext (cf. _stext and _etext), so kallsyms includes __init functions. TODO: Use huffman name compression and 16-bit offsets (see IDE oopser patch)
-rw-r--r--arch/alpha/vmlinux.lds.S6
-rw-r--r--arch/arm/vmlinux-armo.lds.in2
-rw-r--r--arch/arm/vmlinux-armv.lds.in2
-rw-r--r--arch/i386/vmlinux.lds.S6
-rw-r--r--arch/ia64/vmlinux.lds.S6
-rw-r--r--arch/m68k/vmlinux-std.lds6
-rw-r--r--arch/m68k/vmlinux-sun3.lds6
-rw-r--r--arch/m68knommu/vmlinux.lds.S2
-rw-r--r--arch/parisc/vmlinux.lds.S6
-rw-r--r--arch/ppc/vmlinux.lds.S6
-rw-r--r--arch/ppc64/vmlinux.lds.S6
-rw-r--r--arch/s390/vmlinux.lds.S6
-rw-r--r--arch/s390x/vmlinux.lds.S6
-rw-r--r--arch/sparc/vmlinux.lds.S6
-rw-r--r--arch/sparc64/vmlinux.lds.S6
-rw-r--r--arch/v850/vmlinux.lds.S4
-rw-r--r--arch/x86_64/vmlinux.lds.S6
-rw-r--r--kernel/extable.c6
-rw-r--r--kernel/kallsyms.c21
-rw-r--r--scripts/kallsyms.c12
20 files changed, 106 insertions, 21 deletions
diff --git a/arch/alpha/vmlinux.lds.S b/arch/alpha/vmlinux.lds.S
index edcdefd20006..863e60644e83 100644
--- a/arch/alpha/vmlinux.lds.S
+++ b/arch/alpha/vmlinux.lds.S
@@ -32,7 +32,11 @@ SECTIONS
/* Will be freed after init */
. = ALIGN(8192); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
diff --git a/arch/arm/vmlinux-armo.lds.in b/arch/arm/vmlinux-armo.lds.in
index 41afcce57495..18e100b67d67 100644
--- a/arch/arm/vmlinux-armo.lds.in
+++ b/arch/arm/vmlinux-armo.lds.in
@@ -14,7 +14,9 @@ SECTIONS
.init : { /* Init code and data */
_stext = .;
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
__proc_info_begin = .;
*(.proc.info)
__proc_info_end = .;
diff --git a/arch/arm/vmlinux-armv.lds.in b/arch/arm/vmlinux-armv.lds.in
index bf8be1b119e1..5155359e1a46 100644
--- a/arch/arm/vmlinux-armv.lds.in
+++ b/arch/arm/vmlinux-armv.lds.in
@@ -18,7 +18,9 @@ SECTIONS
.init : { /* Init code and data */
_stext = .;
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
__proc_info_begin = .;
*(.proc.info)
__proc_info_end = .;
diff --git a/arch/i386/vmlinux.lds.S b/arch/i386/vmlinux.lds.S
index f607523ff614..27016d7f597d 100644
--- a/arch/i386/vmlinux.lds.S
+++ b/arch/i386/vmlinux.lds.S
@@ -54,7 +54,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/ia64/vmlinux.lds.S b/arch/ia64/vmlinux.lds.S
index 50ff363b6af7..fc52b7b57626 100644
--- a/arch/ia64/vmlinux.lds.S
+++ b/arch/ia64/vmlinux.lds.S
@@ -96,7 +96,11 @@ SECTIONS
. = ALIGN(PAGE_SIZE);
__init_begin = .;
.init.text : AT(ADDR(.init.text) - PAGE_OFFSET)
- { *(.init.text) }
+ {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : AT(ADDR(.init.data) - PAGE_OFFSET)
{ *(.init.data) }
diff --git a/arch/m68k/vmlinux-std.lds b/arch/m68k/vmlinux-std.lds
index 4bf76f9f7d37..959c6ae41430 100644
--- a/arch/m68k/vmlinux-std.lds
+++ b/arch/m68k/vmlinux-std.lds
@@ -40,7 +40,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/m68k/vmlinux-sun3.lds b/arch/m68k/vmlinux-sun3.lds
index 39a729d077f1..03ada554c074 100644
--- a/arch/m68k/vmlinux-sun3.lds
+++ b/arch/m68k/vmlinux-sun3.lds
@@ -34,7 +34,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(8192); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/m68knommu/vmlinux.lds.S b/arch/m68knommu/vmlinux.lds.S
index 4f936da88b7f..fa6bd85c11d6 100644
--- a/arch/m68knommu/vmlinux.lds.S
+++ b/arch/m68knommu/vmlinux.lds.S
@@ -282,7 +282,9 @@ SECTIONS {
.init : {
. = ALIGN(4096);
__init_begin = .;
+ _sinittext = .;
*(.init.text)
+ _einittext = .;
*(.init.data)
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/parisc/vmlinux.lds.S b/arch/parisc/vmlinux.lds.S
index 348bc4972219..99db5cb1cc56 100644
--- a/arch/parisc/vmlinux.lds.S
+++ b/arch/parisc/vmlinux.lds.S
@@ -53,7 +53,11 @@ SECTIONS
. = ALIGN(16384);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/ppc/vmlinux.lds.S b/arch/ppc/vmlinux.lds.S
index e4cdd48f98be..557cb6c44921 100644
--- a/arch/ppc/vmlinux.lds.S
+++ b/arch/ppc/vmlinux.lds.S
@@ -78,7 +78,11 @@ SECTIONS
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : {
*(.init.data);
__vtop_table_begin = .;
diff --git a/arch/ppc64/vmlinux.lds.S b/arch/ppc64/vmlinux.lds.S
index e34d2b5de342..f6429d5d13c0 100644
--- a/arch/ppc64/vmlinux.lds.S
+++ b/arch/ppc64/vmlinux.lds.S
@@ -77,7 +77,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/s390/vmlinux.lds.S b/arch/s390/vmlinux.lds.S
index 36d48e98973f..6e36b3e552e4 100644
--- a/arch/s390/vmlinux.lds.S
+++ b/arch/s390/vmlinux.lds.S
@@ -58,7 +58,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(256);
__setup_start = .;
diff --git a/arch/s390x/vmlinux.lds.S b/arch/s390x/vmlinux.lds.S
index 3a92829c17d3..a6c179473e43 100644
--- a/arch/s390x/vmlinux.lds.S
+++ b/arch/s390x/vmlinux.lds.S
@@ -58,7 +58,11 @@ SECTIONS
/* will be freed after init */
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(256);
__setup_start = .;
diff --git a/arch/sparc/vmlinux.lds.S b/arch/sparc/vmlinux.lds.S
index db9e6d8a6a36..40fbec8537e2 100644
--- a/arch/sparc/vmlinux.lds.S
+++ b/arch/sparc/vmlinux.lds.S
@@ -34,7 +34,11 @@ SECTIONS
. = ALIGN(4096);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
__init_text_end = .;
.init.data : { *(.init.data) }
. = ALIGN(16);
diff --git a/arch/sparc64/vmlinux.lds.S b/arch/sparc64/vmlinux.lds.S
index f3aa21d46348..0c8919aa9f87 100644
--- a/arch/sparc64/vmlinux.lds.S
+++ b/arch/sparc64/vmlinux.lds.S
@@ -41,7 +41,11 @@ SECTIONS
. = ALIGN(8192);
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/arch/v850/vmlinux.lds.S b/arch/v850/vmlinux.lds.S
index 15c64a2ea846..5b978afff11f 100644
--- a/arch/v850/vmlinux.lds.S
+++ b/arch/v850/vmlinux.lds.S
@@ -105,7 +105,9 @@
#define RAMK_INIT_CONTENTS_NO_END \
. = ALIGN (4096) ; \
__init_start = . ; \
+ _sinittext = .; \
*(.init.text) /* 2.5 convention */ \
+ _einittext = .; \
*(.init.data) \
*(.text.init) /* 2.4 convention */ \
*(.data.init) \
@@ -125,7 +127,9 @@
/* The contents of `init' section for a ROM-resident kernel which
should go into ROM. */
#define ROMK_INIT_ROM_CONTENTS \
+ _sinittext = .; \
*(.init.text) /* 2.5 convention */ \
+ _einittext = .; \
*(.text.init) /* 2.4 convention */ \
INITCALL_CONTENTS \
INITRAMFS_CONTENTS
diff --git a/arch/x86_64/vmlinux.lds.S b/arch/x86_64/vmlinux.lds.S
index 6648607b233b..6bd383f57b87 100644
--- a/arch/x86_64/vmlinux.lds.S
+++ b/arch/x86_64/vmlinux.lds.S
@@ -78,7 +78,11 @@ SECTIONS
. = ALIGN(4096); /* Init code and data */
__init_begin = .;
- .init.text : { *(.init.text) }
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
.init.data : { *(.init.data) }
. = ALIGN(16);
__setup_start = .;
diff --git a/kernel/extable.c b/kernel/extable.c
index 5363e7f6f9e4..d49099854024 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -20,7 +20,7 @@
extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];
-extern char _stext[], _etext[];
+extern char _stext[], _etext[], _sinittext[], _einittext[];
/* Given an address, look for it in the exception tables. */
const struct exception_table_entry *search_exception_tables(unsigned long addr)
@@ -39,5 +39,9 @@ int kernel_text_address(unsigned long addr)
addr <= (unsigned long)_etext)
return 1;
+ if (addr >= (unsigned long)_sinittext &&
+ addr <= (unsigned long)_einittext)
+ return 1;
+
return module_text_address(addr) != NULL;
}
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 822945bd923b..3e9fbda3593c 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -15,7 +15,22 @@ extern unsigned long kallsyms_num_syms __attribute__((weak));
extern char kallsyms_names[] __attribute__((weak));
/* Defined by the linker script. */
-extern char _stext[], _etext[];
+extern char _stext[], _etext[], _sinittext[], _einittext[];
+
+static inline int is_kernel_inittext(unsigned long addr)
+{
+ if (addr >= (unsigned long)_sinittext
+ && addr <= (unsigned long)_einittext)
+ return 1;
+ return 0;
+}
+
+static inline int is_kernel_text(unsigned long addr)
+{
+ if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
+ return 1;
+ return 0;
+}
/* Lookup an address. modname is set to NULL if it's in the kernel. */
const char *kallsyms_lookup(unsigned long addr,
@@ -31,7 +46,7 @@ const char *kallsyms_lookup(unsigned long addr,
namebuf[127] = 0;
namebuf[0] = 0;
- if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) {
+ if (is_kernel_text(addr) || is_kernel_inittext(addr)) {
unsigned long symbol_end;
char *name = kallsyms_names;
@@ -52,6 +67,8 @@ const char *kallsyms_lookup(unsigned long addr,
/* Base symbol size on next symbol. */
if (best + 1 < kallsyms_num_syms)
symbol_end = kallsyms_addresses[best + 1];
+ else if (is_kernel_inittext(addr))
+ symbol_end = (unsigned long)_einittext;
else
symbol_end = (unsigned long)_etext;
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 25ce910dcf75..43c110fe7829 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -21,7 +21,7 @@ struct sym_entry {
static struct sym_entry *table;
static int size, cnt;
-static unsigned long long _stext, _etext;
+static unsigned long long _stext, _etext, _sinittext, _einittext;
static void
usage(void)
@@ -51,10 +51,8 @@ read_symbol(FILE *in, struct sym_entry *s)
static int
symbol_valid(struct sym_entry *s)
{
- if (s->addr < _stext)
- return 0;
-
- if (s->addr > _etext)
+ if ((s->addr < _stext || s->addr > _etext)
+ && (s->addr < _sinittext || s->addr > _einittext))
return 0;
if (strstr(s->sym, "_compiled."))
@@ -85,6 +83,10 @@ read_map(FILE *in)
_stext = table[i].addr;
if (strcmp(table[i].sym, "_etext") == 0)
_etext = table[i].addr;
+ if (strcmp(table[i].sym, "_sinittext") == 0)
+ _sinittext = table[i].addr;
+ if (strcmp(table[i].sym, "_einittext") == 0)
+ _einittext = table[i].addr;
}
}