summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2003-07-18 05:22:58 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-18 05:22:58 -0700
commita232e5e1e04ea592595ffef42222791bacbb7cda (patch)
treea4d77c5f0c291c4b86089d9b76c24e302cd47e15
parentd3e6935a87da6a2776396fc2887f040cdc22096f (diff)
[PATCH] Centralize Linker Symbols
Richard Henderson point out a while back that linker generated symbols should be declared as: "char _text[]" so that the compiler can't make assumptions about them sitting in small sections, etc. Centralize these defintions in asm/sections.h (where some already are on x86).
-rw-r--r--arch/i386/kernel/setup.c23
-rw-r--r--arch/i386/mm/init.c2
-rw-r--r--include/asm-generic/sections.h9
-rw-r--r--include/asm-i386/hw_irq.h5
-rw-r--r--kernel/extable.c2
-rw-r--r--kernel/profile.c5
6 files changed, 23 insertions, 23 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index d6dce76e594e..01a3990182c5 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -42,6 +42,7 @@
#include <asm/edd.h>
#include <asm/setup.h>
#include <asm/arch_hooks.h>
+#include <asm/sections.h>
#include "setup_arch_pre.h"
#include "mach_resources.h"
@@ -100,7 +101,7 @@ extern void early_cpu_init(void);
extern void dmi_scan_machine(void);
extern void generic_apic_probe(char *);
extern int root_mountflags;
-extern char _text, _etext, _edata, _end;
+extern char _end[];
unsigned long saved_videomode;
@@ -676,7 +677,7 @@ static unsigned long __init setup_memory(void)
* partially used pages are not usable - thus
* we are rounding upwards:
*/
- start_pfn = PFN_UP(__pa(&_end));
+ start_pfn = PFN_UP(__pa(_end));
find_max_pfn();
@@ -947,15 +948,15 @@ void __init setup_arch(char **cmdline_p)
if (!MOUNT_ROOT_RDONLY)
root_mountflags &= ~MS_RDONLY;
- init_mm.start_code = (unsigned long) &_text;
- init_mm.end_code = (unsigned long) &_etext;
- init_mm.end_data = (unsigned long) &_edata;
- init_mm.brk = (unsigned long) &_end;
-
- code_resource.start = virt_to_phys(&_text);
- code_resource.end = virt_to_phys(&_etext)-1;
- data_resource.start = virt_to_phys(&_etext);
- data_resource.end = virt_to_phys(&_edata)-1;
+ init_mm.start_code = (unsigned long) _text;
+ init_mm.end_code = (unsigned long) _etext;
+ init_mm.end_data = (unsigned long) _edata;
+ init_mm.brk = (unsigned long) _end;
+
+ code_resource.start = virt_to_phys(_text);
+ code_resource.end = virt_to_phys(_etext)-1;
+ data_resource.start = virt_to_phys(_etext);
+ data_resource.end = virt_to_phys(_edata)-1;
parse_cmdline_early(cmdline_p);
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index daba5d620477..d991c2e3debc 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -562,7 +562,7 @@ void free_initmem(void)
free_page(addr);
totalram_pages++;
}
- printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10);
+ printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10);
}
#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index fe290e3349be..ce400f39ba25 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,9 +3,10 @@
/* References to section boundaries */
-extern char _text, _etext;
-extern char _data, _edata;
-extern char __bss_start;
-extern char __init_begin, __init_end;
+extern char _text[], _stext[], _etext[];
+extern char _data[], _sdata[], _edata[];
+extern char __bss_start[];
+extern char __init_begin[], __init_end[];
+extern char _sinittext[], _einittext[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index 30e4cfa8395b..eaee6b7cd24f 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -16,6 +16,7 @@
#include <linux/profile.h>
#include <asm/atomic.h>
#include <asm/irq.h>
+#include <asm/sections.h>
/*
* Various low-level irq details needed by irq.c, process.c,
@@ -63,8 +64,6 @@ extern unsigned long io_apic_irqs;
extern atomic_t irq_err_count;
extern atomic_t irq_mis_count;
-extern char _stext, _etext;
-
#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
/*
@@ -95,7 +94,7 @@ static inline void x86_do_profile(struct pt_regs * regs)
if (!((1<<smp_processor_id()) & prof_cpu_mask))
return;
- eip -= (unsigned long) &_stext;
+ eip -= (unsigned long)_stext;
eip >>= prof_shift;
/*
* Don't ignore out-of-bounds EIP values silently,
diff --git a/kernel/extable.c b/kernel/extable.c
index d49099854024..6f1fb8c6b75b 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -17,10 +17,10 @@
*/
#include <linux/module.h>
#include <asm/uaccess.h>
+#include <asm/sections.h>
extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];
-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)
diff --git a/kernel/profile.c b/kernel/profile.c
index 4f6d22ce33f2..5c02ac0fbbda 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -8,8 +8,7 @@
#include <linux/bootmem.h>
#include <linux/notifier.h>
#include <linux/mm.h>
-
-extern char _stext, _etext;
+#include <asm/sections.h>
unsigned int * prof_buffer;
unsigned long prof_len;
@@ -36,7 +35,7 @@ void __init profile_init(void)
return;
/* only text is profiled */
- prof_len = (unsigned long) &_etext - (unsigned long) &_stext;
+ prof_len = _etext - _stext;
prof_len >>= prof_shift;
size = prof_len * sizeof(unsigned int) + PAGE_SIZE - 1;