Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Andi Kleen and committed by
Linus Torvalds
2bc0414e 6b75aeed

+8 -16
+1 -2
arch/x86_64/kernel/e820.c
··· 23 23 #include <asm/e820.h> 24 24 #include <asm/proto.h> 25 25 #include <asm/bootsetup.h> 26 - 27 - extern char _end[]; 26 + #include <asm/sections.h> 28 27 29 28 /* 30 29 * PFN of last memory page.
+2 -4
arch/x86_64/kernel/head64.c
··· 20 20 #include <asm/setup.h> 21 21 #include <asm/desc.h> 22 22 #include <asm/pgtable.h> 23 + #include <asm/sections.h> 23 24 24 25 /* Don't add a printk in there. printk relies on the PDA which is not initialized 25 26 yet. */ 26 27 static void __init clear_bss(void) 27 28 { 28 - extern char __bss_start[], __bss_end[]; 29 29 memset(__bss_start, 0, 30 - (unsigned long) __bss_end - (unsigned long) __bss_start); 30 + (unsigned long) __bss_stop - (unsigned long) __bss_start); 31 31 } 32 32 33 33 #define NEW_CL_POINTER 0x228 /* Relative to real mode data */ ··· 75 75 boot_cpu_data.x86_model = (eax >> 4) & 0xf; 76 76 boot_cpu_data.x86_mask = eax & 0xf; 77 77 } 78 - 79 - extern char _end[]; 80 78 81 79 void __init x86_64_start_kernel(char * real_mode_data) 82 80 {
+1 -1
arch/x86_64/kernel/setup.c
··· 60 60 #include <asm/setup.h> 61 61 #include <asm/mach_apic.h> 62 62 #include <asm/numa.h> 63 + #include <asm/sections.h> 63 64 64 65 /* 65 66 * Machine setup.. ··· 104 103 struct e820map e820; 105 104 106 105 extern int root_mountflags; 107 - extern char _text, _etext, _edata, _end; 108 106 109 107 char command_line[COMMAND_LINE_SIZE]; 110 108
+1 -1
arch/x86_64/kernel/vmlinux.lds.S
··· 50 50 *(.bss.page_aligned) 51 51 *(.bss) 52 52 } 53 - __bss_end = .; 53 + __bss_stop = .; 54 54 55 55 . = ALIGN(PAGE_SIZE); 56 56 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
+2 -8
arch/x86_64/mm/init.c
··· 36 36 #include <asm/mmu_context.h> 37 37 #include <asm/proto.h> 38 38 #include <asm/smp.h> 39 + #include <asm/sections.h> 39 40 40 41 #ifndef Dprintk 41 42 #define Dprintk(x...) ··· 45 44 #ifdef CONFIG_GART_IOMMU 46 45 extern int swiotlb; 47 46 #endif 48 - 49 - extern char _stext[]; 50 47 51 48 static unsigned long dma_reserve __initdata; 52 49 ··· 86 87 } 87 88 88 89 /* References to section boundaries */ 89 - 90 - extern char _text, _etext, _edata, __bss_start, _end[]; 91 - extern char __init_begin, __init_end; 92 90 93 91 int after_bootmem; 94 92 ··· 487 491 #endif 488 492 } 489 493 490 - extern char __initdata_begin[], __initdata_end[]; 491 - 492 494 void free_initmem(void) 493 495 { 494 496 unsigned long addr; ··· 500 506 totalram_pages++; 501 507 } 502 508 memset(__initdata_begin, 0xba, __initdata_end - __initdata_begin); 503 - printk ("Freeing unused kernel memory: %luk freed\n", (&__init_end - &__init_begin) >> 10); 509 + printk ("Freeing unused kernel memory: %luk freed\n", (__init_end - __init_begin) >> 10); 504 510 } 505 511 506 512 #ifdef CONFIG_BLK_DEV_INITRD
+1
include/asm-generic/sections.h
··· 13 13 extern char _end[]; 14 14 extern char __per_cpu_start[], __per_cpu_end[]; 15 15 extern char __kprobes_text_start[], __kprobes_text_end[]; 16 + extern char __initdata_begin[], __initdata_end[]; 16 17 17 18 #endif /* _ASM_GENERIC_SECTIONS_H_ */