Browse Source

[PATCH] x86_64: Only use asm/sections.h to declare section symbols

Adding __initdata_* to asm-generic/sections.h
Replaces a lot of open coded externs in arch/x86_64/*
I had to change __bss_end to __bss_stop to match the other architectures.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andi Kleen 19 years ago
parent
commit
2bc0414ee0

+ 1 - 2
arch/x86_64/kernel/e820.c

@@ -23,8 +23,7 @@
 #include <asm/e820.h>
 #include <asm/e820.h>
 #include <asm/proto.h>
 #include <asm/proto.h>
 #include <asm/bootsetup.h>
 #include <asm/bootsetup.h>
-
-extern char _end[];
+#include <asm/sections.h>
 
 
 /* 
 /* 
  * PFN of last memory page.
  * PFN of last memory page.

+ 2 - 4
arch/x86_64/kernel/head64.c

@@ -20,14 +20,14 @@
 #include <asm/setup.h>
 #include <asm/setup.h>
 #include <asm/desc.h>
 #include <asm/desc.h>
 #include <asm/pgtable.h>
 #include <asm/pgtable.h>
+#include <asm/sections.h>
 
 
 /* Don't add a printk in there. printk relies on the PDA which is not initialized 
 /* Don't add a printk in there. printk relies on the PDA which is not initialized 
    yet. */
    yet. */
 static void __init clear_bss(void)
 static void __init clear_bss(void)
 {
 {
-	extern char __bss_start[], __bss_end[];
 	memset(__bss_start, 0,
 	memset(__bss_start, 0,
-	       (unsigned long) __bss_end - (unsigned long) __bss_start);
+	       (unsigned long) __bss_stop - (unsigned long) __bss_start);
 }
 }
 
 
 #define NEW_CL_POINTER		0x228	/* Relative to real mode data */
 #define NEW_CL_POINTER		0x228	/* Relative to real mode data */
@@ -76,8 +76,6 @@ static void __init setup_boot_cpu_data(void)
 	boot_cpu_data.x86_mask = eax & 0xf;
 	boot_cpu_data.x86_mask = eax & 0xf;
 }
 }
 
 
-extern char _end[];
-
 void __init x86_64_start_kernel(char * real_mode_data)
 void __init x86_64_start_kernel(char * real_mode_data)
 {
 {
 	char *s;
 	char *s;

+ 1 - 1
arch/x86_64/kernel/setup.c

@@ -60,6 +60,7 @@
 #include <asm/setup.h>
 #include <asm/setup.h>
 #include <asm/mach_apic.h>
 #include <asm/mach_apic.h>
 #include <asm/numa.h>
 #include <asm/numa.h>
+#include <asm/sections.h>
 
 
 /*
 /*
  * Machine setup..
  * Machine setup..
@@ -103,7 +104,6 @@ struct edid_info edid_info;
 struct e820map e820;
 struct e820map e820;
 
 
 extern int root_mountflags;
 extern int root_mountflags;
-extern char _text, _etext, _edata, _end;
 
 
 char command_line[COMMAND_LINE_SIZE];
 char command_line[COMMAND_LINE_SIZE];
 
 

+ 1 - 1
arch/x86_64/kernel/vmlinux.lds.S

@@ -50,7 +50,7 @@ SECTIONS
 	*(.bss.page_aligned)	
 	*(.bss.page_aligned)	
 	*(.bss)
 	*(.bss)
 	}
 	}
-  __bss_end = .;
+  __bss_stop = .;
 
 
   . = ALIGN(PAGE_SIZE);
   . = ALIGN(PAGE_SIZE);
   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
   . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);

+ 2 - 8
arch/x86_64/mm/init.c

@@ -36,6 +36,7 @@
 #include <asm/mmu_context.h>
 #include <asm/mmu_context.h>
 #include <asm/proto.h>
 #include <asm/proto.h>
 #include <asm/smp.h>
 #include <asm/smp.h>
+#include <asm/sections.h>
 
 
 #ifndef Dprintk
 #ifndef Dprintk
 #define Dprintk(x...)
 #define Dprintk(x...)
@@ -45,8 +46,6 @@
 extern int swiotlb;
 extern int swiotlb;
 #endif
 #endif
 
 
-extern char _stext[];
-
 static unsigned long dma_reserve __initdata;
 static unsigned long dma_reserve __initdata;
 
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -88,9 +87,6 @@ void show_mem(void)
 
 
 /* References to section boundaries */
 /* References to section boundaries */
 
 
-extern char _text, _etext, _edata, __bss_start, _end[];
-extern char __init_begin, __init_end;
-
 int after_bootmem;
 int after_bootmem;
 
 
 static void *spp_getpage(void)
 static void *spp_getpage(void)
@@ -491,8 +487,6 @@ void __init mem_init(void)
 #endif
 #endif
 }
 }
 
 
-extern char __initdata_begin[], __initdata_end[];
-
 void free_initmem(void)
 void free_initmem(void)
 {
 {
 	unsigned long addr;
 	unsigned long addr;
@@ -506,7 +500,7 @@ void free_initmem(void)
 		totalram_pages++;
 		totalram_pages++;
 	}
 	}
 	memset(__initdata_begin, 0xba, __initdata_end - __initdata_begin);
 	memset(__initdata_begin, 0xba, __initdata_end - __initdata_begin);
-	printk ("Freeing unused kernel memory: %luk freed\n", (&__init_end - &__init_begin) >> 10);
+	printk ("Freeing unused kernel memory: %luk freed\n", (__init_end - __init_begin) >> 10);
 }
 }
 
 
 #ifdef CONFIG_BLK_DEV_INITRD
 #ifdef CONFIG_BLK_DEV_INITRD

+ 1 - 0
include/asm-generic/sections.h

@@ -13,5 +13,6 @@ extern char _eextratext[] __attribute__((weak));
 extern char _end[];
 extern char _end[];
 extern char __per_cpu_start[], __per_cpu_end[];
 extern char __per_cpu_start[], __per_cpu_end[];
 extern char __kprobes_text_start[], __kprobes_text_end[];
 extern char __kprobes_text_start[], __kprobes_text_end[];
+extern char __initdata_begin[], __initdata_end[];
 
 
 #endif /* _ASM_GENERIC_SECTIONS_H_ */
 #endif /* _ASM_GENERIC_SECTIONS_H_ */