Commit a232e5e1 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[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).
parent d3e6935a
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <asm/edd.h> #include <asm/edd.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/arch_hooks.h> #include <asm/arch_hooks.h>
#include <asm/sections.h>
#include "setup_arch_pre.h" #include "setup_arch_pre.h"
#include "mach_resources.h" #include "mach_resources.h"
...@@ -100,7 +101,7 @@ extern void early_cpu_init(void); ...@@ -100,7 +101,7 @@ extern void early_cpu_init(void);
extern void dmi_scan_machine(void); extern void dmi_scan_machine(void);
extern void generic_apic_probe(char *); extern void generic_apic_probe(char *);
extern int root_mountflags; extern int root_mountflags;
extern char _text, _etext, _edata, _end; extern char _end[];
unsigned long saved_videomode; unsigned long saved_videomode;
...@@ -676,7 +677,7 @@ static unsigned long __init setup_memory(void) ...@@ -676,7 +677,7 @@ static unsigned long __init setup_memory(void)
* partially used pages are not usable - thus * partially used pages are not usable - thus
* we are rounding upwards: * we are rounding upwards:
*/ */
start_pfn = PFN_UP(__pa(&_end)); start_pfn = PFN_UP(__pa(_end));
find_max_pfn(); find_max_pfn();
...@@ -947,15 +948,15 @@ void __init setup_arch(char **cmdline_p) ...@@ -947,15 +948,15 @@ void __init setup_arch(char **cmdline_p)
if (!MOUNT_ROOT_RDONLY) if (!MOUNT_ROOT_RDONLY)
root_mountflags &= ~MS_RDONLY; root_mountflags &= ~MS_RDONLY;
init_mm.start_code = (unsigned long) &_text; init_mm.start_code = (unsigned long) _text;
init_mm.end_code = (unsigned long) &_etext; init_mm.end_code = (unsigned long) _etext;
init_mm.end_data = (unsigned long) &_edata; init_mm.end_data = (unsigned long) _edata;
init_mm.brk = (unsigned long) &_end; init_mm.brk = (unsigned long) _end;
code_resource.start = virt_to_phys(&_text); code_resource.start = virt_to_phys(_text);
code_resource.end = virt_to_phys(&_etext)-1; code_resource.end = virt_to_phys(_etext)-1;
data_resource.start = virt_to_phys(&_etext); data_resource.start = virt_to_phys(_etext);
data_resource.end = virt_to_phys(&_edata)-1; data_resource.end = virt_to_phys(_edata)-1;
parse_cmdline_early(cmdline_p); parse_cmdline_early(cmdline_p);
......
...@@ -562,7 +562,7 @@ void free_initmem(void) ...@@ -562,7 +562,7 @@ void free_initmem(void)
free_page(addr); free_page(addr);
totalram_pages++; 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 #ifdef CONFIG_BLK_DEV_INITRD
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
/* References to section boundaries */ /* References to section boundaries */
extern char _text, _etext; extern char _text[], _stext[], _etext[];
extern char _data, _edata; extern char _data[], _sdata[], _edata[];
extern char __bss_start; extern char __bss_start[];
extern char __init_begin, __init_end; extern char __init_begin[], __init_end[];
extern char _sinittext[], _einittext[];
#endif /* _ASM_GENERIC_SECTIONS_H_ */ #endif /* _ASM_GENERIC_SECTIONS_H_ */
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/profile.h> #include <linux/profile.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/sections.h>
/* /*
* Various low-level irq details needed by irq.c, process.c, * Various low-level irq details needed by irq.c, process.c,
...@@ -63,8 +64,6 @@ extern unsigned long io_apic_irqs; ...@@ -63,8 +64,6 @@ extern unsigned long io_apic_irqs;
extern atomic_t irq_err_count; extern atomic_t irq_err_count;
extern atomic_t irq_mis_count; extern atomic_t irq_mis_count;
extern char _stext, _etext;
#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs)) #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) ...@@ -95,7 +94,7 @@ static inline void x86_do_profile(struct pt_regs * regs)
if (!((1<<smp_processor_id()) & prof_cpu_mask)) if (!((1<<smp_processor_id()) & prof_cpu_mask))
return; return;
eip -= (unsigned long) &_stext; eip -= (unsigned long)_stext;
eip >>= prof_shift; eip >>= prof_shift;
/* /*
* Don't ignore out-of-bounds EIP values silently, * Don't ignore out-of-bounds EIP values silently,
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/sections.h>
extern const struct exception_table_entry __start___ex_table[]; extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___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. */ /* Given an address, look for it in the exception tables. */
const struct exception_table_entry *search_exception_tables(unsigned long addr) const struct exception_table_entry *search_exception_tables(unsigned long addr)
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/sections.h>
extern char _stext, _etext;
unsigned int * prof_buffer; unsigned int * prof_buffer;
unsigned long prof_len; unsigned long prof_len;
...@@ -36,7 +35,7 @@ void __init profile_init(void) ...@@ -36,7 +35,7 @@ void __init profile_init(void)
return; return;
/* only text is profiled */ /* only text is profiled */
prof_len = (unsigned long) &_etext - (unsigned long) &_stext; prof_len = _etext - _stext;
prof_len >>= prof_shift; prof_len >>= prof_shift;
size = prof_len * sizeof(unsigned int) + PAGE_SIZE - 1; size = prof_len * sizeof(unsigned int) + PAGE_SIZE - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment