[ar71xx] add patches for 2.6.31
[openwrt.git] / target / linux / coldfire / patches / 049-mcfv4e_linker_bss_cleanup.patch
1 From 4e16f08c800d57b986217e0d39d4a06b5bdf641d Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Wed, 19 Mar 2008 17:37:44 -0600
4 Subject: [PATCH] Move BSS section in linker script and zero it on boot.
5
6 To work with the latest round of toolchains the bss section
7 in the linker script needed to be moved to the end (due to
8 the linker thinking there were overlapping sections).
9
10 The BSS section needs to be manually zeroed.
11
12 LTIBName: mcfv4e-linker-bss-cleanup
13 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
14 ---
15  arch/m68k/coldfire/head.S         |   11 +++++++++++
16  arch/m68k/coldfire/vmlinux-cf.lds |   11 ++++++++---
17  2 files changed, 19 insertions(+), 3 deletions(-)
18
19 --- a/arch/m68k/coldfire/head.S
20 +++ b/arch/m68k/coldfire/head.S
21 @@ -321,6 +321,17 @@ ENTRY(__start)
22         movec   %d0, %acr3
23         nop
24  
25 +#ifdef CONFIG_COLDFIRE
26 +/* zero bss */
27 +       lea     _sbss,%a0
28 +       lea     _ebss,%a1
29 +       clrl    %d0
30 +_loop_bss:
31 +       movel   %d0,(%a0)+
32 +       cmpl    %a0,%a1
33 +       bne     _loop_bss
34 +#endif
35 +
36         /* If you change the memory size to another value make a matching 
37            change in paging_init(cf-mmu.c) to zones_size[]. */
38  
39 --- a/arch/m68k/coldfire/vmlinux-cf.lds
40 +++ b/arch/m68k/coldfire/vmlinux-cf.lds
41 @@ -51,9 +51,6 @@ SECTIONS
42         CONSTRUCTORS
43    } :data
44  
45 -  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {                /* BSS */
46 -       *(.bss)
47 -  }
48  
49    . = ALIGN(16);
50    .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET ) {
51 @@ -62,6 +59,8 @@ SECTIONS
52  
53    _edata = .;                  /* End of data section */
54  
55 +  NOTES                                /* support ld --build-id */
56 +
57    . = ALIGN(8192);             /* Initrd */
58    .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
59         __init_begin = .;
60 @@ -111,6 +110,12 @@ SECTIONS
61         *(.data.init_task)      /* The initial task and kernel stack */
62    }
63  
64 +  _sbss = .;
65 +  .bss : AT(ADDR(.bss) - LOAD_OFFSET) {                /* BSS */
66 +       *(.bss)
67 +  }
68 +  _ebss = .;
69 +
70    _end = . ;
71  
72    /* Sections to be discarded */